summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-06-19 12:15:55 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-06-19 12:15:59 (GMT)
commitd736b2ef3ac9fcf97b6a8de02337056e6fd0d971 (patch)
tree252bf5f9368aa5c30d111ca8910640c7ddb2efd5 /Tests
parent2139987ba4c393d5405611d63f51153384dccfe0 (diff)
parentab6e1e49c0ad2395cb1f5befb9e8908256b3910c (diff)
downloadCMake-d736b2ef3ac9fcf97b6a8de02337056e6fd0d971.zip
CMake-d736b2ef3ac9fcf97b6a8de02337056e6fd0d971.tar.gz
CMake-d736b2ef3ac9fcf97b6a8de02337056e6fd0d971.tar.bz2
Merge topic 'test-extra-generators'
ab6e1e49c0 Tests: Simplify addition of extra generator tests 882483192d cmake: Simplify internal conditions for adding extra generators Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4909
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt54
1 files changed, 22 insertions, 32 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index b771ff5..4fb905e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -698,38 +698,28 @@ if(BUILD_TESTING)
# build the "Simple" test with the ExtraGenerators, if available
# This doesn't test whether the generated project files work (unfortunately),
# mainly it tests that cmake doesn't crash when generating these project files.
- if(${CMAKE_GENERATOR} MATCHES "Unix Makefiles" OR ${CMAKE_GENERATOR} MATCHES "Ninja")
-
- # check which generators we have
- execute_process(COMMAND ${CMAKE_CMAKE_COMMAND} --help
- OUTPUT_VARIABLE cmakeOutput ERROR_VARIABLE cmakeOutput)
-
- set(extraGenerators
- "CodeBlocks"
- "CodeLite"
- "Eclipse CDT4"
- "Kate"
- "Sublime Text 2")
-
- foreach(extraGenerator ${extraGenerators})
- if ("${cmakeOutput}" MATCHES "${extraGenerator} - ${CMAKE_GENERATOR}")
- set(extraGeneratorTestName "Simple_${extraGenerator}Generator")
- string(REPLACE " " "" extraGeneratorTestName ${extraGeneratorTestName})
-
- add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/Simple"
- "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
- --build-two-config
- --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
- --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
- --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
- --build-project Simple
- --test-command Simple)
- list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
- endif ()
- endforeach(extraGenerator)
-
+ if(CMAKE_GENERATOR MATCHES "^(Unix Makefiles|Ninja)$"
+ AND NOT "${CMAKE_CURRENT_BINARY_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
+ foreach(extraGenerator
+ "CodeBlocks"
+ "CodeLite"
+ "Eclipse CDT4"
+ "Kate"
+ "Sublime Text 2"
+ )
+ string(REPLACE " " "" extraGeneratorTestName "Simple_${extraGenerator}Generator")
+ add_test(${extraGeneratorTestName} ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/Simple"
+ "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}"
+ --build-two-config
+ --build-generator "${extraGenerator} - ${CMAKE_GENERATOR}"
+ --build-generator-platform "${CMAKE_GENERATOR_PLATFORM}"
+ --build-generator-toolset "${CMAKE_GENERATOR_TOOLSET}"
+ --build-project Simple
+ --test-command Simple)
+ list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/${extraGeneratorTestName}")
+ endforeach()
endif()
# test for correct sub-project generation