FindPython: Add possibility to control scope of artifacts.

Fixes: #20362
This commit is contained in:
Marc Chevrier
2020-03-02 17:45:25 +01:00
parent 07a7bc0e3f
commit e5b4c74238
8 changed files with 138 additions and 16 deletions
@@ -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()