Skip to content

Commit

Permalink
stub: try to avoid have ; replace by list separator (5th try)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Nov 22, 2023
1 parent bb5b59f commit 5c42e48
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions stubs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,29 @@ function(GENERATE_STUBS module_path module_name module_install_dir)
set(ENV_PATH)
set(optional_args ${ARGN})
if(WIN32)
# Ton of conflict between path separators, cmake lists separator and
# generator expression
foreach(py_target IN LISTS optional_args)
if(TARGET ${py_target})
set(_is_lib
"$<STREQUAL:$<TARGET_PROPERTY:${py_target},TYPE>,SHARED_LIBRARY>")
set(_target_dir "$<TARGET_FILE_DIR:${py_target}>")
set(_target_path "$<${_is_lib}:${_target_dir}>@${_target_path}")
set(_target_path $<${_is_lib}:${_target_dir}> ${_target_path})
endif()
endforeach()
string(REPLACE ";" "@" _path_cmake $ENV{PATH})
set(_path_cmake "${_target_path}${_path_cmake}")
string(REPLACE "@" "\\\;" _path_str ${_path_cmake})
set(ENV_PATH "PATH=${_path_str}")
set(_path_native $ENV{PATH})
file(TO_CMAKE_PATH "${_path_native}" _path_cmake)
set(_path_cmake ${_target_path} ${_path_cmake})
# TODO in cmake 3.12 :(
list(JOIN _path_cmake "\\\;" _path_cmake)
set(ENV_PATH PATH=${_path_cmake})
endif()

add_custom_target(
${target_name} ALL
COMMAND
${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHONPATH} ${ENV_PATH}
"${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 ${ENV_PATH} ${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" ""
VERBATIM)
foreach(py_target IN LISTS optional_args)
if(TARGET ${py_target})
Expand Down

0 comments on commit 5c42e48

Please sign in to comment.