diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2024-12-02 16:37:18 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2024-12-02 16:37:18 (GMT) |
commit | ff65c5fca05ad11c564b2e193205f44b65376b6d (patch) | |
tree | 29e94f48a04d585a623bb2fd3d35385f89e2bcff /Tests | |
parent | 27647acc6ca9c7e207478ec548ec7e12c4fbef8c (diff) | |
download | CMake-ff65c5fca05ad11c564b2e193205f44b65376b6d.zip CMake-ff65c5fca05ad11c564b2e193205f44b65376b6d.tar.gz CMake-ff65c5fca05ad11c564b2e193205f44b65376b6d.tar.bz2 |
FindPython: Ensure SABIModule is found in all cases
Fixes: #26493
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPython/RequiredArtifacts/CMakeLists.txt | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt index 5df01c6..8be39bf 100644 --- a/Tests/FindPython/RequiredArtifacts/CMakeLists.txt +++ b/Tests/FindPython/RequiredArtifacts/CMakeLists.txt @@ -16,6 +16,55 @@ else() set(USER_INCLUDE_DIR "/path/to/invalid/dir") endif() +# check some combinations for modules search without interpreter +block(SCOPE_FOR VARIABLES) + find_package(Python3 REQUIRED COMPONENTS Development.SABIModule) + if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") + endif() + if (Python3_Development_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") + endif() + if (Python3_Interpreter_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Interpreter' unexpectedly found") + endif() + if (Python3_Development.Embed_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Embed' unexpectedly found") + endif() + if (Python3_Development.Module_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.Module' unexpectedly found") + endif() + if (NOT Python3_Development.SABIModule_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' not found") + endif() + unset(_Python3_SABI_LIBRARY_RELEASE CACHE) +endblock() + +block(SCOPE_FOR VARIABLES) + find_package(Python3 REQUIRED COMPONENTS Development.Module Development.SABIModule) + if (NOT Python3_FOUND) + message (FATAL_ERROR "Failed to find Python 3") + endif() + if (Python3_Development_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development' unexpectedly found") + endif() + if (Python3_Interpreter_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Interpreter' 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 Python3_Development.SABIModule_FOUND) + message (FATAL_ERROR "Python 3, COMPONENT 'Development.SABIModule' not found") + endif() + unset(_Python3_LIBRARY_RELEASE CACHE) + unset(_Python3_SABI_LIBRARY_RELEASE CACHE) +endblock() + + set(components Interpreter Development) if (CMake_TEST_FindPython3_SABIModule AND WIN32) list (APPEND components Development.SABIModule) |