Skip to content

Commit e6622a4

Browse files
authored
[CMake] FIX pybind11 finding python (#155)
1 parent 012b86d commit e6622a4

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

CMakeLists.txt

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,12 @@ if(PYTHON_EXECUTABLE)
9797
endif()
9898
endif()
9999
find_package(Python ${python_version} ${python_version_flag} COMPONENTS Interpreter Development REQUIRED)
100-
set(PYTHON_VERSION ${Python_VERSION})
101-
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
102-
set(PYTHON_LIBRARIES ${Python_LIBRARIES})
103-
set(PYTHON_INCLUDE_DIRS ${Python_INCLUDE_DIRS})
104-
set(PYTHON_LIBRARY ${Python_LIBRARY})
105-
set(PYTHON_INCLUDE_DIR ${Python_INCLUDE_DIR})
100+
set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}")
101+
set(PYTHON_EXECUTABLE "${Python_EXECUTABLE}" CACHE FILEPATH "" FORCE)
106102

107103
# Set the minimum pybind11 version to 2.3 (before that the pybind11::embed target did not exist)
108104
find_package(pybind11 2.3 CONFIG QUIET REQUIRED)
105+
set(PYTHON_EXECUTABLE "${PYTHON_EXECUTABLE_RESET}" CACHE FILEPATH "" FORCE)
109106

110107
set(SP3_PYTHON_PACKAGES_DIRECTORY
111108
"python3/site-packages"
@@ -133,11 +130,11 @@ set(SP3_PYTHON_PACKAGES_LINK_DIRECTORY
133130
)
134131

135132
message(STATUS "Python:
136-
Version: ${PYTHON_VERSION}
137-
Executable: ${PYTHON_EXECUTABLE}
138-
Headers: ${PYTHON_INCLUDE_DIRS}
139-
Libraries: ${PYTHON_LIBRARIES}
140-
User site: ${PYTHON_USER_SITE}"
133+
Version: ${Python_VERSION}
134+
Executable: ${Python_EXECUTABLE}
135+
Headers: ${Python_INCLUDE_DIRS}
136+
Libraries: ${Python_LIBRARIES}
137+
User site: ${Python_USER_SITE}"
141138
)
142139
message(STATUS "pybind11:
143140
Version: ${pybind11_VERSION}

0 commit comments

Comments
 (0)