diff --git a/cmake/modules/FindSwiftXCTest.cmake b/cmake/modules/FindSwiftXCTest.cmake index 664e628..9ae98a2 100644 --- a/cmake/modules/FindSwiftXCTest.cmake +++ b/cmake/modules/FindSwiftXCTest.cmake @@ -127,7 +127,7 @@ function(add_swift_xctest test_target testee) # or they won't be found and the target will fail to run, so invoke it through cmake. Because COMMAND ${CMAKE_COMMAND} -E env - "PATH=$;$ENV{PATH},;>" + "PATH=$;$ENV{PATH}>" -- $ -o ${test_main} ${sources} DEPENDS ${sources} GenerateXCTestMain @@ -141,16 +141,10 @@ function(add_swift_xctest test_target testee) add_test(NAME ${test_target} COMMAND ${test_target}) - # When $ENV{PATH} is interpreted as a list on Windows, trailing backslashes in elements - # (e.g. "C:\path\to\foo\;C:\another\path\...") will end up causing semicolons to be escaped. - string(REPLACE "\\" "/" path "$ENV{PATH}") - - # Escape the semicolons when forming the environment setting. As explained in - # https://stackoverflow.com/a/59866840/125349, “this is not the last place the list will be used - # (and interpreted by CMake). [It] is then used to populate CTestTestfile.cmake, which is later - # read by CTest to setup your test environment.” set_tests_properties(${test_target} - PROPERTIES ENVIRONMENT "PATH=$;${path},\\;>") + PROPERTIES ENVIRONMENT_MODIFICATION + # For each DLL dependency X, make the PATH=path_list_prepend:X environment modification. + "$,PREPEND,PATH=path_list_prepend:>") endif()