-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmake: find python using FindPython3
- Loading branch information
Showing
2 changed files
with
12 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,9 @@ | ||
# Check if Python vars have been set in CLI | ||
|
||
message(STATUS "Checking if Python paths have been set...") | ||
|
||
if (NOT DEFINED PYTHON_INCLUDE_DIR) | ||
message(FATAL_ERROR "Please provide Python include directory as CMake argument! Usage: -DPYTHON_INCLUDE_DIR=/path/to/python/include") | ||
else() | ||
message(STATUS "PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR}") | ||
endif() | ||
|
||
if (NOT DEFINED PYTHON_LIB_DIR) | ||
message(FATAL_ERROR "Please provide Python lib directory as CMake argument! Usage: -DPYTHON_LIB_DIR=/path/to/python/lib") | ||
else() | ||
message(STATUS "PYTHON_LIB_DIR=${PYTHON_LIB_DIR}") | ||
endif() | ||
|
||
if (NOT DEFINED PYTHON_LIB) | ||
message(FATAL_ERROR "Please provide Python library as CMake argument! Usage -DPYTHON_LIB=python3.11") | ||
else() | ||
message(STATUS "PYTHON_LIB=${PYTHON_LIB}") | ||
endif() | ||
|
||
message(STATUS "Python OK!") | ||
# Check if Python environment variables have been set | ||
|
||
find_package(Python3 COMPONENTS Interpreter Development) | ||
|
||
if (NOT DEFINED Python3_Development_FOUND) | ||
message(FATAL_ERROR "Please make sure Python3 (including development artifacts) installed correctly on your system!") | ||
else() | ||
message(STATUS "Linking Python ${Python3_VERSION}") | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters