summaryrefslogtreecommitdiffstats
path: root/Tests/FindPython
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2019-05-15 15:35:49 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2019-05-21 14:13:27 (GMT)
commit9f205acefe256ac9707cd500ea1d421916f013cd (patch)
tree4ee6cd3072afc921319f2c3119ea8e576413729e /Tests/FindPython
parent0bf53483295a4b7de358e8b85ad44866d89633c5 (diff)
downloadCMake-9f205acefe256ac9707cd500ea1d421916f013cd.zip
CMake-9f205acefe256ac9707cd500ea1d421916f013cd.tar.gz
CMake-9f205acefe256ac9707cd500ea1d421916f013cd.tar.bz2
FindPython: Implement lookup strategies.
Configration variable Python_FIND_STRATEGY controls the lookup startegy. Possible values are LOCATION and VERSION. Fixes: #19159
Diffstat (limited to 'Tests/FindPython')
-rw-r--r--Tests/FindPython/CMakeLists.txt32
1 files changed, 26 insertions, 6 deletions
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt
index 8dfcf40..4be2f22 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -1,12 +1,22 @@
if(CMake_TEST_FindPython)
- add_test(NAME FindPython.Python2 COMMAND
+ add_test(NAME FindPython.Python2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/Python2"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.LOCATION"
${build_generator_args}
--build-project TestPython2
- --build-options ${build_options}
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VERSION"
+ ${build_generator_args}
+ --build-project TestPython2
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -23,14 +33,24 @@ if(CMake_TEST_FindPython)
set_tests_properties(FindPython.Python2Fail PROPERTIES
PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)")
- add_test(NAME FindPython.Python3 COMMAND
+ add_test(NAME FindPython.Python3.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
"${CMake_SOURCE_DIR}/Tests/FindPython/Python3"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.LOCATION"
${build_generator_args}
--build-project TestPython3
- --build-options ${build_options}
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python3.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3.VERSION"
+ ${build_generator_args}
+ --build-project TestPython3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)