Skip to content
Snippets Groups Projects
Commit 6d480fa6 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

[py] CMake: to find Python, use REQUIRED flag ()

Merging branch 'py'  into 'main'.

See merge request !1158
parents 3f25d61b 670e8115
No related branches found
No related tags found
1 merge request!1158CMake: to find Python, use REQUIRED flag
Pipeline #81776 passed
...@@ -25,37 +25,14 @@ function(find_custom_python3) ...@@ -25,37 +25,14 @@ function(find_custom_python3)
# the CMake default paths. This is used for finding the _main_ # the CMake default paths. This is used for finding the _main_
# Python version. # Python version.
if(__DEFAULT_PATH) if(__DEFAULT_PATH)
find_package(Python3 3.${version_minor_min} QUIET find_package(Python3 3.${version_minor_min} REQUIRED
COMPONENTS Interpreter Development NumPy) COMPONENTS Interpreter Development NumPy)
else() else()
find_package(Python3 3.${version_minor_min} QUIET CONFIG find_package(Python3 3.${version_minor_min} REQUIRED CONFIG
COMPONENTS Interpreter Development NumPy COMPONENTS Interpreter Development NumPy
PATHS "${__PATHS}" NO_DEFAULT_PATH) PATHS "${__PATHS}" NO_DEFAULT_PATH)
endif() endif()
if(NOT Python3_FOUND)
message(FATAL_ERROR
"${CMAKE_CURRENT_FUNCTION}: Python 3 not found (minimum version 3.${version_minor_min}).")
endif()
if((${Python3_VERSION_MAJOR} LESS 3) OR (${Python3_VERSION_MINOR} LESS ${version_minor_min}))
message(FATAL_ERROR
"${CMAKE_CURRENT_FUNCTION}: Python >= 3.${version_minor_min} not found"
"(v${Python3_VERSION} is present).")
endif()
if(NOT Python3_Development_FOUND)
message(FATAL_ERROR
"${CMAKE_CURRENT_FUNCTION}: The development modules for "
"Python ${Python3_VERSION} not found. "
"Probably, you need to install package `libpython3-dev` (or similar).")
endif()
if(NOT Python3_NumPy_FOUND)
message(FATAL_ERROR
"${CMAKE_CURRENT_FUNCTION}: Python ${Python3_VERSION}-NumPy not found.")
endif()
# store the exported parameters in the internal cache; # store the exported parameters in the internal cache;
# eg., with pytag 'py39', 'Python3_LIBRARY_DIRS_py39' will be exported, etc. # eg., with pytag 'py39', 'Python3_LIBRARY_DIRS_py39' will be exported, etc.
set(_exportPars Python3_FOUND Python3_Development_FOUND Python3_NumPy_FOUND set(_exportPars Python3_FOUND Python3_Development_FOUND Python3_NumPy_FOUND
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment