Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Ensure FIND_PACKAGE PythonInterp called before PythonLibs #479

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ IF (ENABLE_PYTHON3 AND NOT DEFINED PythonLibs_FIND_VERSION)
SET (PythonLibs_FIND_VERSION_MAJOR 2)
ENDIF (ENABLE_PYTHON3 AND NOT DEFINED PythonLibs_FIND_VERSION)

FIND_PACKAGE (PythonLibs REQUIRED)
IF(PYTHONLIBS_VERSION_STRING MATCHES "^([0-9.]+)")
FIND_PACKAGE (PythonInterp ${python_version} REQUIRED)
IF(PYTHON_VERSION_STRING MATCHES "^([0-9.]+)")
SET(python_version "${CMAKE_MATCH_1}")
ELSE()
MESSAGE(FATAL_ERROR "PythonLibs version format unknown '${PYTHONLIBS_VERSION_STRING}'")
MESSAGE(FATAL_ERROR "PythonInterp version format unknown '${PYTHON_VERSION_STRING}'")
ENDIF()
FIND_PACKAGE (PythonInterp ${python_version} REQUIRED)
FIND_PACKAGE (PythonLibs ${python_version} REQUIRED)

EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c "from sys import stdout; from distutils import sysconfig; stdout.write(sysconfig.get_python_lib(True))" OUTPUT_VARIABLE PYTHON_INSTALL_DIR)

Expand Down