Skip to content

Commit

Permalink
build: Store all generated sources in CMAKE_BINARY_DIR
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Carbenium committed Apr 10, 2021
1 parent 7dee86b commit 3b705c1
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -154,4 +152,6 @@ web/undef.log
zm.conf
zmconfgen.pl
zmlinkcontent.sh
zm_config_data.h
zm_config_defines.h
**/.DS_Store
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion distros/ubuntu1504_cmake_split_packages/rules
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion zmconfgen.pl.in
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3b705c1

Please sign in to comment.