]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: improve setting up runtests in Windows cross-builds master
authorViktor Szakats <commit@vsz.me>
Thu, 29 Jan 2026 19:55:27 +0000 (20:55 +0100)
committerViktor Szakats <commit@vsz.me>
Thu, 29 Jan 2026 23:34:25 +0000 (00:34 +0100)
Closes #20479

tests/CMakeLists.txt

index 9644c187ff7c9e37d053bcbe5dd4d4944f1f7003..1b79c5744799604ac75fab82f8a61cd7f87caf0e 100644 (file)
@@ -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"