Skip to content

Commit

Permalink
test: enhance WIN32 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarpent committed Jun 5, 2020
1 parent e715bf7 commit 53af9c1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ MACRO(ADD_PYTHON_UNIT_TEST NAME SOURCE)
SET(MODULES "${ARGN}") # ARGN is not a variable
FOREACH(MODULE_PATH IN LISTS MODULES)
LIST(APPEND PYTHONPATH "${CMAKE_BINARY_DIR}/${MODULE_PATH}")
IF(WIN32)
LIST(APPEND PYTHONPATH "${CMAKE_BINARY_DIR}/${MODULE_PATH}/$<CONFIG>")
ENDIF(WIN32)
ENDFOREACH(MODULE_PATH IN LISTS MODULES)

IF(DEFINED ENV{PYTHONPATH})
Expand All @@ -120,7 +123,11 @@ MACRO(ADD_PYTHON_UNIT_TEST NAME SOURCE)
OUTPUT_VARIABLE PATHSEP
OUTPUT_STRIP_TRAILING_WHITESPACE)

STRING(REPLACE ";" "${PATHSEP}" PYTHONPATH_STR "${PYTHONPATH}")
IF(WIN32)
STRING(REPLACE ";" ":" PYTHONPATH_STR "${PYTHONPATH}")
ELSE(WIN32)
STRING(REPLACE ";" "${PATHSEP}" PYTHONPATH_STR "${PYTHONPATH}")
ENDIF(WIN32)
SET(ENV_VARIABLES "PYTHONPATH=${PYTHONPATH_STR}")
IF(APPLE)
LIST(APPEND ENV_VARIABLES "LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}")
Expand Down

0 comments on commit 53af9c1

Please sign in to comment.