Skip to content

Commit c36baaf

Browse files
authored
Merge pull request #80 from hisazumi/fix-pyenvmake
Updated CMakeLists.txt to conditionally check for the presence of pyenv.
2 parents a675975 + 80a288f commit c36baaf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

bindings/python/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,22 @@ if( ${CMAKE_VERSION} LESS 3.12 )
99
include_directories(${Python_INCLUDE_DIRS})
1010
set(HAKO_PYTHON_LIBS ${PYTHON_LIBRARIES})
1111
else()
12+
# check pyenv
13+
execute_process(
14+
COMMAND pyenv which python
15+
RESULT_VARIABLE PYENV_FOUND
16+
OUTPUT_VARIABLE PYENV_PYTHON_PATH
17+
OUTPUT_STRIP_TRAILING_WHITESPACE
18+
)
19+
20+
message(STATUS "PYENV_FOUND:${PYENV_FOUND}")
21+
22+
if(PYENV_FOUND EQUAL 0)
23+
# if pyenv found, use pyenv python
24+
set(Python_EXECUTABLE ${PYENV_PYTHON_PATH})
25+
set(Python_ROOT_DIR ${PYENV_PYTHON_PATH})
26+
endif()
27+
1228
find_package(Python COMPONENTS Interpreter Development)
1329
include_directories(${Python_INCLUDE_DIRS})
1430
set(HAKO_PYTHON_LIBS ${Python_LIBRARIES})

0 commit comments

Comments
 (0)