Merge branch 'cmake-verbose-config' into 'master'

cmake: add option ENABLE_VERBOSE_CONFIG

See merge request dbus/dbus!230
This commit is contained in:
Simon McVittie 2021-12-10 14:23:34 +00:00
commit 67f1a01f7b
3 changed files with 23 additions and 14 deletions

View 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);

View 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

View 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)