From: Viktor Szakats Date: Sat, 19 Jul 2025 11:28:48 +0000 (+0200) Subject: cmake: make `runtests` targets build the curl tool X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3fd8846680e4c0915e22bbce654264973ec3daf6;p=thirdparty%2Fcurl.git 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 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index c0cc0c57b8..800b4a14d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 798fab483b..51b2b76b87 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 "") diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e428076cc5..3e32e549ac 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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}