summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-02-22 13:14:18 (GMT)
committerBrad King <brad.king@kitware.com>2013-02-22 13:25:05 (GMT)
commitd45eb35350abc72887784802f1e093ad1c4ff5b2 (patch)
tree05cfbc328a5f99deca42fcd5d8beebb460568832 /Tests/CMakeLists.txt
parentef8b2fd101e0aa10f82a140822509e303a2b1bc6 (diff)
downloadCMake-d45eb35350abc72887784802f1e093ad1c4ff5b2.zip
CMake-d45eb35350abc72887784802f1e093ad1c4ff5b2.tar.gz
CMake-d45eb35350abc72887784802f1e093ad1c4ff5b2.tar.bz2
Tests: Generalize decision for 'make' tool supporting spaces
Some make tools do not support spaces inside the source tree paths. Decide early whether to add tests that depend on support for spaces so we can use the result in a decision for any test.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt38
1 files changed, 22 insertions, 16 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9231605..d74fffd 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -50,6 +50,26 @@ if(BUILD_TESTING)
set(TEST_CompileCommandOutput 1)
endif()
+ set(MAKE_IS_GNU )
+ if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
+ execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
+ RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
+ if("${res}" STREQUAL "0")
+ if("${out}" MATCHES "GNU")
+ set(MAKE_IS_GNU 1)
+ endif()
+ endif()
+ endif()
+
+ # some old versions of make simply cannot handle spaces in paths
+ if (MAKE_IS_GNU OR
+ "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
+ "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
+ set(MAKE_SUPPORTS_SPACES 1)
+ else()
+ set(MAKE_SUPPORTS_SPACES 0)
+ endif()
+
set(build_generator_args
--build-generator ${CMAKE_TEST_GENERATOR}
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
@@ -1238,22 +1258,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/kwsys")
endif()
- set(MAKE_IS_GNU )
- if(${CMAKE_TEST_MAKEPROGRAM} MATCHES make)
- execute_process(COMMAND ${CMAKE_TEST_MAKEPROGRAM} no_such_target --version
- RESULT_VARIABLE res OUTPUT_VARIABLE out ERROR_VARIABLE out)
- if("${res}" STREQUAL "0")
- if("${out}" MATCHES "GNU")
- set(MAKE_IS_GNU 1)
- endif()
- endif()
- endif()
- # only add this test on platforms that support it
- # some old versions of make simply cannot handle spaces in paths
- if (MAKE_IS_GNU OR
- "${CMAKE_TEST_MAKEPROGRAM}" MATCHES "nmake|gmake|wmake" OR
- "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio|XCode|Borland")
+ if(MAKE_SUPPORTS_SPACES)
add_test(SubDirSpaces ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/SubDirSpaces"
@@ -2396,7 +2402,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
if(TEST_CompileCommandOutput)
set(CompileCommandOutput_EXTRA_OPTIONS
- --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_IS_GNU})
+ --build-options -DMAKE_SUPPORTS_SPACES=${MAKE_SUPPORTS_SPACES})
ADD_TEST_MACRO(CompileCommandOutput
"${CMake_BINARY_DIR}/Tests/CMakeLib/runcompilecommands")
endif()