]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
cmake: add option ENABLE_VERBOSE_CONFIG
authorRalf Habacker <ralf.habacker@freenet.de>
Mon, 6 Dec 2021 11:22:58 +0000 (12:22 +0100)
committerSimon McVittie <smcv@collabora.com>
Fri, 10 Dec 2021 14:16:52 +0000 (14:16 +0000)
Checking the filenames of generated configuration files is now optionally
possible with this cmake option. They are no longer displayed by default
to avoid unnecessarily flooding the output.

CMakeLists.txt
README.cmake
test/CMakeLists.txt

index 3b57e4e01d91b97699e08d1f802e5ac8338a68dd..c9b3784b0fd0422e0de2efaaf1a93ad34d1f7573 100644 (file)
@@ -96,6 +96,7 @@ endif()
 
 option(DBUS_RELOCATABLE "Attempt to make metadata relocatable" ON)
 option(DBUS_ENABLE_PKGCONFIG "Enable pkgconfig support" ON)
+option(ENABLE_VERBOSE_CONFIG "Be verbose on generating config files" OFF)
 
 # For simplicity, we're not relocatable if CMAKE_INSTALL_LIBDIR
 # is something more complicated (e.g. Debian multiarch);
index 1d32302a78ac424686cb7849a13e7f2d4d2bd332..a9e4feb7fa03803addf7ebf5d82a78a23067ce9a 100644 (file)
@@ -158,6 +158,9 @@ ENABLE_SYSTEMD:STRING=AUTO
 // Directory for systemd service files
 WITH_SYSTEMD_SYSTEMUNITDIR:STRING=
 
+// Be verbose on generating config files
+ENABLE_VERBOSE_CONFIG:BOOL=OFF
+
 // enable user-session semantics for session bus under systemd
 ENABLE_USER_SESSION:BOOL=ON
 
index 20e75d85c78c8a9cd8f3f5b1c4988078621db59f..4689c78b53be32b3509f76afeed2021252cbfe9a 100644 (file)
@@ -227,7 +227,6 @@ set(TESTDIRS
     data/equiv-config-files/entities
     data/equiv-config-files/entities/basic.d
 )
-set(CONFIG_VERBOSE 1)
 
 foreach(DIR ${TESTDIRS})
     file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
@@ -235,23 +234,32 @@ endforeach()
 
 ### copy tests to builddir so that generated tests and static tests 
 ### are all in one place.
-message(STATUS "Copying test files to test directory")
+if(NOT ENABLE_VERBOSE_CONFIG)
+    set(HINT " (use -DENABLE_VERBOSE_CONFIG=ON to see the list of files)")
+endif()
+
+message(STATUS "Copying test files to test directory${HINT}")
+
+macro(dbus_configure_file _src _dest)
+    configure_file(${_src} ${_dest} ${ARGN})
+    if(ENABLE_VERBOSE_CONFIG)
+        message("   generating ${_dest}")
+    endif()
+endmacro()
+
 foreach(FILE_TYPE *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
     foreach(DIR ${TESTDIRS})
         file(GLOB FILES "${DIR}/${FILE_TYPE}" )
         foreach(FILE ${FILES})
             get_filename_component(FILENAME ${FILE} NAME)
             set(TARGET ${CMAKE_CURRENT_BINARY_DIR}/${DIR}/${FILENAME})
-            configure_file(${FILE} ${TARGET} COPYONLY)
-            if(CONFIG_VERBOSE)
-                message("${FILE}")
-            endif()
+            dbus_configure_file(${FILE} ${TARGET} COPYONLY)
         endforeach()
     endforeach()
 endforeach()
 
 ### generate test files
-message(STATUS "Generating test files from templates into test directory")
+message(STATUS "Generating test files from templates into test directory${HINT}")
 
 foreach(FILE_TYPE *.conf.in *.service.in)
     foreach(DIR ${TESTDIRS})
@@ -260,14 +268,11 @@ foreach(FILE_TYPE *.conf.in *.service.in)
         get_filename_component(FILENAME ${FILE} NAME)
         string(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
         set(TARGET ${CMAKE_CURRENT_BINARY_DIR}/${DIR}/${FILENAME})
-        configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
-        if(CONFIG_VERBOSE)
-        message("${FILE}")
-        endif()
+        dbus_configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
     endforeach()
     endforeach()
 endforeach()
 
-message(STATUS "Copying generated bus config files to test directory")
-configure_file(../bus/session.conf.in ${CMAKE_BINARY_DIR}/test/data/valid-config-files/session.conf @ONLY)
-configure_file(../bus/system.conf.in ${CMAKE_BINARY_DIR}/test/data/valid-config-files-system/system.conf @ONLY)
+message(STATUS "Copying generated bus config files to test directory${HINT}")
+dbus_configure_file(../bus/session.conf.in ${CMAKE_BINARY_DIR}/test/data/valid-config-files/session.conf @ONLY)
+dbus_configure_file(../bus/system.conf.in ${CMAKE_BINARY_DIR}/test/data/valid-config-files-system/system.conf @ONLY)