diff options
Diffstat (limited to 'Tests')
31 files changed, 309 insertions, 83 deletions
diff --git a/Tests/Assembler/CMakeLists.txt b/Tests/Assembler/CMakeLists.txt index a3c9946..a574c4e 100644 --- a/Tests/Assembler/CMakeLists.txt +++ b/Tests/Assembler/CMakeLists.txt @@ -8,7 +8,7 @@ set(SRCS) # (at least) the following toolchains can process assembler files directly # and also generate assembler files from C: if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND - NOT CMAKE_OSX_ARCHITECTURES) + NOT CMAKE_OSX_ARCHITECTURES MATCHES ";") if((CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang|HP|SunPro|XL)$") OR (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND UNIX) AND NOT (CMAKE_C_COMPILER_ID STREQUAL "Clang" AND "x${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "xMSVC")) set(C_FLAGS "${CMAKE_C_FLAGS}") @@ -16,6 +16,11 @@ if("${CMAKE_GENERATOR}" MATCHES "Makefile|Xcode|Ninja" AND if(CMAKE_OSX_SYSROOT AND CMAKE_C_SYSROOT_FLAG AND NOT ";${C_FLAGS};" MATCHES ";${CMAKE_C_SYSROOT_FLAG};") list(APPEND C_FLAGS ${CMAKE_C_SYSROOT_FLAG} ${CMAKE_OSX_SYSROOT}) endif() + if(CMAKE_OSX_ARCHITECTURES) + list(APPEND C_FLAGS -arch ${CMAKE_OSX_ARCHITECTURES}) + elseif("${CMAKE_SYSTEM_NAME};${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "Darwin;arm64") + list(APPEND C_FLAGS -arch arm64) + endif() # Clang on OS X, and perhaps other compilers, do not support -g # for both generating and assembling, so drop it from generating. list(REMOVE_ITEM C_FLAGS -g) diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt index 524be92..8ada221 100644 --- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestArtifactsInteractive LANGUAGES C) +project(TestArtifactsInteractive LANGUAGES NONE) set (components Interpreter Development) if (CMake_TEST_FindPython_NumPy) 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..4aa748b 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 NONE) 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/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt index b4ade8c..6539b63 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 NONE) 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..4efea23 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 NONE) 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..7454a68 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 NONE) 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..6e854e3 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -1,16 +1,16 @@ cmake_minimum_required(VERSION 3.1) -project(TestRequiredArtifacts LANGUAGES C) +project(TestRequiredArtifacts LANGUAGES NONE) 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..036407f 100644 --- a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(TestRequiredArtifacts.Check LANGUAGES C) +project(TestRequiredArtifacts.Check LANGUAGES NONE) set (components) if (CHECK_INTERPRETER) @@ -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..0d946f5 --- /dev/null +++ b/Tests/FindPython/VersionRange/CMakeLists.txt @@ -0,0 +1,55 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +project (TestVersionRange LANGUAGES NONE) + + +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") diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in index bf98e91..3632e03 100644 --- a/Tests/MFC/CMakeLists.txt.in +++ b/Tests/MFC/CMakeLists.txt.in @@ -65,3 +65,6 @@ if("${CMAKE_MFC_FLAG}" STREQUAL "2") set(CMAKE_INSTALL_MFC_LIBRARIES ON) include(InstallRequiredSystemLibraries) endif() + +# Encode the value inside a generator expression to test evaluation. +set(CMAKE_MFC_FLAG "$<1:${CMAKE_MFC_FLAG}>") diff --git a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake index 5f5f7f5..6becc3c 100644 --- a/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindSWIG/RunCMakeTest.cmake @@ -2,3 +2,4 @@ include(RunCMake) run_cmake(components) run_cmake(missing-components) +run_cmake(version-range) diff --git a/Tests/RunCMake/FindSWIG/version-range.cmake b/Tests/RunCMake/FindSWIG/version-range.cmake new file mode 100644 index 0000000..7ba1134 --- /dev/null +++ b/Tests/RunCMake/FindSWIG/version-range.cmake @@ -0,0 +1,30 @@ +cmake_minimum_required (VERSION 3.18...3.19) + +find_package (SWIG) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range including current SWIG version +string (REGEX MATCH "^([0-9]+)" upper_version "${SWIG_VERSION}") +math (EXPR upper_version "${upper_version} + 1") + +find_package (SWIG 1.0...${upper_version}.0) +if (NOT SWIG_FOUND) + message (FATAL_ERROR "Failed to find SWIG with version range 1.0...${upper_version}.0") +endif() + +# clean-up SWIG variables +unset (SWIG_EXECUTABLE CACHE) +unset (SWIG_DIR CACHE) + +## Specify a range excluding current SWIG version +set (range 1.0...<${SWIG_VERSION}) +find_package (SWIG ${range}) +if (SWIG_FOUND) + message (FATAL_ERROR "Unexpectedly find SWIG with version range ${range}") +endif() diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index c13c694..7d96e50 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -153,6 +153,7 @@ function(run_cmake test) "|contact PGI Sales at" "|[^\n]*xcodebuild[^\n]*warning: file type[^\n]*is based on missing file type" + "|[^\n]*objc[^\n]*: Class AMSupportURL[^\n]* One of the two will be used. Which one is undefined." "|[^\n]*is a member of multiple groups" "|[^\n]*offset in archive not a multiple of 8" "|[^\n]*from Time Machine by path" diff --git a/Tests/RunCMake/VS10Project/NoImpLib-check.cmake b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake new file mode 100644 index 0000000..50722b2 --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib-check.cmake @@ -0,0 +1,23 @@ +set(vcProjectFile "${RunCMake_TEST_BINARY_DIR}/foo.vcxproj") +if(NOT EXISTS "${vcProjectFile}") + set(RunCMake_TEST_FAILED "Project file ${vcProjectFile} does not exist.") + return() +endif() + +set(found_ImportLibrary 0) +set(found_TargetExt_dll 0) +file(STRINGS "${vcProjectFile}" lines) +foreach(line IN LISTS lines) + if(line MATCHES "<ImportLibrary>") + set(found_ImportLibrary 1) + endif() + if(line MATCHES "<TargetExt[^\n]*\\.dll") + set(found_TargetExt_dll 1) + endif() +endforeach() +if(found_ImportLibrary) + string(APPEND RunCMake_TEST_FAILED "ImportLibrary incorrectly found in\n ${vcProjectFile}\n") +endif() +if(NOT found_TargetExt_dll) + string(APPEND RunCMake_TEST_FAILED "TargetExt not found in\n ${vcProjectFile}\n") +endif() diff --git a/Tests/RunCMake/VS10Project/NoImpLib.cmake b/Tests/RunCMake/VS10Project/NoImpLib.cmake new file mode 100644 index 0000000..2c11eac --- /dev/null +++ b/Tests/RunCMake/VS10Project/NoImpLib.cmake @@ -0,0 +1,3 @@ +enable_language(C) +set(CMAKE_IMPORT_LIBRARY_SUFFIX "") +add_library(foo SHARED empty.c) diff --git a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake index 8e56e1b..133dacc 100644 --- a/Tests/RunCMake/VS10Project/RunCMakeTest.cmake +++ b/Tests/RunCMake/VS10Project/RunCMakeTest.cmake @@ -11,6 +11,7 @@ run_cmake(VsCsharpSourceGroup) run_cmake(VsCSharpCompilerOpts) run_cmake(ExplicitCMakeLists) run_cmake(InterfaceLibSources) +run_cmake(NoImpLib) run_cmake(RuntimeLibrary) run_cmake(SourceGroupCMakeLists) run_cmake(SourceGroupTreeCMakeLists) |