summaryrefslogtreecommitdiffstats
path: root/Tests/FindPython
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/FindPython')
-rw-r--r--Tests/FindPython/ArtifactsInteractive/CMakeLists.txt24
-rw-r--r--Tests/FindPython/CMakeLists.txt180
-rw-r--r--Tests/FindPython/Implementation/CMakeLists.txt37
-rw-r--r--Tests/FindPython/IronPython/CMakeLists.txt11
-rw-r--r--Tests/FindPython/IronPython2/CMakeLists.txt11
-rw-r--r--Tests/FindPython/PyPy/CMakeLists.txt37
-rw-r--r--Tests/FindPython/PyPy2/CMakeLists.txt37
-rw-r--r--Tests/FindPython/PyPy3/CMakeLists.txt37
-rw-r--r--Tests/FindPython/Python/CMakeLists.txt6
-rw-r--r--Tests/FindPython/Python2/CMakeLists.txt9
-rw-r--r--Tests/FindPython/Python2Embedded/CMakeLists.txt15
-rw-r--r--Tests/FindPython/Python2Module/CMakeLists.txt37
-rw-r--r--Tests/FindPython/Python3/CMakeLists.txt15
-rw-r--r--Tests/FindPython/Python3Embedded/CMakeLists.txt15
-rw-r--r--Tests/FindPython/Python3Module/CMakeLists.txt37
15 files changed, 500 insertions, 8 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 9b89832..fdfa36e 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -20,6 +20,17 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ add_test(NAME FindPython.Python2.Development.Module COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Module"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2Module"
+ ${build_generator_args}
+ --build-project TestPython2Module
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
add_test(NAME FindPython.Python2Fail COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -54,6 +65,17 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ add_test(NAME FindPython.Python3.Development.Module COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python3Module"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python3Module"
+ ${build_generator_args}
+ --build-project TestPython3Module
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
add_test(NAME FindPython.Python3Fail COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -277,6 +299,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
@@ -340,7 +391,6 @@ if(CMake_TEST_FindPython_NumPy)
${build_generator_args}
--build-project TestNumPyOnly
--build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
@@ -357,6 +407,29 @@ if(CMake_TEST_FindPython_Conda)
)
endif()
+if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython)
+ add_test(NAME FindPython.Implementation.CPython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.CPython"
+ ${build_generator_args}
+ --build-project TestImplementationCPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATIONS=CPython
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Implementation.IronPython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Implementation"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Implementation.IronPython"
+ ${build_generator_args}
+ --build-project TestImplementationIronPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_REQUESTED_IMPLEMENTATION=IronPython
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
+
if(CMake_TEST_FindPython_IronPython)
add_test(NAME FindPython.IronPython2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
@@ -420,3 +493,108 @@ if(CMake_TEST_FindPython_IronPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
+
+if(CMake_TEST_FindPython_PyPy)
+ add_test(NAME FindPython.PyPy2.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy2
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy2"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy2.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy2
+ --build-options ${build_options} -DPython2_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.PyPy3.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy3.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.PyPy.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.PyPy.V3.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION"
+ ${build_generator_args}
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
diff --git a/Tests/FindPython/Implementation/CMakeLists.txt b/Tests/FindPython/Implementation/CMakeLists.txt
new file mode 100644
index 0000000..d64fa1e
--- /dev/null
+++ b/Tests/FindPython/Implementation/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestImplementation${Python_REQUESTED_IMPLEMENTATION} C)
+
+
+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}")
+endif()
+
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
+ AND NOT Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
+endif()
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
+ AND Python${Python_REQUESTED_VERSION}_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python${Python_REQUESTED_VERSION}_INTERPRETER_ID})")
+endif()
+
+
+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}")
+endif()
+
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "IronPython"
+ AND NOT Python_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
+if (Python_REQUESTED_IMPLEMENTATION STREQUAL "CPython"
+ AND Python_INTERPRETER_ID STREQUAL "IronPython")
+ message (FATAL_ERROR "Erroneous interpreter ID (${Python_INTERPRETER_ID})")
+endif()
diff --git a/Tests/FindPython/IronPython/CMakeLists.txt b/Tests/FindPython/IronPython/CMakeLists.txt
index c96a3e0..3493c29 100644
--- a/Tests/FindPython/IronPython/CMakeLists.txt
+++ b/Tests/FindPython/IronPython/CMakeLists.txt
@@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1)
project(TestIronPython C)
-find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter Compiler)
+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}")
endif()
+if (NOT Python_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
endif()
diff --git a/Tests/FindPython/IronPython2/CMakeLists.txt b/Tests/FindPython/IronPython2/CMakeLists.txt
index 43ec309..1db798c 100644
--- a/Tests/FindPython/IronPython2/CMakeLists.txt
+++ b/Tests/FindPython/IronPython2/CMakeLists.txt
@@ -2,11 +2,20 @@ cmake_minimum_required(VERSION 3.1)
project(TestIronPython2 C)
-find_package(Python2 REQUIRED COMPONENTS Interpreter Compiler)
+set (Python2_FIND_IMPLEMENTATIONS "IronPython")
+
+find_package(Python2 COMPONENTS Interpreter Compiler)
if (NOT Python2_FOUND)
message (FATAL_ERROR "Fail to found Python 2")
endif()
+if (NOT Python2_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
endif()
diff --git a/Tests/FindPython/PyPy/CMakeLists.txt b/Tests/FindPython/PyPy/CMakeLists.txt
new file mode 100644
index 0000000..b4ade8c
--- /dev/null
+++ b/Tests/FindPython/PyPy/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy 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}")
+endif()
+
+if (NOT Python_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
+endif()
+if (NOT Python_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
+endif()
+
+if(NOT TARGET Python::Interpreter)
+ message(SEND_ERROR "Python::Interpreter not found")
+endif()
+if(NOT TARGET Python::Module)
+ message(SEND_ERROR "Python::Module not found")
+endif()
+if(NOT TARGET Python::Python)
+ message(SEND_ERROR "Python::Python not found")
+endif()
diff --git a/Tests/FindPython/PyPy2/CMakeLists.txt b/Tests/FindPython/PyPy2/CMakeLists.txt
new file mode 100644
index 0000000..2f0ddc9
--- /dev/null
+++ b/Tests/FindPython/PyPy2/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy2 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")
+endif()
+
+if (NOT Python2_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
+endif()
+if (NOT Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Development.Embed")
+endif()
+if (NOT Python2_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 2 Development")
+endif()
+
+if(NOT TARGET Python2::Interpreter)
+ message(SEND_ERROR "Python2::Interpreter not found")
+endif()
+if(NOT TARGET Python2::Module)
+ message(SEND_ERROR "Python2::Module not found")
+endif()
+if(NOT TARGET Python2::Python)
+ message(SEND_ERROR "Python2::Python not found")
+endif()
diff --git a/Tests/FindPython/PyPy3/CMakeLists.txt b/Tests/FindPython/PyPy3/CMakeLists.txt
new file mode 100644
index 0000000..5562d57
--- /dev/null
+++ b/Tests/FindPython/PyPy3/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPyPy3 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")
+endif()
+
+if (NOT Python3_Interpreter_FOUND)
+ message (FATAL_ERROR "Fail to found 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")
+endif()
+if (NOT Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Development.Embed")
+endif()
+if (NOT Python3_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python PyPy 3 Development")
+endif()
+
+if(NOT TARGET Python3::Interpreter)
+ message(SEND_ERROR "Python3::Interpreter not found")
+endif()
+if(NOT TARGET Python3::Module)
+ message(SEND_ERROR "Python3::Module not found")
+endif()
+if(NOT TARGET Python3::Python)
+ message(SEND_ERROR "Python3::Python not found")
+endif()
diff --git a/Tests/FindPython/Python/CMakeLists.txt b/Tests/FindPython/Python/CMakeLists.txt
index 3ee38e3..e8828a2 100644
--- a/Tests/FindPython/Python/CMakeLists.txt
+++ b/Tests/FindPython/Python/CMakeLists.txt
@@ -8,6 +8,12 @@ find_package(Python ${Python_REQUESTED_VERSION} REQUIRED COMPONENTS Interpreter
if (NOT Python_FOUND)
message (FATAL_ERROR "Fail to found Python ${Python_REQUESTED_VERSION}")
endif()
+if (NOT Python_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found 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'")
+endif()
if(NOT TARGET Python::Interpreter)
message(SEND_ERROR "Python::Interpreter not found")
diff --git a/Tests/FindPython/Python2/CMakeLists.txt b/Tests/FindPython/Python2/CMakeLists.txt
index cf77ca2..609d80f 100644
--- a/Tests/FindPython/Python2/CMakeLists.txt
+++ b/Tests/FindPython/Python2/CMakeLists.txt
@@ -13,6 +13,15 @@ find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python2_FOUND)
message (FATAL_ERROR "Fail to found Python 2")
endif()
+if (NOT Python2_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python 2 'Development' component")
+endif()
+if (NOT Python2_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found Python 2 'Development.Module' component")
+endif()
+if (NOT Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python 2 'Development.Embed' component")
+endif()
if(NOT TARGET Python2::Interpreter)
message(SEND_ERROR "Python2::Interpreter not found")
diff --git a/Tests/FindPython/Python2Embedded/CMakeLists.txt b/Tests/FindPython/Python2Embedded/CMakeLists.txt
index 0115dea..1cf6034 100644
--- a/Tests/FindPython/Python2Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python2Embedded/CMakeLists.txt
@@ -4,10 +4,23 @@ project(TestPython2Embedded C)
include(CTest)
-find_package(Python2 REQUIRED COMPONENTS Development)
+find_package(Python2 REQUIRED COMPONENTS Development.Embed)
if (NOT Python2_FOUND)
message (FATAL_ERROR "Fail to found Python 2")
endif()
+if (Python2_Development_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
+endif()
+if (Python2_Development.Module_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development.Module' unexpectedly found")
+endif()
+if (NOT Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development.Embed' not found")
+endif()
+
+if(TARGET Python2::Module)
+ message(SEND_ERROR "Python2::Module unexpectedly found")
+endif()
if(NOT TARGET Python2::Python)
message(SEND_ERROR "Python2::Python not found")
diff --git a/Tests/FindPython/Python2Module/CMakeLists.txt b/Tests/FindPython/Python2Module/CMakeLists.txt
new file mode 100644
index 0000000..0bc3390
--- /dev/null
+++ b/Tests/FindPython/Python2Module/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPython2Module C)
+
+include(CTest)
+
+find_package(Python2 REQUIRED COMPONENTS Interpreter Development.Module)
+if (NOT Python2_FOUND)
+ message (FATAL_ERROR "Fail to found Python 2")
+endif()
+if (Python2_Development_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development' unexpectedly found")
+endif()
+if (Python2_Development.Embed_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development.Embed' unexpectedly found")
+endif()
+if (NOT Python2_Development.Module_FOUND)
+ message (FATAL_ERROR "Python 2, COMPONENT 'Development.Module' not found")
+endif()
+
+if(NOT TARGET Python2::Interpreter)
+ message(SEND_ERROR "Python2::Interpreter not found")
+endif()
+
+if(TARGET Python2::Python)
+ message(SEND_ERROR "Python2::Python unexpectedly found")
+endif()
+if(NOT TARGET Python2::Module)
+ message(SEND_ERROR "Python2::Module not found")
+endif()
+
+Python2_add_library (spam2 MODULE ../spam.c)
+target_compile_definitions (spam2 PRIVATE PYTHON2)
+
+add_test (NAME python2_spam2
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam2>"
+ "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
diff --git a/Tests/FindPython/Python3/CMakeLists.txt b/Tests/FindPython/Python3/CMakeLists.txt
index 6691a48..d6e5fdb 100644
--- a/Tests/FindPython/Python3/CMakeLists.txt
+++ b/Tests/FindPython/Python3/CMakeLists.txt
@@ -13,16 +13,25 @@ find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Fail to found Python 3")
endif()
+if (NOT Python3_Development_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3 'Development' component")
+endif()
+if (NOT Python3_Development.Module_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3 'Development.Module' component")
+endif()
+if (NOT Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3 'Development.Embed' component")
+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)
diff --git a/Tests/FindPython/Python3Embedded/CMakeLists.txt b/Tests/FindPython/Python3Embedded/CMakeLists.txt
index 4eb7ebc..184c0b4 100644
--- a/Tests/FindPython/Python3Embedded/CMakeLists.txt
+++ b/Tests/FindPython/Python3Embedded/CMakeLists.txt
@@ -4,10 +4,23 @@ project(TestPython3Embedded C)
include(CTest)
-find_package(Python3 REQUIRED COMPONENTS Development)
+find_package(Python3 REQUIRED COMPONENTS Development.Embed)
if (NOT Python3_FOUND)
message (FATAL_ERROR "Fail to found Python 3")
endif()
+if (Python3_Development_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
+endif()
+if (Python3_Development.Module_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found")
+endif()
+if (NOT Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' not found")
+endif()
+
+if(TARGET Python3::Module)
+ message(SEND_ERROR "Python3::Module unexpectedly found")
+endif()
if(NOT TARGET Python3::Python)
message(SEND_ERROR "Python3::Python not found")
diff --git a/Tests/FindPython/Python3Module/CMakeLists.txt b/Tests/FindPython/Python3Module/CMakeLists.txt
new file mode 100644
index 0000000..676f4c8
--- /dev/null
+++ b/Tests/FindPython/Python3Module/CMakeLists.txt
@@ -0,0 +1,37 @@
+cmake_minimum_required(VERSION 3.1)
+
+project(TestPython3Module C)
+
+include(CTest)
+
+find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)
+if (NOT Python3_FOUND)
+ message (FATAL_ERROR "Fail to found Python 3")
+endif()
+if (Python3_Development_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found")
+endif()
+if (Python3_Development.Embed_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found")
+endif()
+if (NOT Python3_Development.Module_FOUND)
+ message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' not found")
+endif()
+
+if(NOT TARGET Python3::Interpreter)
+ message(SEND_ERROR "Python3::Interpreter not found")
+endif()
+
+if(TARGET Python3::Python)
+ message(SEND_ERROR "Python3::Python unexpectedly found")
+endif()
+if(NOT TARGET Python3::Module)
+ message(SEND_ERROR "Python3::Module not found")
+endif()
+
+Python3_add_library (spam3 MODULE ../spam.c)
+target_compile_definitions (spam3 PRIVATE PYTHON3)
+
+add_test (NAME python3_spam3
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
+ "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")