diff options
Diffstat (limited to 'Tests/FindPython')
-rw-r--r-- | Tests/FindPython/ArtifactsInteractive/CMakeLists.txt | 24 | ||||
-rw-r--r-- | Tests/FindPython/CMakeLists.txt | 29 | ||||
-rw-r--r-- | Tests/FindPython/Python3/CMakeLists.txt | 6 |
3 files changed, 56 insertions, 3 deletions
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt new file mode 100644 index 0000000..524be92 --- /dev/null +++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestArtifactsInteractive LANGUAGES C) + +set (components Interpreter Development) +if (CMake_TEST_FindPython_NumPy) + list (APPEND components NumPy) +endif() + +find_package(Python3 REQUIRED COMPONENTS ${components}) + +if (Python3_ARTIFACTS_INTERACTIVE) + if (NOT DEFINED CACHE{Python3_EXECUTABLE} + OR NOT DEFINED CACHE{Python3_LIBRARY} OR NOT DEFINED CACHE{Python3_INCLUDE_DIR} + OR (CMake_TEST_FindPython_NumPy AND NOT DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=ON Failed.") + endif() +else() + if (DEFINED CACHE{Python3_EXECUTABLE} + OR DEFINED CACHE{Python3_LIBRARY} OR DEFINED CACHE{Python3_INCLUDE_DIR} + OR (CMake_TEST_FindPython_NumPy AND DEFINED CACHE{Python3_NumPy_INCLUDE_DIR})) + message (FATAL_ERROR "Python3_ARTIFACTS_INTERACTIVE=OFF Failed.") + endif() +endif() diff --git a/Tests/FindPython/CMakeLists.txt b/Tests/FindPython/CMakeLists.txt index bfec986..bd6e8ab 100644 --- a/Tests/FindPython/CMakeLists.txt +++ b/Tests/FindPython/CMakeLists.txt @@ -134,6 +134,35 @@ if(CMake_TEST_FindPython) --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> ) + add_test(NAME FindPython.ArtifactsInteractive.ON COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ArtifactsInteractive" + "${CMake_BINARY_DIR}/Tests/FindPython/ArtifactsInteractive.ON" + ${build_generator_args} + --build-project TestArtifactsScope + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DPython3_ARTIFACTS_INTERACTIVE=ON" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.ArtifactsInteractive.OFF COMMAND + ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> + --build-and-test + "${CMake_SOURCE_DIR}/Tests/FindPython/ArtifactsInteractive" + "${CMake_BINARY_DIR}/Tests/FindPython/ArtifactsInteractive.OFF" + ${build_generator_args} + --build-project TestArtifactsScope + --build-options ${build_options} "-Dbuild_generator_args=${build_generator_args}" + "-DCMake_SOURCE_DIR=${CMake_SOURCE_DIR}" + "-DCMake_BINARY_DIR=${CMake_BINARY_DIR}" + "-DCMake_TEST_FindPython_NumPy=${CMake_TEST_FindPython_NumPy}" + "-DPython3_ARTIFACTS_INTERACTIVE=OFF" + --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION> + ) + add_test(NAME FindPython.CustomFailureMessage COMMAND ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION> --build-and-test diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt index 6691a48..34ebd2c 100644 --- a/Tests/FindPython/Python3/CMakeLists.txt +++ b/Tests/FindPython/Python3/CMakeLists.txt @@ -15,14 +15,14 @@ if (NOT Python3_FOUND) endif() if(NOT TARGET Python3::Interpreter) - message(SEND_ERROR "Python2::Interpreter not found") + message(SEND_ERROR "Python3::Interpreter not found") endif() if(NOT TARGET Python3::Python) - message(SEND_ERROR "Python2::Python not found") + message(SEND_ERROR "Python3::Python not found") endif() if(NOT TARGET Python3::Module) - message(SEND_ERROR "Python2::Module not found") + message(SEND_ERROR "Python3::Module not found") endif() Python3_add_library (spam3 MODULE ../spam.c) |