[PATCH 3/8] Removed all unix related listen statements in test configuration files for cmake build system on Windows.

Ralf Habacker ralf.habacker at freenet.de
Sun Apr 11 01:48:23 PDT 2010


This solution could be removed when autotools also
defines listen tag entries in the build system.
---
 cmake/test/CMakeLists.txt |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/cmake/test/CMakeLists.txt b/cmake/test/CMakeLists.txt
index 3ab1f40..33fe83b 100644
--- a/cmake/test/CMakeLists.txt
+++ b/cmake/test/CMakeLists.txt
@@ -106,6 +106,7 @@ set (CONFIG_VERBOSE 0)
 
 ### copy tests to builddir so that generated tests and static tests 
 ### are all in one place.
+### On win32 all references to a unix  listen tag are removed
 MESSAGE(STATUS "Copying test files to test directory")
 FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.service)
     FOREACH(DIR ${TESTDIRS})
@@ -114,10 +115,22 @@ FOREACH(FILE_TYPE *.message *.message-raw *.auth-script *.sha1 *.txt *.conf *.se
         FOREACH(FILE ${FILES})
             GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME)
             SET (TARGET ${CMAKE_BINARY_DIR}/${DIR}/${FILENAME})
-            configure_file(${FILE} ${TARGET} COPYONLY)
-            IF (CONFIG_VERBOSE)
-                MESSAGE("${FILE}")
-            ENDIF (CONFIG_VERBOSE)
+            GET_FILENAME_COMPONENT(FILENAME ${FILE} EXT)
+            if (WIN32 AND EXT STREQUAL "conf")
+                # this will remove all listen statements
+                set (SEARCH_STRING   "<listen>unix:.*</listen>")
+                FILE(READ ${FILE} _file)
+                STRING(REGEX REPLACE "${SEARCH_STRING}" "<listen>${TEST_LISTEN}</listen>" _file ${_file})
+                FILE(WRITE ${TARGET} ${_file})
+                IF (CONFIG_VERBOSE)
+                    MESSAGE("patched ${FILE}")
+                ENDIF (CONFIG_VERBOSE)
+            else (WIN32 AND EXT STREQUAL "conf")
+                configure_file(${FILE} ${TARGET} COPYONLY)
+            endif (WIN32 AND EXT STREQUAL "conf")
+                IF (CONFIG_VERBOSE)
+                    MESSAGE("copied ${FILE}")
+                ENDIF (CONFIG_VERBOSE)
         ENDFOREACH(FILE)
     ENDFOREACH(DIR)
 ENDFOREACH(FILE_TYPE)
-- 
1.6.5.1.1367.gcd48


--------------080108000403040104060004--


More information about the dbus mailing list