From 4db0dea1f2c17cd862219a28228c750d5ce15eae Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Wed, 3 Feb 2021 21:22:28 +0100 Subject: [PATCH] Build: Make building man pages optional (enabled by default) Add a new CMake option (-DBUILD_MAN) which can be used to deactivate the man page build steps. This is especially useful in a development situation where "make all" is needlessly slowed down by these build steps. --- CMakeLists.txt | 12 ++++++++++++ onvif/modules/CMakeLists.txt | 2 +- onvif/proxy/CMakeLists.txt | 2 +- scripts/CMakeLists.txt | 8 +++++--- scripts/ZoneMinder/CMakeLists.txt | 2 +- src/CMakeLists.txt | 6 ++++-- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ff2cb7d2..ef09e3551 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,6 +134,8 @@ mark_as_advanced( ZM_SYSTEMD ZM_MANPAGE_DEST_PREFIX) +option(BUILD_MAN "Build man pages" 1) + set(ZM_RUNDIR "/var/run/zm" CACHE PATH "Location of transient process files, default: /var/run/zm") set(ZM_SOCKDIR "/var/run/zm" CACHE PATH @@ -259,6 +261,16 @@ elseif(ZM_TARGET_DISTRO STREQUAL "FreeBSD") set(ZM_PERL_MM_PARMS "INSTALLDIRS=site") endif((ZM_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc")) +if(BUILD_MAN) + message(STATUS "Building man pages: Yes (default)") + set(ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS}) +else() + message(STATUS "Building man pages: No") + list(APPEND ZM_PERL_MM_PARMS_FULL ${ZM_PERL_MM_PARMS} + "INSTALLMAN1DIR=none" + "INSTALLMAN3DIR=none") +endif(BUILD_MAN) + # Required for certain checks to work set(CMAKE_EXTRA_INCLUDE_FILES ${CMAKE_EXTRA_INCLUDE_FILES} stdio.h stdlib.h math.h signal.h diff --git a/onvif/modules/CMakeLists.txt b/onvif/modules/CMakeLists.txt index d7ddbf466..5cabfc7ef 100644 --- a/onvif/modules/CMakeLists.txt +++ b/onvif/modules/CMakeLists.txt @@ -9,7 +9,7 @@ endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) # MAKEMAKER_NOECHO_COMMAND previously defined in /scripts/zoneminder/CMakeLists.txt # Add build target for the perl modules -add_custom_target(zmonvifmodules ALL perl Makefile.PL ${ZM_PERL_MM_PARMS} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") +add_custom_target(zmonvifmodules ALL perl Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") # Add install target for the perl modules install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") diff --git a/onvif/proxy/CMakeLists.txt b/onvif/proxy/CMakeLists.txt index 1a40c0ffb..7d7ec664a 100644 --- a/onvif/proxy/CMakeLists.txt +++ b/onvif/proxy/CMakeLists.txt @@ -9,7 +9,7 @@ endif(NOT (CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)) # MAKEMAKER_NOECHO_COMMAND previously defined in /scripts/zoneminder/CMakeLists.txt # Add build target for the perl modules -add_custom_target(zmonvifproxy ALL perl Makefile.PL ${ZM_PERL_MM_PARMS} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") +add_custom_target(zmonvifproxy ALL perl Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR=${CMAKE_CURRENT_BINARY_DIR}/output ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl ONVIF proxy module") # Add install target for the perl modules install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 5502a42a8..1ed322deb 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -30,11 +30,13 @@ configure_file(zm.in "${CMAKE_CURRENT_BINARY_DIR}/zm" @ONLY) #configure_file(zmeventdump.in zmeventdump @ONLY) # Generate man files for the perl scripts destined for the bin folder -file(GLOB perlscripts "${CMAKE_CURRENT_BINARY_DIR}/*.pl") -FOREACH(PERLSCRIPT ${perlscripts}) +if(BUILD_MAN) + file(GLOB perlscripts "${CMAKE_CURRENT_BINARY_DIR}/*.pl") + FOREACH(PERLSCRIPT ${perlscripts}) get_filename_component(PERLSCRIPTNAME ${PERLSCRIPT} NAME) POD2MAN(${PERLSCRIPT} ${PERLSCRIPTNAME} 8 ${ZM_MANPAGE_DEST_PREFIX}) -ENDFOREACH(PERLSCRIPT ${perlscripts}) + ENDFOREACH(PERLSCRIPT ${perlscripts}) +endif(BUILD_MAN) # Install the perl scripts install(FILES diff --git a/scripts/ZoneMinder/CMakeLists.txt b/scripts/ZoneMinder/CMakeLists.txt index 876a33da3..a5914f0e0 100644 --- a/scripts/ZoneMinder/CMakeLists.txt +++ b/scripts/ZoneMinder/CMakeLists.txt @@ -25,7 +25,7 @@ else(CMAKE_VERBOSE_MAKEFILE) endif(CMAKE_VERBOSE_MAKEFILE) # Add build target for the perl modules -add_custom_target(zmperlmodules ALL perl Makefile.PL ${ZM_PERL_MM_PARMS} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules") +add_custom_target(zmperlmodules ALL perl Makefile.PL ${ZM_PERL_MM_PARMS_FULL} FIRST_MAKEFILE=MakefilePerl DESTDIR="${CMAKE_CURRENT_BINARY_DIR}/output" ${MAKEMAKER_NOECHO_COMMAND} COMMAND make -f MakefilePerl pure_install COMMENT "Building ZoneMinder perl modules") # Add install target for the perl modules install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/output/" DESTINATION "/") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 21dac14a8..c9f11b064 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -87,9 +87,11 @@ target_link_libraries(zmu zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS} ${CMAKE_DL_LIBS} bc target_link_libraries(zms zm ${ZM_EXTRA_LIBS} ${ZM_BIN_LIBS} ${CMAKE_DL_LIBS} bcrypt) # Generate man files for the binaries destined for the bin folder -FOREACH(CBINARY zmc zmu) +if(BUILD_MAN) + FOREACH(CBINARY zmc zmu) POD2MAN(${CMAKE_CURRENT_SOURCE_DIR}/${CBINARY}.cpp ${CBINARY} 8 ${ZM_MANPAGE_DEST_PREFIX}) -ENDFOREACH(CBINARY zmc zmu) + ENDFOREACH(CBINARY zmc zmu) +endif(BUILD_MAN) install(TARGETS zmc zmu RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(TARGETS zms RUNTIME DESTINATION "${ZM_CGIDIR}" PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)