Skip to content

Commit

Permalink
stubs: fix PATH issue for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Nov 14, 2023
1 parent c662114 commit 22e9636
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions stubs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,23 @@ function(GENERATE_STUBS module_path module_name module_install_dir)
set(PYTHONPATH ${module_path})
endif($ENV{PYTHONPATH})

if(WIN32)
if($ENV{PYTHONPATH})
set(WINDOWS_PATH ${module_path};$ENV{PATH})
else()
set(WINDOWS_PATH ${module_path})
endif()

set(ENV_WINDOWS_PATH "PATH=${WINDOWS_PATH}")
endif(WIN32)

add_custom_target(
${target_name} ALL
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH} "${PYTHON_EXECUTABLE}"
"${STUBGEN_MAIN_FILE}" "-o" "${module_path}" "${module_name}"
"--boost-python" --ignore-invalid signature "--no-setup-py"
"--root-module-suffix" ""
${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH} ${ENV_WINDOWS_PATH} "${PYTHON_EXECUTABLE}"
"${STUBGEN_MAIN_FILE}" "-o" "${module_path}" "${module_name}"
"--boost-python" --ignore-invalid signature "--no-setup-py"
"--root-module-suffix" ""
VERBATIM)
set(optional_args ${ARGN})
foreach(py_target IN LISTS optional_args)
Expand Down

0 comments on commit 22e9636

Please sign in to comment.