cmake: improve setting up runtests in Windows cross-builds
No binary (build failed)
—
(log yok)
| @@ -64,9 +64,17 @@ function(curl_add_runtests _targetname _test_flags) | |
| endif() | |
| list(APPEND _depends "testdeps") | |
| endif() | |
| - | set(_setenv "") |
| + | set(_setenvs "") |
| if(CMAKE_CONFIGURATION_TYPES) | |
| - | set(_setenv "${CMAKE_COMMAND}" -E env "CURL_DIRSUFFIX=$<CONFIG>") |
| + | list(APPEND _setenvs "CURL_DIRSUFFIX=$<CONFIG>") |
| + | endif() |
| + | if(WIN32 AND NOT CMAKE_HOST_WIN32) |
| + | list(APPEND _setenvs "CURL_TEST_EXE_EXT_SRV=${CMAKE_EXECUTABLE_SUFFIX}") # .exe |
| + | list(APPEND _setenvs "CURL_TEST_EXE_EXT_TOOL=${CMAKE_EXECUTABLE_SUFFIX}") # .exe |
| + | list(APPEND _setenvs "CURL_TEST_EXE_RUNNER=wine") |
| + | endif() |
| + | if(_setenvs) |
| + | set(_setenvs "${CMAKE_COMMAND}" -E env ${_setenvs}) |
| endif() | |
| # Use a special '$TFLAGS' placeholder as last argument which will be | |
| # replaced by the contents of the environment variable in runtests.pl. | |
| @@ -75,7 +83,7 @@ function(curl_add_runtests _targetname _test_flags) | |
| string(REPLACE " " ";" _test_flags_list "${_test_flags}") | |
| add_custom_target(${_targetname} | |
| COMMAND | |
| - | ${_setenv} |
| + | ${_setenvs} |
| "${PERL_EXECUTABLE}" "${CMAKE_CURRENT_SOURCE_DIR}/runtests.pl" | |
| ${_test_flags_list} | |
| "\$TFLAGS" | |