From 3b705c15fe746a05527b8f3b0a18b08e111347ff Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Tue, 6 Apr 2021 23:21:47 +0200 Subject: [PATCH] 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. --- .gitignore | 4 ++-- CMakeLists.txt | 2 -- distros/ubuntu1504_cmake_split_packages/rules | 2 +- src/CMakeLists.txt | 3 ++- zmconfgen.pl.in | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index e7ae9ceab..e617d937c 100644 --- a/.gitignore +++ b/.gitignore @@ -120,8 +120,6 @@ src/CMakeFiles/ src/cmake_install.cmake src/libzm.a src/nph-zms -src/zm_config_data.h -src/zm_config_defines.h src/zmc src/zmf src/zms @@ -154,4 +152,6 @@ web/undef.log zm.conf zmconfgen.pl zmlinkcontent.sh +zm_config_data.h +zm_config_defines.h **/.DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 76c48f530..c5007b396 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -236,8 +236,6 @@ endif() # Required for certain checks to work 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 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON) diff --git a/distros/ubuntu1504_cmake_split_packages/rules b/distros/ubuntu1504_cmake_split_packages/rules index 4c7164c48..4cf1e0c58 100755 --- a/distros/ubuntu1504_cmake_split_packages/rules +++ b/distros/ubuntu1504_cmake_split_packages/rules @@ -72,7 +72,7 @@ override_dh_auto_test: override_dh_clean: # Add here commands to clean up after the build process. [ ! -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 find $(CURDIR)/ -type f -name "Makefile" | while read file; do \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 37b08ad58..d9c4d92fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ # CMakeLists.txt for the ZoneMinder binaries # 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) set(ZM_BIN_SRC_FILES @@ -74,6 +74,7 @@ add_library(zm STATIC ${ZM_BIN_SRC_FILES}) target_include_directories(zm PUBLIC + ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries(zm diff --git a/zmconfgen.pl.in b/zmconfgen.pl.in index d3f165651..0674d7183 100644 --- a/zmconfgen.pl.in +++ b/zmconfgen.pl.in @@ -30,7 +30,7 @@ use ZoneMinder::ConfigData qw/:data/; $| = 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'; generateConfigFiles();