Skip to content

Commit

Permalink
stub: try to avoid have ; replace by list separator (3rd try)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisv committed Nov 22, 2023
1 parent b2c9d44 commit 01ac555
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions stubs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -102,16 +102,20 @@ function(GENERATE_STUBS module_path module_name module_install_dir)
set(ENV_PATH)
set(optional_args ${ARGN})
if(WIN32)
set(_path $ENV{PATH})
# 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(_path "$<${_is_lib}:${_target_dir}\\\;>${_path}")
set(_target_path "$<${_is_lib}:${_target_dir}>@${_target_path}")
endif()
endforeach()
set(ENV_PATH PATH=${_path})
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}")
endif()

add_custom_target(
Expand Down

0 comments on commit 01ac555

Please sign in to comment.