]> granicus.if.org Git - check/commitdiff
cmake: configure test_vars in the tests' CMakeLists.txt
authorbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 6 Jan 2014 04:41:34 +0000 (04:41 +0000)
committerbrarcher <brarcher@64e312b2-a51f-0410-8e61-82d0ca0eb02a>
Mon, 6 Jan 2014 04:41:34 +0000 (04:41 +0000)
git-svn-id: svn+ssh://svn.code.sf.net/p/check/code/trunk@1035 64e312b2-a51f-0410-8e61-82d0ca0eb02a

CMakeLists.txt
tests/CMakeLists.txt

index 08c7e92540fd31003f689379b99aa252bfc4990d..939bec8459d8a6681c46b23f261d127a64ddd5c5 100644 (file)
@@ -293,11 +293,6 @@ add_definitions(-DHAVE_CONFIG_H)
 set(CONFIG_HEADER ${CMAKE_CURRENT_BINARY_DIR}/config.h)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/check_stdint.h.in
   ${CMAKE_CURRENT_BINARY_DIR}/check_stdint.h)
-# For the test_vars.in script, to give the unit test shell script
-# runners the location of the source files
-set(srcdir ${CMAKE_CURRENT_SOURCE_DIR}/tests)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars.in
-  ${CMAKE_CURRENT_SOURCE_DIR}/tests/test_vars)
 
 ###############################################################################
 # Subdirectories
index 98715f46db4e24bf56a79eaf1d210e5b60e53e55..31d501367c77a360ded13e12079a57036bd07d2e 100644 (file)
@@ -24,6 +24,21 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src)
 # Enable finding check.h
 include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src)
 
+# For the test_vars.in script, to give the unit test shell script
+# runners the location of the source files
+set(srcdir "${CMAKE_CURRENT_SOURCE_DIR}")
+
+if(WIN32)
+  # CMake uses Unix slashes for everything, but the tests that
+  # read srcdir expect platform specific slashes. There are two
+  # slashes because the shell scripts will consume srcdir.
+  string(REPLACE "/" "\\\\" srcdir "${srcdir}")
+  set(EXEEXT ".exe")
+endif(WIN32)
+
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/test_vars.in
+  ${CMAKE_CURRENT_SOURCE_DIR}/test_vars)
+
 set(CHECK_CHECK_SOURCES
   check_check_exit.c
   check_check_fixture.c