build: do not apply curl debug macros to tests/server by default

It seems unnecessary and possibly unexpected to build test servers with
debug-enabled features and memory tracking whenever the tested curl is
built like that (which is a requirement for some tests, so curl is
mostly built like that when running tests.) It also makes building
servers a little bit faster with cmake for the most common cases.

You can apply debug options to `tests/server` with these new options:
- `./configure`: `--enable-server-debug`.
- cmake: `-DENABLE_SERVER_DEBUG`.

Also sync the way we pass these macros in autotools, with CMake builds.
Before this patch, autotools passed them via `curl_config.h`. After this
patch it passes them on the command-line, like cmake builds do.

This patch also make these option no longer passed to examples and
`http/client` in cmake builds, where they were no-ops anyway.

Ref: #15000
Closes #16705
This commit is contained in:
Viktor Szakats 2025-03-12 22:41:57 +01:00
parent 43b2884655
commit a16485a42e
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
14 changed files with 65 additions and 7 deletions

View file

@ -24,6 +24,7 @@
set(LIB_NAME "libcurl")
set(LIBCURL_OUTPUT_NAME "libcurl" CACHE STRING "Basename of the curl library")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "BUILDING_LIBCURL")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
configure_file("curl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/curl_config.h")

View file

@ -64,6 +64,12 @@ include Makefile.soname
AM_CPPFLAGS += -DBUILDING_LIBCURL
AM_LDFLAGS =
AM_CFLAGS =
if DEBUGBUILD
AM_CPPFLAGS += -DDEBUGBUILD
endif
if CURLDEBUG
AM_CPPFLAGS += -DCURLDEBUG
endif
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc