cmake: make runtests targets build the curl tool

To allow running tests just by building the `test-full` (or similar) in
a single step.

Closes #17967
This commit is contained in:
Viktor Szakats 2025-07-19 13:28:48 +02:00
parent 319d27e568
commit 3fd8846680
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
3 changed files with 10 additions and 3 deletions

View 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")

View 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 "")

View 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}