summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitlab/ci/configure_debian10_aarch64_ninja.cmake9
-rw-r--r--.gitlab/ci/configure_debian10_ninja.cmake11
-rw-r--r--.gitlab/ci/configure_fedora38_makefiles.cmake9
-rw-r--r--.gitlab/ci/docker/debian10/deps_packages.lst2
-rw-r--r--Tests/CMakeLists.txt36
-rw-r--r--Tests/FindPython/ArtifactsInteractive/CMakeLists.txt6
-rw-r--r--Tests/FindPython/CMakeLists.txt419
-rw-r--r--Tests/FindPython/CustomFailureMessage/CMakeLists.txt2
-rw-r--r--Tests/FindPython/MultiplePackages/CMakeLists.txt52
-rw-r--r--Tests/FindPython/NumPy/CMakeLists.txt37
-rw-r--r--Tests/FindPython/NumPyOnly/CMakeLists.txt20
-rw-r--r--Tests/FindPython/RequiredArtifacts/CMakeLists.txt27
-rw-r--r--Tests/FindPython/SOABI/CMakeLists.txt51
-rw-r--r--Tests/FindPython/VirtualEnv/CMakeLists.txt26
-rw-r--r--Tests/FindPython/VirtualEnvConda/CMakeLists.txt26
-rw-r--r--Tests/RunCMake/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/UseSWIG/RunCMakeTest.cmake2
-rw-r--r--Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt6
-rw-r--r--Tests/UseSWIG/CMakeLists.txt44
-rw-r--r--Tests/UseSWIG/ModuleName/CMakeLists.txt15
-rw-r--r--Tests/UseSWIG/ModuleVersion2/CMakeLists.txt98
-rw-r--r--Tests/UseSWIG/MultipleFiles/CMakeLists.txt4
-rw-r--r--Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt6
23 files changed, 521 insertions, 390 deletions
diff --git a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
index dff0db1..91d4632 100644
--- a/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_aarch64_ninja.cmake
@@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "")
set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
set(CMake_TEST_FindSQLite3 "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_debian10_ninja.cmake b/.gitlab/ci/configure_debian10_ninja.cmake
index 211a2a7..eca92bc 100644
--- a/.gitlab/ci/configure_debian10_ninja.cmake
+++ b/.gitlab/ci/configure_debian10_ninja.cmake
@@ -78,10 +78,13 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "")
set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_IronPython "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_IronPython "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/configure_fedora38_makefiles.cmake b/.gitlab/ci/configure_fedora38_makefiles.cmake
index c2f9982..a3881cf 100644
--- a/.gitlab/ci/configure_fedora38_makefiles.cmake
+++ b/.gitlab/ci/configure_fedora38_makefiles.cmake
@@ -74,9 +74,12 @@ set(CMake_TEST_FindPNG "ON" CACHE BOOL "")
set(CMake_TEST_FindPostgreSQL "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf "ON" CACHE BOOL "")
set(CMake_TEST_FindProtobuf_gRPC "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_NumPy "ON" CACHE BOOL "")
-set(CMake_TEST_FindPython_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3 "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3_NumPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython2_PyPy "ON" CACHE BOOL "")
+set(CMake_TEST_FindPython3_PyPy "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby "ON" CACHE BOOL "")
set(CMake_TEST_FindRuby_RVM "ON" CACHE BOOL "")
set(CMake_TEST_FindSDL "ON" CACHE BOOL "")
diff --git a/.gitlab/ci/docker/debian10/deps_packages.lst b/.gitlab/ci/docker/debian10/deps_packages.lst
index 0b79675..fc5c174 100644
--- a/.gitlab/ci/docker/debian10/deps_packages.lst
+++ b/.gitlab/ci/docker/debian10/deps_packages.lst
@@ -96,5 +96,5 @@ ruby ruby-dev
swig
unixodbc-dev
-# CMake_TEST_FindPython_IronPython
+# CMake_TEST_FindPython2_IronPython
libmono-system-windows-forms4.0-cil
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index c08dd86..8e6017e 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1538,10 +1538,38 @@ if(BUILD_TESTING)
add_subdirectory(GoogleTest)
endif()
- if(CMake_TEST_FindPython OR CMake_TEST_FindPython_SABIModule OR CMake_TEST_FindPython_NumPy
- OR CMake_TEST_FindPython_Conda OR CMake_TEST_FindPython_IronPython OR CMake_TEST_FindPython_PyPy)
- if (CMake_TEST_FindPython AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
- set(CMake_TEST_FindPython_SABIModule TRUE)
+ if(CMake_TEST_FindPython)
+ set(CMake_TEST_FindPython2 TRUE)
+ set(CMake_TEST_FindPython3 TRUE)
+ endif()
+ if(CMake_TEST_FindPython_SABIMOdule)
+ set(CMake_TEST_FindPython2_SABIModule TRUE)
+ set(CMake_TEST_FindPython3_SABIModule TRUE)
+ endif()
+ if(CMake_TEST_FindPython_NumPy)
+ set(CMake_TEST_FindPython2_NumPyy TRUE)
+ set(CMake_TEST_FindPython3_NumPy TRUE)
+ endif()
+ if(CMake_TEST_FindPython_Conda)
+ set(CMake_TEST_FindPython3_Conda TRUE)
+ endif()
+ if(CMake_TEST_FindPython_IronPython)
+ set(CMake_TEST_FindPython2_IronPython TRUE)
+ endif()
+ if(CMake_TEST_FindPython_PyPy)
+ set(CMake_TEST_FindPython2_PyPy TRUE)
+ set(CMake_TEST_FindPython3_PyPy TRUE)
+ endif()
+ if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython2
+ OR CMake_TEST_FindPython2_SABIModule OR CMake_TEST_FindPython3_SABIModule
+ OR CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy
+ OR CMake_TEST_FindPython3_Conda OR CMake_TEST_FindPython2_IronPython
+ OR CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy)
+ if (CMake_TEST_FindPython2 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+ set(CMake_TEST_FindPython2_SABIModule TRUE)
+ endif()
+ if (CMake_TEST_FindPython3 AND CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
+ set(CMake_TEST_FindPython3_SABIModule TRUE)
endif()
add_subdirectory(FindPython)
endif()
diff --git a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
index 99823a6..18f8fda 100644
--- a/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
+++ b/Tests/FindPython/ArtifactsInteractive/CMakeLists.txt
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.5)
project(TestArtifactsInteractive LANGUAGES C)
set (components Interpreter Development)
-if (CMake_TEST_FindPython_NumPy)
+if (CMake_TEST_FindPython3_NumPy)
list (APPEND components NumPy)
endif()
@@ -12,13 +12,13 @@ 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}))
+ OR (CMake_TEST_FindPython3_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}))
+ OR (CMake_TEST_FindPython3_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 b6942c9..3e1993e 100644
--- a/Tests/FindPython/CMakeLists.txt
+++ b/Tests/FindPython/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CMake_TEST_FindPython)
+if(CMake_TEST_FindPython2)
add_test(NAME FindPython.Python2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -44,6 +44,129 @@ if(CMake_TEST_FindPython)
set_tests_properties(FindPython.Python2Fail PROPERTIES
PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: foobar\\)")
+ add_test(NAME FindPython.Python.V2.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION"
+ ${build_generator_args}
+ --build-project TestPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V2.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION"
+ ${build_generator_args}
+ --build-project TestPython
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=2
+ -DPython_REQUESTED_VERSION=2.1.2
+ -DPython2_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_MAJOR_VERSION=2
+ -DPython_REQUESTED_VERSION=2.1.2
+ -DPython2_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
+ -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION"
+ ${build_generator_args}
+ --build-project TestExactVersion
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
+ -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
+ 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.Python2Embedded COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded"
+ ${build_generator_args}
+ --build-project TestPython2Embedded
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+endif()
+
+if(CMake_TEST_FindPython3)
add_test(NAME FindPython.Python3.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -89,46 +212,6 @@ if(CMake_TEST_FindPython)
set_tests_properties(FindPython.Python3Fail PROPERTIES
PASS_REGULAR_EXPRESSION "Could NOT find Python3 \\(missing: foobar\\)")
- add_test(NAME FindPython.Python.LOCATION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION"
- ${build_generator_args}
- --build-project TestPython
- --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
- add_test(NAME FindPython.Python.VERSION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION"
- ${build_generator_args}
- --build-project TestPython
- --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
- add_test(NAME FindPython.Python.V2.LOCATION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.LOCATION"
- ${build_generator_args}
- --build-project TestPython
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
- add_test(NAME FindPython.Python.V2.VERSION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.VERSION"
- ${build_generator_args}
- --build-project TestPython
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
add_test(NAME FindPython.Python.V3.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -150,30 +233,6 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.Python2.ExactVersion.LOCATION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.LOCATION"
- ${build_generator_args}
- --build-project TestExactVersion
- --build-options ${build_options} -DPython_MAJOR_VERSION=2
- -DPython_REQUESTED_VERSION=2.1.2
- -DPython2_FIND_STRATEGY=LOCATION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
- add_test(NAME FindPython.Python2.ExactVersion.VERSION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2.ExactVersion.VERSION"
- ${build_generator_args}
- --build-project TestExactVersion
- --build-options ${build_options} -DPython_MAJOR_VERSION=2
- -DPython_REQUESTED_VERSION=2.1.2
- -DPython2_FIND_STRATEGY=VERSION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
add_test(NAME FindPython.Python3.ExactVersion.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -198,28 +257,6 @@ if(CMake_TEST_FindPython)
-DPython3_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.Python.V2.ExactVersion.LOCATION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.LOCATION"
- ${build_generator_args}
- --build-project TestExactVersion
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
- -DPython_FIND_STRATEGY=LOCATION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
- add_test(NAME FindPython.Python.V2.ExactVersion.VERSION COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/ExactVersion"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python.V2.ExactVersion.VERSION"
- ${build_generator_args}
- --build-project TestExactVersion
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2.1.2
- -DPython_FIND_STRATEGY=VERSION
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
add_test(NAME FindPython.Python.V3.ExactVersion.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -263,46 +300,6 @@ if(CMake_TEST_FindPython)
--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
@@ -324,17 +321,6 @@ if(CMake_TEST_FindPython)
-DPython_FIND_STRATEGY=VERSION
)
- add_test(NAME FindPython.MultiplePackages COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages"
- "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages"
- ${build_generator_args}
- --build-project TestMultiplePackages
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
-
add_test(NAME FindPython.VirtualEnv COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -346,16 +332,6 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.Python2Embedded COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/Python2Embedded"
- "${CMake_BINARY_DIR}/Tests/FindPython/Python2Embedded"
- ${build_generator_args}
- --build-project TestPython2Embedded
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
- )
add_test(NAME FindPython.Python3Embedded COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -377,7 +353,7 @@ if(CMake_TEST_FindPython)
--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_SABIModule=${CMake_TEST_FindPython_SABIModule}"
+ "-DCMake_TEST_FindPython3_SABIModule=${CMake_TEST_FindPython3_SABIModule}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -391,7 +367,7 @@ if(CMake_TEST_FindPython)
--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}"
+ "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}"
"-DPython3_ARTIFACTS_INTERACTIVE=ON"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -405,7 +381,7 @@ if(CMake_TEST_FindPython)
--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}"
+ "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}"
"-DPython3_ARTIFACTS_INTERACTIVE=OFF"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -420,7 +396,7 @@ if(CMake_TEST_FindPython)
--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}"
+ "-DCMake_TEST_FindPython3_NumPy=${CMake_TEST_FindPython3_NumPy}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -437,6 +413,41 @@ if(CMake_TEST_FindPython)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ add_test(NAME FindPython.UnversionedNames COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames"
+ "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames"
+ ${build_generator_args}
+ --build-project UnversionedNames
+ --build-options ${build_options}
+ )
+ endif()
+endif()
+
+if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3)
+ add_test(NAME FindPython.Python.LOCATION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.LOCATION"
+ ${build_generator_args}
+ --build-project TestPython
+ --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+ add_test(NAME FindPython.Python.VERSION COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/Python"
+ "${CMake_BINARY_DIR}/Tests/FindPython/Python.VERSION"
+ ${build_generator_args}
+ --build-project TestPython
+ --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+ )
+
if (CMAKE_SYSTEM_NAME MATCHES "Linux|Darwin")
add_test(NAME FindPython.Interpreter.SOABI COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
@@ -466,20 +477,20 @@ if(CMake_TEST_FindPython)
)
endif()
- if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- add_test(NAME FindPython.UnversionedNames COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/UnversionedNames"
- "${CMake_BINARY_DIR}/Tests/FindPython/UnversionedNames"
- ${build_generator_args}
- --build-project UnversionedNames
- --build-options ${build_options}
+ add_test(NAME FindPython.MultiplePackages COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/FindPython/MultiplePackages"
+ "${CMake_BINARY_DIR}/Tests/FindPython/MultiplePackages"
+ ${build_generator_args}
+ --build-project TestMultiplePackages
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- endif()
endif()
-if(CMake_TEST_FindPython_SABIModule)
+
+if(CMake_TEST_FindPython2_SABIModule)
add_test(NAME FindPython.Python2.Development.SABIModule COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -492,7 +503,9 @@ if(CMake_TEST_FindPython_SABIModule)
)
set_tests_properties(FindPython.Python2.Development.SABIModule PROPERTIES
PASS_REGULAR_EXPRESSION "Could NOT find Python2 \\(missing: .*Development\\.SABIModule")
+endif()
+if(CMake_TEST_FindPython3_SABIModule)
# Use exclusively Release configuration because Debug is, on Windows with MSVC,
# unusable with SABI: Python force link with debug version of full versioned library rather than
# the stable ABI one.
@@ -508,7 +521,7 @@ if(CMake_TEST_FindPython_SABIModule)
)
endif()
-if(CMake_TEST_FindPython_NumPy)
+if(CMake_TEST_FindPython2_NumPy OR CMake_TEST_FindPython3_NumPy)
add_test(NAME FindPython.NumPy COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -530,7 +543,7 @@ if(CMake_TEST_FindPython_NumPy)
)
endif()
-if(CMake_TEST_FindPython_Conda)
+if(CMake_TEST_FindPython3_Conda)
add_test(NAME FindPython.VirtualEnvConda COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -543,7 +556,7 @@ if(CMake_TEST_FindPython_Conda)
)
endif()
-if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython)
+if (CMake_TEST_FindPython2 AND CMake_TEST_FindPython2_IronPython)
add_test(NAME FindPython.Implementation.CPython COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -566,7 +579,7 @@ if (CMake_TEST_FindPython AND CMake_TEST_FindPython_IronPython)
)
endif()
-if(CMake_TEST_FindPython_IronPython)
+if(CMake_TEST_FindPython2_IronPython)
add_test(NAME FindPython.IronPython2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -653,7 +666,7 @@ if(CMake_TEST_FindPython_IronPython)
)
endif()
-if(CMake_TEST_FindPython_PyPy)
+if(CMake_TEST_FindPython2_PyPy)
add_test(NAME FindPython.PyPy2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -675,85 +688,91 @@ if(CMake_TEST_FindPython_PyPy)
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.PyPy3.LOCATION COMMAND
+ add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
- "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION"
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.LOCATION"
${build_generator_args}
- --build-project TestPyPy3
- --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION
+ --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.PyPy3.VERSION COMMAND
+ add_test(NAME FindPython.PyPy.V2.VERSION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
- "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION"
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V2.VERSION"
${build_generator_args}
- --build-project TestPyPy3
- --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION
+ --build-project TestPyPy
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+endif()
- add_test(NAME FindPython.PyPy.LOCATION COMMAND
+if(CMake_TEST_FindPython3_PyPy)
+ add_test(NAME FindPython.PyPy3.LOCATION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
- "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION"
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.LOCATION"
${build_generator_args}
- --build-project TestPyPy
- --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=LOCATION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.PyPy.VERSION COMMAND
+ add_test(NAME FindPython.PyPy3.VERSION COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
- "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy"
- "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION"
+ "${CMake_SOURCE_DIR}/Tests/FindPython/PyPy3"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy3.VERSION"
${build_generator_args}
- --build-project TestPyPy
- --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
+ --build-project TestPyPy3
+ --build-options ${build_options} -DPython3_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.PyPy.V2.LOCATION COMMAND
+
+ 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.V2.LOCATION"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.LOCATION"
${build_generator_args}
--build-project TestPyPy
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=LOCATION
+ --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.V2.VERSION COMMAND
+ 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.V2.VERSION"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.V3.VERSION"
${build_generator_args}
--build-project TestPyPy
- --build-options ${build_options} -DPython_REQUESTED_VERSION=2 -DPython_FIND_STRATEGY=VERSION
+ --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.PyPy.V3.LOCATION COMMAND
+endif()
+
+if(CMake_TEST_FindPython2_PyPy OR CMake_TEST_FindPython3_PyPy)
+ 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.V3.LOCATION"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.LOCATION"
${build_generator_args}
--build-project TestPyPy
- --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=LOCATION
+ --build-options ${build_options} -DPython_FIND_STRATEGY=LOCATION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
- add_test(NAME FindPython.PyPy.V3.VERSION COMMAND
+ 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.V3.VERSION"
+ "${CMake_BINARY_DIR}/Tests/FindPython/PyPy.VERSION"
${build_generator_args}
--build-project TestPyPy
- --build-options ${build_options} -DPython_REQUESTED_VERSION=3 -DPython_FIND_STRATEGY=VERSION
+ --build-options ${build_options} -DPython_FIND_STRATEGY=VERSION
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
diff --git a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
index 283aeec..e0148f3 100644
--- a/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
+++ b/Tests/FindPython/CustomFailureMessage/CMakeLists.txt
@@ -62,7 +62,7 @@ set_tests_properties(FindPython.CustomFailureMessage.Multiple PROPERTIES
PASS_REGULAR_EXPRESSION "Reason given by package:.+Interpreter: Cannot run the interpreter.+Development: Cannot find the library")
-if (CMake_TEST_FindPython_NumPy)
+if (CMake_TEST_FindPython3_NumPy)
add_test(NAME FindPython.CustomFailureMessage.NumPy COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
diff --git a/Tests/FindPython/MultiplePackages/CMakeLists.txt b/Tests/FindPython/MultiplePackages/CMakeLists.txt
index 4845035..352a2f6f 100644
--- a/Tests/FindPython/MultiplePackages/CMakeLists.txt
+++ b/Tests/FindPython/MultiplePackages/CMakeLists.txt
@@ -2,32 +2,44 @@ cmake_minimum_required(VERSION 3.5)
project(TestMultiplePackages C)
-find_package (Python2 REQUIRED COMPONENTS Interpreter Development)
-find_package (Python3 REQUIRED COMPONENTS Interpreter Development)
-
-# Must find Python 3
find_package (Python REQUIRED)
-if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE)
- message (FATAL_ERROR
- "Python interpreters do not match:\n"
- " Python_EXECUTABLE='${Python_EXECUTABLE}'\n"
- " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n"
+if (CMake_TEST_FindPython2)
+ find_package (Python2 REQUIRED COMPONENTS Interpreter Development)
+
+ if (NOT CMake_TEST_FindPython3 AND NOT Python2_EXECUTABLE STREQUAL Python_EXECUTABLE)
+ message (FATAL_ERROR
+ "Python interpreters do not match:\n"
+ " Python_EXECUTABLE='${Python_EXECUTABLE}'\n"
+ " Python2_EXECUTABLE='${Python3_EXECUTABLE}'\n"
)
-endif()
+ 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:spam3>"
+ "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
-Python2_add_library (spam2 MODULE ../spam.c)
-target_compile_definitions (spam2 PRIVATE PYTHON2)
+endif()
+
+if (CMake_TEST_FindPython3)
+ find_package (Python3 REQUIRED COMPONENTS Interpreter Development)
-Python3_add_library (spam3 MODULE ../spam.c)
-target_compile_definitions (spam3 PRIVATE PYTHON3)
+ if (NOT Python3_EXECUTABLE STREQUAL Python_EXECUTABLE)
+ message (FATAL_ERROR
+ "Python interpreters do not match:\n"
+ " Python_EXECUTABLE='${Python_EXECUTABLE}'\n"
+ " Python3_EXECUTABLE='${Python3_EXECUTABLE}'\n"
+ )
+ endif()
+ Python3_add_library (spam3 MODULE ../spam.c)
+ target_compile_definitions (spam3 PRIVATE PYTHON3)
-add_test (NAME python2_spam2
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
- "${Python2_EXECUTABLE}" -c "import spam2; spam2.system(\"cd\")")
+ add_test (NAME python3_spam3
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
+ "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
-add_test (NAME python3_spam3
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:spam3>"
- "${Python3_EXECUTABLE}" -c "import spam3; spam3.system(\"cd\")")
+endif()
diff --git a/Tests/FindPython/NumPy/CMakeLists.txt b/Tests/FindPython/NumPy/CMakeLists.txt
index 9920336..336bb83 100644
--- a/Tests/FindPython/NumPy/CMakeLists.txt
+++ b/Tests/FindPython/NumPy/CMakeLists.txt
@@ -2,21 +2,30 @@ cmake_minimum_required(VERSION 3.5)
project(TestNumPy LANGUAGES C)
-find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy)
-find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
+if(CMake_TEST_FindPython2_NumPy)
-Python2_add_library (arraytest2 MODULE arraytest.c)
-target_compile_definitions (arraytest2 PRIVATE PYTHON2)
-target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
+ find_package (Python2 REQUIRED COMPONENTS Interpreter Development NumPy)
-Python3_add_library (arraytest3 MODULE arraytest.c)
-target_compile_definitions (arraytest3 PRIVATE PYTHON3)
-target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
+ Python2_add_library (arraytest2 MODULE arraytest.c)
+ target_compile_definitions (arraytest2 PRIVATE PYTHON2)
+ target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
-add_test (NAME python2_arraytest
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>"
- "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));")
+ add_test (NAME python2_arraytest
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest2>"
+ "${Python2_EXECUTABLE}" -c "import numpy; import arraytest2; arraytest2.vecsq(numpy.array([1, 2, 3]));")
-add_test (NAME python3_arraytest
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>"
- "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));")
+endif()
+
+if(CMake_TEST_FindPython3_NumPy)
+
+ find_package (Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
+
+ Python3_add_library (arraytest3 MODULE arraytest.c)
+ target_compile_definitions (arraytest3 PRIVATE PYTHON3)
+ target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
+
+ add_test (NAME python3_arraytest
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:arraytest3>"
+ "${Python3_EXECUTABLE}" -c "import numpy; import arraytest3; arraytest3.vecsq(numpy.array([1, 2, 3]));")
+
+endif()
diff --git a/Tests/FindPython/NumPyOnly/CMakeLists.txt b/Tests/FindPython/NumPyOnly/CMakeLists.txt
index 9aa1bcf..115cf2b 100644
--- a/Tests/FindPython/NumPyOnly/CMakeLists.txt
+++ b/Tests/FindPython/NumPyOnly/CMakeLists.txt
@@ -2,13 +2,23 @@ cmake_minimum_required(VERSION 3.5)
project(TestNumPyOnly LANGUAGES C)
-find_package(Python2 REQUIRED COMPONENTS NumPy)
-find_package(Python3 REQUIRED COMPONENTS NumPy)
+if(CMake_TEST_FindPython2_NumPy)
+
+ find_package(Python2 REQUIRED COMPONENTS NumPy)
+
+ Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c)
+ target_compile_definitions (arraytest2 PRIVATE PYTHON2)
+ target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
+
+endif()
-Python2_add_library (arraytest2 MODULE ../NumPy/arraytest.c)
-target_compile_definitions (arraytest2 PRIVATE PYTHON2)
-target_link_libraries (arraytest2 PRIVATE Python2::NumPy)
+
+if(CMake_TEST_FindPython3_NumPy)
+
+find_package(Python3 REQUIRED COMPONENTS NumPy)
Python3_add_library (arraytest3 MODULE ../NumPy/arraytest.c)
target_compile_definitions (arraytest3 PRIVATE PYTHON3)
target_link_libraries (arraytest3 PRIVATE Python3::NumPy)
+
+endif()
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
index cb9d4d3..eec28a5 100644
--- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
+++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt
@@ -4,13 +4,20 @@ project(TestRequiredArtifacts LANGUAGES C)
include(CTest)
-find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
-if (NOT Python2_FOUND)
- message (FATAL_ERROR "Failed to find Python 2")
+if(CMake_TEST_FindPython2)
+ find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
+ if (NOT Python2_FOUND)
+ message (FATAL_ERROR "Failed to find Python 2")
+ endif()
+ set(USER_LIBRARY "${Python2_LIBRARY_RELEASE}")
+ set(USER_INCLUDE_DIR "${Python2_INCLUDE_DIRS}")
+else()
+ set(USER_LIBRARY "/path/to/invalid${CMAKE_C_LINK_LIBRARY_SUFFIX}")
+ set(USER_INCLUDE_DIR "/path/to/invalid/dir")
endif()
set(components Interpreter Development)
-if (CMake_TEST_FindPython_SABIModule AND WIN32)
+if (CMake_TEST_FindPython3_SABIModule AND WIN32)
list (APPEND components Development.SABIModule)
endif()
find_package(Python3 REQUIRED COMPONENTS ${components})
@@ -61,7 +68,7 @@ add_test(NAME FindPython.RequiredArtifacts.Library.INVALID COMMAND
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON
- "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}"
+ "-DPython3_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -84,7 +91,7 @@ add_test(NAME FindPython.RequiredArtifacts.Include.INVALID COMMAND
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INCLUDE=ON
- "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}"
+ "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -97,7 +104,7 @@ add_test(NAME FindPython.RequiredArtifacts.Interpreter-Library.INVALID COMMAND
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_INTERPRETER=ON -DCHECK_LIBRARY=ON
"-DPython3_EXECUTABLE=${Python3_EXECUTABLE}"
- "-DPython3_LIBRARY=${Python2_LIBRARY_RELEASE}"
+ "-DPython3_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
@@ -110,11 +117,11 @@ add_test(NAME FindPython.RequiredArtifacts.Library-Include.INVALID COMMAND
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_LIBRARY=ON -DCHECK_INCLUDE=ON
"-DPython3_LIBRARY=${Python3_LIBRARY_RELEASE}"
- "-DPython3_INCLUDE_DIR=${Python2_INCLUDE_DIRS}"
+ "-DPython3_INCLUDE_DIR=${USER_INCLUDE_DIR}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
-if (CMake_TEST_FindPython_SABIModule AND WIN32)
+if (CMake_TEST_FindPython3_SABIModule AND WIN32)
add_test(NAME FindPython.RequiredArtifacts.SABILibrary.VALID COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -134,7 +141,7 @@ if (CMake_TEST_FindPython_SABIModule AND WIN32)
${build_generator_args}
--build-project TestRequiredArtifacts.Check
--build-options -DPYTHON_IS_FOUND=FALSE -DCHECK_SABI_LIBRARY=ON
- "-DPython3_SABI_LIBRARY=${Python2_LIBRARY_RELEASE}"
+ "-DPython3_SABI_LIBRARY=${USER_LIBRARY}"
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
endif()
diff --git a/Tests/FindPython/SOABI/CMakeLists.txt b/Tests/FindPython/SOABI/CMakeLists.txt
index 60399d3..6c0e9a9 100644
--- a/Tests/FindPython/SOABI/CMakeLists.txt
+++ b/Tests/FindPython/SOABI/CMakeLists.txt
@@ -2,37 +2,40 @@ cmake_minimum_required(VERSION 3.5)
project(TestSOABI LANGUAGES C)
-find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
-if (NOT Python3_FOUND)
- message (FATAL_ERROR "Failed to find Python 3")
-endif()
+if(CMake_TEST_FindPython3)
+ find_package(Python3 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+ if (NOT Python3_FOUND)
+ message (FATAL_ERROR "Failed to find Python 3")
+ endif()
-if(NOT DEFINED Python3_SOABI)
- message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
-endif()
+ if(NOT DEFINED Python3_SOABI)
+ message(FATAL_ERROR "Python3_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+ endif()
-if (Python3_Development_FOUND AND Python3_SOABI)
- Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c)
- target_compile_definitions (spam3 PRIVATE PYTHON3)
+ if (Python3_Development_FOUND AND Python3_SOABI)
+ Python3_add_library (spam3 MODULE WITH_SOABI ../spam.c)
+ target_compile_definitions (spam3 PRIVATE PYTHON3)
- get_property (suffix TARGET spam3 PROPERTY SUFFIX)
- if (NOT suffix MATCHES "^.${Python3_SOABI}")
- message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
+ get_property (suffix TARGET spam3 PROPERTY SUFFIX)
+ if (NOT suffix MATCHES "^.${Python3_SOABI}")
+ message(FATAL_ERROR "Module suffix do not include Python3_SOABI")
+ endif()
endif()
endif()
+if(CMake_TEST_FindPython2)
+ find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
+ if(NOT DEFINED Python2_SOABI)
+ message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
+ endif()
-find_package(Python2 COMPONENTS ${CMake_TEST_FindPython_COMPONENT})
-if(NOT DEFINED Python2_SOABI)
- message(FATAL_ERROR "Python2_SOABI for ${CMake_TEST_FindPython_COMPONENT} not found")
-endif()
-
-if (Python2_Development_FOUND AND Python2_SOABI)
- Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c)
- target_compile_definitions (spam2 PRIVATE PYTHON2)
+ if (Python2_Development_FOUND AND Python2_SOABI)
+ Python2_add_library (spam2 MODULE WITH_SOABI ../spam.c)
+ target_compile_definitions (spam2 PRIVATE PYTHON2)
- get_property (suffix TARGET spam2 PROPERTY SUFFIX)
- if (NOT suffix MATCHES "^.${Python2_SOABI}")
- message(FATAL_ERROR "Module suffix do not include Python2_SOABI")
+ get_property (suffix TARGET spam2 PROPERTY SUFFIX)
+ if (NOT suffix MATCHES "^.${Python2_SOABI}")
+ message(FATAL_ERROR "Module suffix do not include Python2_SOABI")
+ endif()
endif()
endif()
diff --git a/Tests/FindPython/VirtualEnv/CMakeLists.txt b/Tests/FindPython/VirtualEnv/CMakeLists.txt
index e2e5bd2..ea742ea 100644
--- a/Tests/FindPython/VirtualEnv/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnv/CMakeLists.txt
@@ -27,21 +27,23 @@ add_test(NAME FindPython3.VirtualEnvDefault
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake")
-add_test(NAME FindPython3.VirtualEnvOnly
- COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
- --unset=CONDA_PREFIX
- "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
- "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
- -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
-add_test(NAME FindPython3.UnsetVirtualEnvOnly
- COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
- --unset=VIRTUAL_ENV
- --unset=CONDA_PREFIX
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
-
add_test(NAME FindPython3.VirtualEnvStandard
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
--unset=CONDA_PREFIX
"VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake")
+
+if(CMake_TEST_FindPython2)
+ add_test(NAME FindPython3.VirtualEnvOnly
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
+ "VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+ add_test(NAME FindPython3.UnsetVirtualEnvOnly
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=VIRTUAL_ENV
+ --unset=CONDA_PREFIX
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+endif()
diff --git a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
index 2f7c0db..3a64c31 100644
--- a/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
+++ b/Tests/FindPython/VirtualEnvConda/CMakeLists.txt
@@ -26,21 +26,23 @@ add_test(NAME FindPython3.VirtualEnvDefaultConda
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvDefault.cmake")
-add_test(NAME FindPython3.VirtualEnvOnlyConda
- COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
- --unset=VIRTUAL_ENV
- "CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
- "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
- -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
-add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda
- COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
- --unset=CONDA_PREFIX
- --unset=VIRTUAL_ENV
- "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
-
add_test(NAME FindPython3.VirtualEnvStandardConda
COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
--unset=VIRTUAL_ENV
"CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
"${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
-P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvStandard.cmake")
+
+if(Cmake_TEST_FindPython2)
+ add_test(NAME FindPython3.VirtualEnvOnlyConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=VIRTUAL_ENV
+ "CONDA_PREFIX=${Python3_VIRTUAL_ENV}"
+ "${CMAKE_COMMAND}" "-DPYTHON3_VIRTUAL_ENV=${Python3_VIRTUAL_ENV}"
+ -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+ add_test(NAME FindPython3.UnsetVirtualEnvOnlyConda
+ COMMAND "${CMAKE_COMMAND}" -E env --unset=PYTHONHOME
+ --unset=CONDA_PREFIX
+ --unset=VIRTUAL_ENV
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_LIST_DIR}/VirtualEnvOnly.cmake")
+endif()
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index f089a96..8baa98f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -363,7 +363,8 @@ if(CMake_TEST_FindOpenSSL)
endif()
if(CMake_TEST_UseSWIG)
add_RunCMake_test(FindSWIG)
- add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython=${CMake_TEST_FindPython})
+ add_RunCMake_test(UseSWIG -DCMake_TEST_FindPython2=${CMake_TEST_FindPython2}
+ -DCMake_TEST_FindPython3=${CMake_TEST_FindPython3})
endif()
if(NOT CMAKE_C_COMPILER_ID MATCHES "Watcom")
add_RunCMake_test(GenerateExportHeader)
diff --git a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
index c7a118f..537f67d 100644
--- a/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
+++ b/Tests/RunCMake/UseSWIG/RunCMakeTest.cmake
@@ -6,7 +6,7 @@ run_cmake(CMP0078-NEW)
run_cmake(CMP0086-WARN)
-if (CMake_TEST_FindPython)
+if (CMake_TEST_FindPython2 OR CMake_TEST_FindPython3)
macro(run_cmake_target test subtest target)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
diff --git a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt
index a2c239c..f20593c 100644
--- a/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt
+++ b/Tests/UseSWIG/AlternateLibraryName/CMakeLists.txt
@@ -7,7 +7,7 @@ include(CTest)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
-find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
+find_package(Python REQUIRED COMPONENTS Interpreter Development)
# Path separator
if (WIN32)
@@ -27,9 +27,9 @@ swig_add_library(example_python
set_target_properties (example_python PROPERTIES
INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/.."
SWIG_USE_TARGET_INCLUDE_DIRECTORIES TRUE)
-target_link_libraries(example_python PRIVATE Python2::Python)
+target_link_libraries(example_python PRIVATE Python::Python)
add_test (NAME AlternateLibraryName.example1
COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}${PS}$<TARGET_FILE_DIR:example_python>"
- "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+ "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
diff --git a/Tests/UseSWIG/CMakeLists.txt b/Tests/UseSWIG/CMakeLists.txt
index 7c4925e..3d80270 100644
--- a/Tests/UseSWIG/CMakeLists.txt
+++ b/Tests/UseSWIG/CMakeLists.txt
@@ -147,16 +147,18 @@ add_test(NAME UseSWIG.MultipleModules COMMAND
--build-options ${build_options}
--test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
-add_test(NAME UseSWIG.MultiplePython COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython"
- "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython"
- ${build_generator_args}
- --build-project TestMultiplePython
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+if(CMake_TEST_FindPython2 AND CMake_TEST_FindPython3)
+ add_test(NAME UseSWIG.MultiplePython COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/MultiplePython"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/MultiplePython"
+ ${build_generator_args}
+ --build-project TestMultiplePython
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
+endif()
add_test(NAME UseSWIG.MultipleFiles COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
--build-and-test
@@ -165,20 +167,20 @@ add_test(NAME UseSWIG.MultipleFiles COMMAND
${build_generator_args}
--build-project TestMultipleFiles
--build-options ${build_options}
- )
-
+)
-add_test(NAME UseSWIG.ModuleVersion2 COMMAND
- ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
- --build-and-test
- "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2"
- "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2"
- ${build_generator_args}
- --build-project TestModuleVersion2
- --build-options ${build_options}
- --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
+if(CMake_TEST_FindPython2 OR CMake_TEST_FindPython3)
+ add_test(NAME UseSWIG.ModuleVersion2 COMMAND
+ ${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/UseSWIG/ModuleVersion2"
+ "${CMake_BINARY_DIR}/Tests/UseSWIG/ModuleVersion2"
+ ${build_generator_args}
+ --build-project TestModuleVersion2
+ --build-options ${build_options}
+ --test-command ${CMAKE_CTEST_COMMAND} -V -C $<CONFIGURATION>
)
-
+endif()
add_test(NAME UseSWIG.UseTargetINCLUDE_DIRECTORIES COMMAND
${CMAKE_CTEST_COMMAND} -C $<CONFIGURATION>
diff --git a/Tests/UseSWIG/ModuleName/CMakeLists.txt b/Tests/UseSWIG/ModuleName/CMakeLists.txt
index 435b441..c62319f 100644
--- a/Tests/UseSWIG/ModuleName/CMakeLists.txt
+++ b/Tests/UseSWIG/ModuleName/CMakeLists.txt
@@ -8,14 +8,7 @@ find_package(SWIG REQUIRED)
cmake_policy(SET CMP0086 NEW)
include(${SWIG_USE_FILE})
-find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
-
-# Path separator
-if (WIN32)
- set (PS "$<SEMICOLON>")
-else()
- set (PS ":")
-endif()
+find_package(Python REQUIRED COMPONENTS Interpreter Development)
unset(CMAKE_SWIG_FLAGS)
@@ -34,9 +27,9 @@ set_target_properties (example1 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1")
-target_link_libraries(example1 PRIVATE Python2::Module)
+target_link_libraries(example1 PRIVATE Python::Module)
add_test (NAME ModuleName.example1
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/Python2${PS}$<TARGET_FILE_DIR:example1>"
- "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py")
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_FILE_DIR:example1>"
+ "${Python_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runme.py")
diff --git a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
index 093e858..317ed47 100644
--- a/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
+++ b/Tests/UseSWIG/ModuleVersion2/CMakeLists.txt
@@ -7,9 +7,6 @@ include(CTest)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
-find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
-find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
-
if (WIN32)
set (PS $<SEMICOLON>)
else()
@@ -25,32 +22,69 @@ set_property(SOURCE "../example.i" PROPERTY COMPILE_OPTIONS -includeall)
set_property(SOURCE "../example.i"
PROPERTY GENERATED_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/..")
-swig_add_library(example1
- LANGUAGE python
- SOURCES ../example.i ../example.cxx)
-set_target_properties (example1 PROPERTIES
- OUTPUT_NAME example
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2"
- ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2"
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2")
-target_link_libraries(example1 PRIVATE Python2::Module)
-
-# re-use sample interface file for another plugin
-swig_add_library(example2
- LANGUAGE python
- SOURCES ../example.i ../example.cxx)
-set_target_properties (example2 PROPERTIES
- OUTPUT_NAME example
- LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3"
- ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3"
- RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3")
-target_link_libraries(example2 PRIVATE Python3::Module)
-
-
-add_test (NAME ModuleVersion2.example1
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>"
- "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
-
-add_test (NAME ModuleVersion2.example2
- COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example2,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example2>"
- "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+if(CMake_TEST_FindPython2)
+ find_package(Python2 REQUIRED COMPONENTS Interpreter Development)
+
+ swig_add_library(example1
+ LANGUAGE python
+ SOURCES ../example.i ../example.cxx)
+ set_target_properties (example1 PROPERTIES
+ OUTPUT_NAME example
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-1")
+ target_link_libraries(example1 PRIVATE Python2::Module)
+
+ add_test (NAME ModuleVersion2.example1
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example1,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example1>"
+ "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+
+ # re-use sample interface file for another plugin
+ swig_add_library(example2
+ LANGUAGE python
+ SOURCES ../example.i ../example.cxx)
+ set_target_properties (example2 PROPERTIES
+ OUTPUT_NAME example
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python2-2")
+ target_link_libraries(example2 PRIVATE Python2::Module)
+
+ add_test (NAME ModuleVersion2.example2
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example2,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example2>"
+ "${Python2_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+endif()
+
+if(CMake_TEST_FindPython3)
+ find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+
+ swig_add_library(example3
+ LANGUAGE python
+ SOURCES ../example.i ../example.cxx)
+ set_target_properties (example3 PROPERTIES
+ OUTPUT_NAME example
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-1")
+ target_link_libraries(example3 PRIVATE Python3::Module)
+
+ add_test (NAME ModuleVersion2.example3
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example3,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example3>"
+ "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+
+
+ # re-use sample interface file for another plugin
+ swig_add_library(example4
+ LANGUAGE python
+ SOURCES ../example.i ../example.cxx)
+ set_target_properties (example2 PROPERTIES
+ OUTPUT_NAME example
+ LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2"
+ ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/Python3-2")
+ target_link_libraries(example4 PRIVATE Python3::Module)
+
+ add_test (NAME ModuleVersion2.example4
+ COMMAND "${CMAKE_COMMAND}" -E env "PYTHONPATH=$<TARGET_PROPERTY:example4,SWIG_SUPPORT_FILES_DIRECTORY>${PS}$<TARGET_FILE_DIR:example4>"
+ "${Python3_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/../runme.py")
+endif()
diff --git a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
index bf3d946..36734f9 100644
--- a/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
+++ b/Tests/UseSWIG/MultipleFiles/CMakeLists.txt
@@ -11,7 +11,7 @@ unset(SWIG_LANG_DEFINITIONS)
unset(SWIG_LANG_OPTIONS)
unset(SWIG_LANG_LIBRARIES)
-find_package(Python3 REQUIRED COMPONENTS Development)
+find_package(Python REQUIRED COMPONENTS Development)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/add.i" PROPERTY CPLUSPLUS ON)
set_property(SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/sub.i" PROPERTY CPLUSPLUS ON)
@@ -27,4 +27,4 @@ swig_add_library(example
"${CMAKE_CURRENT_SOURCE_DIR}/add.cxx"
"${CMAKE_CURRENT_SOURCE_DIR}/sub.cxx")
target_include_directories(example PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
-target_link_libraries(example PRIVATE Python3::Module)
+target_link_libraries(example PRIVATE Python::Module)
diff --git a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
index 80a2e16..6cdf987 100644
--- a/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
+++ b/Tests/UseSWIG/UseTargetINCLUDE_DIRECTORIES/CMakeLists.txt
@@ -7,7 +7,7 @@ include(CTest)
find_package(SWIG REQUIRED)
include(${SWIG_USE_FILE})
-find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
+find_package(Python REQUIRED COMPONENTS Interpreter Development)
unset(CMAKE_SWIG_FLAGS)
@@ -25,7 +25,7 @@ set_target_properties (example1 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example1")
-target_link_libraries(example1 PRIVATE Python3::Module)
+target_link_libraries(example1 PRIVATE Python::Module)
# Check that source property override target property
@@ -42,4 +42,4 @@ set_target_properties (example2 PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/example2")
-target_link_libraries(example2 PRIVATE Python3::Module)
+target_link_libraries(example2 PRIVATE Python::Module)