diff options
| author | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-26 19:43:57 (GMT) |
|---|---|---|
| committer | Kyle Edwards <kyle.edwards@kitware.com> | 2020-10-26 19:43:57 (GMT) |
| commit | b8937a992b956b16a9181737f695ca118c5eea49 (patch) | |
| tree | 02b30e7d14f767c28e0ef69af3351f343d7bf8c9 /Tests/FindPython | |
| parent | d13bd6ec3d7232b4b62d3106684f4f57951f3b28 (diff) | |
| parent | 9fa7afe7d332ced27264f1ef7c921aa1d95bc476 (diff) | |
| download | CMake-b8937a992b956b16a9181737f695ca118c5eea49.zip CMake-b8937a992b956b16a9181737f695ca118c5eea49.tar.gz CMake-b8937a992b956b16a9181737f695ca118c5eea49.tar.bz2 | |
Merge branch 'release' into ninja-multi-per-config-sources
Diffstat (limited to 'Tests/FindPython')
24 files changed, 240 insertions, 81 deletions
diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index fdfa36e..44484c3 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -243,6 +243,87 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.Python3.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 + -DPython3_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python3.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python3.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python3 -DPython_REQUESTED_VERSION=3 + -DPython3_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.Python2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.Python.V2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python.V2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=2 + -DPython_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.Python.V3.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=3 + -DPython_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.Python.V3.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/Python.V3.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python -DPython_REQUESTED_VERSION=3 + -DPython_FIND_STRATEGY=VERSION + ) + add_test(NAME FindPython.MultiplePackages COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test @@ -492,6 +573,29 @@ if(CMake_TEST_FindPython_IronPython) --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + + add_test(NAME FindPython.IronPython2.VersionRange.LOCATION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.VersionRange.LOCATION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_IMPLEMENTATIONS=IronPython + -DPython2_FIND_STRATEGY=LOCATION + ) + add_test(NAME FindPython.IronPython2.VersionRange.VERSION COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/VersionRange" + "${CMake_BINARY_DIR}/Tests/FindPython/IronPython2.VersionRange.VERSION" + ${build_generator_args} + --build-project TestVersionRange + --build-options ${build_options} -DPython=Python2 -DPython_REQUESTED_VERSION=2 + -DPython2_FIND_IMPLEMENTATIONS=IronPython + -DPython2_FIND_STRATEGY=VERSION + ) endif() if(CMake_TEST_FindPython_PyPy) diff --git a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt index fed963e..2164ac1 100644 --- a/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt +++ b/Tests/FindPython/CustomFailureMessage/Check/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(TestCustomFailureMessage.Check LANGUAGES C) +project(TestCustomFailureMessage.Check LANGUAGES NONE) find_package (Python3 REQUIRED COMPONENTS ${CHECK_COMPONENTS}) diff --git a/Tests/FindPython/ExactVersion/CMakeLists.txt b/Tests/FindPython/ExactVersion/CMakeLists.txt index e09f73a..60abb26 100644 --- a/Tests/FindPython/ExactVersion/CMakeLists.txt +++ b/Tests/FindPython/ExactVersion/CMakeLists.txt @@ -1,16 +1,16 @@ cmake_minimum_required(VERSION 3.1) -project(TestExactVersion C) +project(TestExactVersion LANGUAGES C) find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development) -if (NOT Python${Python_MAJOR_VERSION}_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +if(NOT Python${Python_MAJOR_VERSION}_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}") endif() -if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter") +if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter") endif() -if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development") +if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development") endif() if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter) @@ -26,22 +26,22 @@ endif() # reset artifacts and second search with exact version already founded -unset (Python${Python_MAJOR_VERSION}_EXECUTABLE) -unset (_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE) +unset(Python${Python_MAJOR_VERSION}_EXECUTABLE) +unset(_Python${Python_MAJOR_VERSION}_EXECUTABLE CACHE) -unset (_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE) -unset (_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE) +unset(_Python${Python_MAJOR_VERSION}_LIBRARY_RELEASE CACHE) +unset(_Python${Python_MAJOR_VERSION}_INCLUDE_DIR CACHE) -set (Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION}) +set(Python_REQUESTED_VERSION ${Python${Python_MAJOR_VERSION}_VERSION}) find_package(Python${Python_MAJOR_VERSION} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter Development) -if (NOT Python${Python_MAJOR_VERSION}_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") +if(NOT Python${Python_MAJOR_VERSION}_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}") endif() -if (NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Interpreter") +if(NOT Python${Python_MAJOR_VERSION}_Interpreter_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Interpreter") endif() -if (NOT Python${Python_MAJOR_VERSION}_Development_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION} Development") +if(NOT Python${Python_MAJOR_VERSION}_Development_FOUND) + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION} Development") endif() if(NOT TARGET Python${Python_MAJOR_VERSION}::Interpreter) diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt index d64fa1e..592329b 100644 --- a/Tests/FindPython/Implementation/CMakeLists.txt +++ b/Tests/FindPython/Implementation/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.1) -project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C) +project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} LANGUAGES NONE) set (Python${Python_REQUESTED_VERSION}_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION}) find_package(Python${Python_REQUESTED_VERSION} COMPONENTS Interpreter) if (NOT Python${Python_REQUESTED_VERSION}_FOUND OR NOT Python${Python_REQUESTED_VERSION}_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python${Python_REQUESTED_VERSION}") + message (FATAL_ERROR "Failed to find Python${Python_REQUESTED_VERSION}") endif() if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython" @@ -24,7 +24,7 @@ set (Python_FIND_IMPLEMENTATIONS ${Python_REQUESTED_IMPLEMENTATION}) find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter) if (NOT Python_FOUND OR NOT Python_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}") endif() if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython" diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt index 3493c29..47ca022 100644 --- a/Tests/FindPython/IronPython/CMakeLists.txt +++ b/Tests/FindPython/IronPython/CMakeLists.txt @@ -1,23 +1,23 @@ cmake_minimum_required(VERSION 3.1) -project(TestIronPython C) +project(TestIronPython LANGUAGES NONE) set (Python_FIND_IMPLEMENTATIONS IronPython) find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Compiler) if (NOT Python_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}") endif() if (NOT Python_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python Interpreter") + message (FATAL_ERROR "Failed to find Python Interpreter") endif() if (NOT Python_INTERPRETER_ID STREQUAL "IronPython") message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") endif() if (NOT Python_Compiler_FOUND) - message (FATAL_ERROR "Fail to found Python Compiler") + message (FATAL_ERROR "Failed to find Python Compiler") endif() if (NOT Python_COMPILER_ID STREQUAL "IronPython") message (FATAL_ERROR "Erroneous compiler ID (${Python_COMPILER_ID})") diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt index 1db798c..fd9d947 100644 --- a/Tests/FindPython/IronPython2/CMakeLists.txt +++ b/Tests/FindPython/IronPython2/CMakeLists.txt @@ -1,23 +1,23 @@ cmake_minimum_required(VERSION 3.1) -project(TestIronPython2 C) +project(TestIronPython2 LANGUAGES NONE) set (Python2_FIND_IMPLEMENTATIONS "IronPython") find_package(Python2 COMPONENTS Interpreter Compiler) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python 2") + message (FATAL_ERROR "Failed to find Python 2") endif() if (NOT Python2_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python 2 Interpreter") + message (FATAL_ERROR "Failed to find Python 2 Interpreter") endif() if (NOT Python2_INTERPRETER_ID STREQUAL "IronPython") message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})") endif() if (NOT Python2_Compiler_FOUND) - message (FATAL_ERROR "Fail to found Python 2 Compiler") + message (FATAL_ERROR "Failed to find Python 2 Compiler") endif() if (NOT Python2_COMPILER_ID STREQUAL "IronPython") message (FATAL_ERROR "Erroneous compiler ID (${Python2_COMPILER_ID})") diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt index f557026..3e17f68 100644 --- a/Tests/FindPython/NumPy/CMakeLists.txt +++ b/Tests/FindPython/NumPy/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestNumPy C) +project(TestNumPy LANGUAGES C) find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy) find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy) diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt index a5db603..bedc627 100644 --- a/Tests/FindPython/NumPyOnly/CMakeLists.txt +++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestNumPyOnly C) +project(TestNumPyOnly LANGUAGES C) find_package(Python2 REQUIRED COMPONENTS NumPy) find_package(Python3 REQUIRED COMPONENTS NumPy) diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt index b4ade8c..4cf7c0a 100644 --- a/Tests/FindPython/PyPy/CMakeLists.txt +++ b/Tests/FindPython/PyPy/CMakeLists.txt @@ -1,29 +1,29 @@ cmake_minimum_required(VERSION 3.1) -project(TestPyPy C) +project(TestPyPy LANGUAGES C) set (Python_FIND_IMPLEMENTATIONS PyPy) find_package(Python ${Python_REQUESTED_VERSION} COMPONENTS Interpreter Development) if (NOT Python_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION}") + message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION}") endif() if (NOT Python_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy Interpreter") + message (FATAL_ERROR "Failed to find Python PyPy Interpreter") endif() if (NOT Python_INTERPRETER_ID STREQUAL "PyPy") message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})") endif() if (NOT Python_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Module") + message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Module") endif() if (NOT Python_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development.Embed") + message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development.Embed") endif() if (NOT Python_Development_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy ${Python_REQUESTED_VERSION} Development") + message (FATAL_ERROR "Failed to find Python PyPy ${Python_REQUESTED_VERSION} Development") endif() if(NOT TARGET Python::Interpreter) diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt index 2f0ddc9..ebfc9ab 100644 --- a/Tests/FindPython/PyPy2/CMakeLists.txt +++ b/Tests/FindPython/PyPy2/CMakeLists.txt @@ -1,29 +1,29 @@ cmake_minimum_required(VERSION 3.1) -project(TestPyPy2 C) +project(TestPyPy2 LANGUAGES C) set (Python2_FIND_IMPLEMENTATIONS "PyPy") find_package(Python2 COMPONENTS Interpreter Development) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 2") + message (FATAL_ERROR "Failed to find Python PyPy 2") endif() if (NOT Python2_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 2 Interpreter") + message (FATAL_ERROR "Failed to find Python PyPy 2 Interpreter") endif() if (NOT Python2_INTERPRETER_ID STREQUAL "PyPy") message (FATAL_ERROR "Erroneous interpreter ID (${Python2_INTERPRETER_ID})") endif() if (NOT Python2_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Module") + message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Module") endif() if (NOT Python2_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed") + message (FATAL_ERROR "Failed to find Python PyPy 2 Development.Embed") endif() if (NOT Python2_Development_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 2 Development") + message (FATAL_ERROR "Failed to find Python PyPy 2 Development") endif() if(NOT TARGET Python2::Interpreter) diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt index 5562d57..bf7cd61 100644 --- a/Tests/FindPython/PyPy3/CMakeLists.txt +++ b/Tests/FindPython/PyPy3/CMakeLists.txt @@ -1,29 +1,29 @@ cmake_minimum_required(VERSION 3.1) -project(TestPyPy3 C) +project(TestPyPy3 LANGUAGES C) set (Python3_FIND_IMPLEMENTATIONS "PyPy") find_package(Python3 COMPONENTS Interpreter Development) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 3") + message (FATAL_ERROR "Failed to find Python PyPy 3") endif() if (NOT Python3_Interpreter_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 3 Interpreter") + message (FATAL_ERROR "Failed to find Python PyPy 3 Interpreter") endif() if (NOT Python3_INTERPRETER_ID STREQUAL "PyPy") message (FATAL_ERROR "Erroneous interpreter ID (${Python3_INTERPRETER_ID})") endif() if (NOT Python3_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Module") + message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Module") endif() if (NOT Python3_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed") + message (FATAL_ERROR "Failed to find Python PyPy 3 Development.Embed") endif() if (NOT Python3_Development_FOUND) - message (FATAL_ERROR "Fail to found Python PyPy 3 Development") + message (FATAL_ERROR "Failed to find Python PyPy 3 Development") endif() if(NOT TARGET Python3::Interpreter) diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt index e8828a2..9bec22f 100644 --- a/Tests/FindPython/Python/CMakeLists.txt +++ b/Tests/FindPython/Python/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython C) +project(TestPython LANGUAGES C) include(CTest) find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Development) if (NOT Python_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}") + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}") endif() if (NOT Python_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'") + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPONENT 'Development.Module'") endif() if (NOT Python_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'") + message (FATAL_ERROR "Failed to find Python ${Python_REQUESTED_VERSION}, COMPOENENT 'Development.Embed'") endif() if(NOT TARGET Python::Interpreter) diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt index 609d80f..39577b2 100644 --- a/Tests/FindPython/Python2/CMakeLists.txt +++ b/Tests/FindPython/Python2/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython2 C) +project(TestPython2 LANGUAGES C) include(CTest) @@ -11,16 +11,16 @@ endif() find_package(Python2 REQUIRED COMPONENTS Interpreter Development) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python 2") + message (FATAL_ERROR "Failed to find Python 2") endif() if (NOT Python2_Development_FOUND) - message (FATAL_ERROR "Fail to found Python 2 'Development' component") + message (FATAL_ERROR "Failed to find Python 2 'Development' component") endif() if (NOT Python2_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python 2 'Development.Module' component") + message (FATAL_ERROR "Failed to find Python 2 'Development.Module' component") endif() if (NOT Python2_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python 2 'Development.Embed' component") + message (FATAL_ERROR "Failed to find Python 2 'Development.Embed' component") endif() if(NOT TARGET Python2::Interpreter) diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt index 1cf6034..a1036ce 100644 --- a/Tests/FindPython/Python2Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython2Embedded C) +project(TestPython2Embedded LANGUAGES C) include(CTest) find_package(Python2 REQUIRED COMPONENTS Development.Embed) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python 2") + message (FATAL_ERROR "Failed to find Python 2") endif() if (Python2_Development_FOUND) message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found") diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt index 0bc3390..c9d46ac 100644 --- a/Tests/FindPython/Python2Module/CMakeLists.txt +++ b/Tests/FindPython/Python2Module/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython2Module C) +project(TestPython2Module LANGUAGES C) include(CTest) find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python 2") + message (FATAL_ERROR "Failed to find Python 2") endif() if (Python2_Development_FOUND) message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found") diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index d6e5fdb..e40557d 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython3 C) +project(TestPython3 LANGUAGES C) include(CTest) @@ -11,16 +11,16 @@ endif() find_package(Python3 REQUIRED COMPONENTS Interpreter Development) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() if (NOT Python3_Development_FOUND) - message (FATAL_ERROR "Fail to found Python 3 'Development' component") + message (FATAL_ERROR "Failed to find Python 3 'Development' component") endif() if (NOT Python3_Development.Module_FOUND) - message (FATAL_ERROR "Fail to found Python 3 'Development.Module' component") + message (FATAL_ERROR "Failed to find Python 3 'Development.Module' component") endif() if (NOT Python3_Development.Embed_FOUND) - message (FATAL_ERROR "Fail to found Python 3 'Development.Embed' component") + message (FATAL_ERROR "Failed to find Python 3 'Development.Embed' component") endif() if(NOT TARGET Python3::Interpreter) diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt index 184c0b4..c45bd8c 100644 --- a/Tests/FindPython/Python3Embedded/CMakeLists.txt +++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython3Embedded C) +project(TestPython3Embedded LANGUAGES C) include(CTest) find_package(Python3 REQUIRED COMPONENTS Development.Embed) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() if (Python3_Development_FOUND) message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt index 676f4c8..5945962 100644 --- a/Tests/FindPython/Python3Module/CMakeLists.txt +++ b/Tests/FindPython/Python3Module/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(TestPython3Module C) +project(TestPython3Module LANGUAGES C) include(CTest) find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() if (Python3_Development_FOUND) message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index 39e8ea5..ae50f32 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -6,11 +6,11 @@ include(CTest) find_package(Python2 REQUIRED COMPONENTS Interpreter Development) if (NOT Python2_FOUND) - message (FATAL_ERROR "Fail to found Python 2") + message (FATAL_ERROR "Failed to find Python 2") endif() find_package(Python3 REQUIRED COMPONENTS Interpreter Development) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt index b859ac5..287cfdb 100644 --- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt @@ -29,13 +29,13 @@ endif() if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter) - message (FATAL_ERROR "Fail to use input variable Python3_EXECUTABLE") + message (FATAL_ERROR "Failed to use input variable Python3_EXECUTABLE") endif() if (CHECK_LIBRARY AND NOT Python3_LIBRARY_RELEASE STREQUAL required_library) - message (FATAL_ERROR "Fail to use input variable Python3_LIBRARY") + message (FATAL_ERROR "Failed to use input variable Python3_LIBRARY") endif() if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include) - message (FATAL_ERROR "Fail to use input variable Python3_INCLUDE_DIR") + message (FATAL_ERROR "Failed to use input variable Python3_INCLUDE_DIR") endif() diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt index 36daa9f..84f7362 100644 --- a/Tests/FindPython/SOABI/CMakeLists.txt +++ b/Tests/FindPython/SOABI/CMakeLists.txt @@ -1,10 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(TestSOABI C) +project(TestSOABI LANGUAGES C) find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT}) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() if(NOT DEFINED Python3_SOABI) diff --git a/Tests/FindPython/VersionRange/CMakeLists.txt b/Tests/FindPython/VersionRange/CMakeLists.txt new file mode 100644 index 0000000..e8873cb --- /dev/null +++ b/Tests/FindPython/VersionRange/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +project (TestVersionRange LANGUAGES C) + + +find_package (${Python} ${Python_REQUESTED_VERSION} EXACT COMPONENTS Interpreter) +if (NOT ${Python}_FOUND) + message (FATAL_ERROR "Failed to find ${Python} ${Python_REQUESTED_VERSION}") +endif() + +if (Python_REQUESTED_VERSION VERSION_LESS 3.0) + set (IN_VERSION_RANGE 2.0...<3.0) + set (OUT_VERSION_RANGE 2.0...<${${Python}_VERSION}) +else() + set (IN_VERSION_RANGE 3.0...<4.0) + set (OUT_VERSION_RANGE 3.0...<${${Python}_VERSION}) +endif() + +function (FIND_PYTHON EXPECTED_VERSION) + unset (_${Python}_EXECUTABLE CACHE) + unset (_${Python}_LIBRARY_RELEASE CACHE) + unset (_${Python}_INCLUDE_DIR CACHE) + unset (${Python}_FOUND) + + find_package (${ARGN}) + + if (EXPECTED_VERSION STREQUAL "NONE") + if (${Python}_FOUND) + message (SEND_ERROR "Unexpectedly found version: ${${Python}_VERSION} for ${ARGN}") + endif() + return() + endif() + + if (NOT ${Python}_FOUND) + message (SEND_ERROR "Not found: ${ARGN}") + elseif (NOT ${Python}_VERSION VERSION_EQUAL EXPECTED_VERSION) + message (SEND_ERROR "Wrong version: ${${Python}_VERSION} for ${ARGN}") + endif() +endfunction() + +find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Interpreter) +if (${Python}_FIND_IMPLEMENTATIONS STREQUAL "IronPython") + find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Compiler) +else() + find_python (${${Python}_VERSION} ${Python} ${IN_VERSION_RANGE} COMPONENTS Development) +endif() + +find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Interpreter) +if (${Python}_FIND_IMPLEMENTATIONS STREQUAL "IronPython") + find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Compiler) +else() + find_python ("NONE" ${Python} ${OUT_VERSION_RANGE} COMPONENTS Development) +endif() + +find_python ("NONE" ${Python} 5...6 COMPONENTS Interpreter) diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt index 045a3f2..dae3282 100644 --- a/Tests/FindPython/VirtualEnv/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt @@ -6,7 +6,7 @@ include(CTest) find_package(Python3 REQUIRED COMPONENTS Interpreter) if (NOT Python3_FOUND) - message (FATAL_ERROR "Fail to found Python 3") + message (FATAL_ERROR "Failed to find Python 3") endif() set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/py3venv") diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt index 565095a..23d208d 100644 --- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt +++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt @@ -6,7 +6,7 @@ include(CTest) find_program(CONDA_EXECUTABLE conda) if (CONDA_EXECUTABLE EQUAL NOTFOUND) - message (FATAL_ERROR "Fail to found Conda") + message (FATAL_ERROR "Failed to find Conda") endif() set (Python3_VIRTUAL_ENV "${CMAKE_CURRENT_BINARY_DIR}/condaenv") |
