]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
cmake: make `runtests` targets build the curl tool
authorViktor Szakats <commit@vsz.me>
Sat, 19 Jul 2025 11:28:48 +0000 (13:28 +0200)
committerViktor Szakats <commit@vsz.me>
Sat, 19 Jul 2025 20:37:17 +0000 (22:37 +0200)
To allow running tests just by building the `test-full` (or similar) in
a single step.

Closes #17967

CMakeLists.txt
src/CMakeLists.txt
tests/CMakeLists.txt

index c0cc0c57b8eee22667f8fc39506cbe275977fc48..800b4a14d7330273a2cb233a5d08e0f47c59001c 100644 (file)
@@ -175,6 +175,7 @@ else()
 endif()
 
 set(LIB_NAME "libcurl")
+set(EXE_NAME "curl")
 
 set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES "${PROJECT_SOURCE_DIR}/include")
 
index 798fab483b3e8c486fd2eec751bce8fdc837a066..51b2b76b870f1ac5b07cc11df922589e4c3be713 100644 (file)
@@ -21,7 +21,7 @@
 # SPDX-License-Identifier: curl
 #
 ###########################################################################
-set(EXE_NAME curl)
+
 set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
 
 set(_curl_cfiles_gen "")
index e428076cc5b457c836ee1effb66c3ded4b89511c..3e32e549ac7480ffd00660003efa046ffd1ecea8 100644 (file)
@@ -57,7 +57,10 @@ function(curl_add_runtests _targetname _test_flags)
   # This avoids: GNU Make doing a slow re-evaluation of all targets and
   # skipping them, MSBuild doing a re-evaluation, and actually rebuilding them.
   if(NOT _targetname STREQUAL "test-ci")
-    set(_depends "testdeps")
+    if(BUILD_CURL_EXE)
+      list(APPEND _depends ${EXE_NAME})
+    endif()
+    list(APPEND _depends "testdeps")
   endif()
   # Use a special '$TFLAGS' placeholder as last argument which will be
   # replaced by the contents of the environment variable in runtests.pl.
@@ -78,7 +81,10 @@ endfunction()
 function(curl_add_pytests _targetname _test_flags)
   set(_depends "")
   if(NOT _targetname STREQUAL "pytest-ci")
-    set(_depends "clients")
+    if(BUILD_CURL_EXE)
+      list(APPEND _depends ${EXE_NAME})
+    endif()
+    list(APPEND _depends "clients")
   endif()
   string(REPLACE " " ";" _test_flags_list "${_test_flags}")
   add_custom_target(${_targetname}