generate all config files from the .in files. Set some of the required variables...
authorFrank Osterfeld <frank@kdab.net>
Mon, 27 Apr 2009 15:58:45 +0000 (17:58 +0200)
committerunknown <Administrator@.(none)>
Mon, 30 Nov 2009 10:09:23 +0000 (11:09 +0100)
cmake/CMakeLists.txt
cmake/test/CMakeLists.txt

index f79295c..0793398 100644 (file)
@@ -494,6 +494,14 @@ else(splitlib AND MSVC)
        set(DBUS_1 dbus-1)
 endif(splitlib AND MSVC)
 
+if (DBUS_BUILD_TESTS)
+    # set variables used for the .in files (substituted by configure_file) in test/data:
+    set(TEST_VALID_SERVICE_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files)
+    set(TEST_VALID_SERVICE_SYSTEM_DIR ${CMAKE_BINARY_DIR}/test/data/valid-service-files-system)
+# TODO: TEST_SOCKET_DIR
+# TODO: TEST_LAUNCH_HELPER_BINARY
+endif  (DBUS_BUILD_TESTS)
+
 ########### subdirs ###############
 
 add_subdirectory( dbus )
index 2540f3d..40b8f49 100644 (file)
@@ -178,11 +178,30 @@ FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.se
        ENDFOREACH(DIR)
 ENDFOREACH(FILE_TYPE)
 
+
 ### generate test files
 SET (CONFIG_FILES test/data/valid-config-files)
 configure_file(${CMAKE_SOURCE_DIR}/${CONFIG_FILES}/debug-allow-all-sha1.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all-sha1.conf )
 configure_file(${CMAKE_SOURCE_DIR}/${CONFIG_FILES}/debug-allow-all.conf.cmake ${CMAKE_BINARY_DIR}/${CONFIG_FILES}/debug-allow-all.conf )
 
+FOREACH(FILE_TYPE *.conf.in *.service.in)
+  FOREACH(DIR ${TESTDIRS})
+    FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${DIR}/${FILE_TYPE}" )
+    FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/${DIR})
+    FOREACH(FILE ${FILES})
+      GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
+      STRING(REGEX REPLACE "\\.in$" "" FILENAME ${FILENAME})
+      SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
+      configure_file(${FILE} ${TARGET} @ONLY IMMEDIATE)
+      IF (CONFIG_VERBOSE)
+        MESSAGE("FROM: ${FILE}\nTO: ${TARGET}\n")
+      ENDIF (CONFIG_VERBOSE)
+    ENDFOREACH(FILE)
+  ENDFOREACH(DIR)
+ENDFOREACH(FILE_TYPE)
+
+
+
 # (rh) disabled copying because bus-test could not parse this files for unknown reasons
 FILE(GLOB FILES "${CMAKE_BINARY_DIR}/bus/*.conf" )
 FOREACH(FILE ${FILES})