diff options
| author | Marc Chevrier <marc.chevrier@gmail.com> | 2019-08-15 07:19:43 (GMT) |
|---|---|---|
| committer | Marc Chevrier <marc.chevrier@gmail.com> | 2019-09-02 15:20:53 (GMT) |
| commit | 06d9e67fbd2b2dfc9cba12327866b2f73eab8a18 (patch) | |
| tree | fdf9e56cd0d072a36480b1a579dc153ee5a7a056 /Tests/FindPython/RequiredArtifacts/Check | |
| parent | cea2010b5c72f333d124f69ded95cc0379e4184d (diff) | |
| download | CMake-06d9e67fbd2b2dfc9cba12327866b2f73eab8a18.zip CMake-06d9e67fbd2b2dfc9cba12327866b2f73eab8a18.tar.gz CMake-06d9e67fbd2b2dfc9cba12327866b2f73eab8a18.tar.bz2 | |
FindPython: Add capability to specify directly artifacts
Fixes: #19492
Diffstat (limited to 'Tests/FindPython/RequiredArtifacts/Check')
| -rw-r--r-- | Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt new file mode 100644 index 0000000..b859ac5 --- /dev/null +++ b/Tests/FindPython/RequiredArtifacts/Check/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.1) + +project(TestRequiredArtifacts.Check LANGUAGES C) + +set (components) +if (CHECK_INTERPRETER) + set (required_interpreter "${Python3_EXECUTABLE}") + list (APPEND components Interpreter) +endif() +if (CHECK_LIBRARY OR CHECK_INCLUDE) + list (APPEND components Development) + if (CHECK_LIBRARY) + set (required_library "${Python3_LIBRARY}") + endif() + if (CHECK_INCLUDE) + set (required_include "${Python3_INCLUDE_DIR}") + endif() +endif() + +find_package (Python3 COMPONENTS ${components}) + + +if (PYTHON_IS_FOUND AND NOT Python3_FOUND) + message (FATAL_ERROR "Python3 unexpectedly not found") +endif() +if (NOT PYTHON_IS_FOUND AND Python3_FOUND) + message (FATAL_ERROR "Python3 unexpectedly found") +endif() + + +if (CHECK_INTERPRETER AND NOT Python3_EXECUTABLE STREQUAL required_interpreter) + message (FATAL_ERROR "Fail to use input variable Python3_EXECUTABLE") +endif() + +if (CHECK_LIBRARY AND NOT Python3_LIBRARY_RELEASE STREQUAL required_library) + message (FATAL_ERROR "Fail to use input variable Python3_LIBRARY") +endif() + +if (CHECK_INCLUDE AND NOT Python3_INCLUDE_DIRS STREQUAL required_include) + message (FATAL_ERROR "Fail to use input variable Python3_INCLUDE_DIR") +endif() |
