build: Store all generated sources in CMAKE_BINARY_DIR

config.h is already generated there so move zm_config_data.h and zm_config_define.h
there as well. Also limit the scope of CMAKE_BINARY_DIR as include directory to the zm target.
All in all this makes zm_config_data and zm_config_define available when building the tests target.
This commit is contained in:
Peter Keresztes Schmidt 2021-04-06 23:21:47 +02:00
parent 7dee86b104
commit 3b705c15fe
5 changed files with 6 additions and 7 deletions

4
.gitignore vendored
View File

@ -120,8 +120,6 @@ src/CMakeFiles/
src/cmake_install.cmake src/cmake_install.cmake
src/libzm.a src/libzm.a
src/nph-zms src/nph-zms
src/zm_config_data.h
src/zm_config_defines.h
src/zmc src/zmc
src/zmf src/zmf
src/zms src/zms
@ -154,4 +152,6 @@ web/undef.log
zm.conf zm.conf
zmconfgen.pl zmconfgen.pl
zmlinkcontent.sh zmlinkcontent.sh
zm_config_data.h
zm_config_defines.h
**/.DS_Store **/.DS_Store

View File

@ -236,8 +236,6 @@ endif()
# Required for certain checks to work # Required for certain checks to work
set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h) set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h)
# Required for including headers from the this folder
include_directories("${CMAKE_BINARY_DIR}")
# This is required to enable searching in lib64 (if exists), do not change # This is required to enable searching in lib64 (if exists), do not change
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)

View File

@ -72,7 +72,7 @@ override_dh_auto_test:
override_dh_clean: override_dh_clean:
# Add here commands to clean up after the build process. # Add here commands to clean up after the build process.
[ ! -f Makefile ] || $(MAKE) distclean [ ! -f Makefile ] || $(MAKE) distclean
dh_clean src/zm_config_defines.h dh_clean zm_config_defines.h
# #
# Delete remaining auto-generated Makefile if Makefile.in exists # Delete remaining auto-generated Makefile if Makefile.in exists
find $(CURDIR)/ -type f -name "Makefile" | while read file; do \ find $(CURDIR)/ -type f -name "Makefile" | while read file; do \

View File

@ -1,7 +1,7 @@
# CMakeLists.txt for the ZoneMinder binaries # CMakeLists.txt for the ZoneMinder binaries
# Create files from the .in files # Create files from the .in files
configure_file(zm_config_data.h.in "${CMAKE_CURRENT_BINARY_DIR}/zm_config_data.h" @ONLY) configure_file(zm_config_data.h.in "${CMAKE_BINARY_DIR}/zm_config_data.h" @ONLY)
# Group together all the source files that are used by all the binaries (zmc, zmu, zms etc) # Group together all the source files that are used by all the binaries (zmc, zmu, zms etc)
set(ZM_BIN_SRC_FILES set(ZM_BIN_SRC_FILES
@ -74,6 +74,7 @@ add_library(zm STATIC ${ZM_BIN_SRC_FILES})
target_include_directories(zm target_include_directories(zm
PUBLIC PUBLIC
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}) ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(zm target_link_libraries(zm

View File

@ -30,7 +30,7 @@ use ZoneMinder::ConfigData qw/:data/;
$| = 1; $| = 1;
my $config_header = '@CMAKE_CURRENT_BINARY_DIR@/src/zm_config_defines.h'; my $config_header = '@CMAKE_BINARY_DIR@/zm_config_defines.h';
my $config_sql = '@CMAKE_CURRENT_BINARY_DIR@/db/zm_create.sql'; my $config_sql = '@CMAKE_CURRENT_BINARY_DIR@/db/zm_create.sql';
generateConfigFiles(); generateConfigFiles();