mirror of
https://github.com/curl/curl.git
synced 2026-08-26 09:53:32 +03:00
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:
parent
43b2884655
commit
a16485a42e
14 changed files with 65 additions and 7 deletions
|
|
@ -80,6 +80,7 @@ foreach(_target IN LISTS LIBTESTPROGS)
|
|||
"${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h"
|
||||
"${PROJECT_SOURCE_DIR}/tests/libtest" # to be able to build generated tests
|
||||
)
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
|
||||
if(NOT CURL_TEST_BUNDLES)
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS ${_upper_target})
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -65,6 +65,12 @@ noinst_LTLIBRARIES =
|
|||
if USE_CPPFLAG_CURL_STATICLIB
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
if DEBUGBUILD
|
||||
AM_CPPFLAGS += -DDEBUGBUILD
|
||||
endif
|
||||
if CURLDEBUG
|
||||
AM_CPPFLAGS += -DCURLDEBUG
|
||||
endif
|
||||
|
||||
AM_LDFLAGS =
|
||||
AM_CFLAGS =
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
curl_transform_makefile_inc("Makefile.inc" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
include("${CMAKE_CURRENT_BINARY_DIR}/Makefile.inc.cmake")
|
||||
|
||||
if(ENABLE_CURLDEBUG)
|
||||
if(ENABLE_SERVER_DEBUG AND ENABLE_CURLDEBUG)
|
||||
set_source_files_properties("../../lib/memdebug.c" "../../lib/curl_multibyte.c" PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON)
|
||||
endif()
|
||||
|
||||
|
|
@ -40,6 +40,9 @@ foreach(_target IN LISTS noinst_PROGRAMS)
|
|||
"${PROJECT_SOURCE_DIR}/src" # for "tool_binmod.h", "tool_xattr.h"
|
||||
)
|
||||
target_link_libraries(${_target_name} ${CURL_LIBS})
|
||||
if(ENABLE_SERVER_DEBUG)
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
|
||||
endif()
|
||||
# Test servers simply are standalone programs that do not use libcurl
|
||||
# library. For convenience and to ease portability of these servers,
|
||||
# some source code files from the libcurl subdirectory are also used
|
||||
|
|
|
|||
|
|
@ -45,6 +45,14 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
|
|||
if DOING_NATIVE_WINDOWS
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB
|
||||
endif
|
||||
if ENABLE_SERVER_DEBUG
|
||||
if DEBUGBUILD
|
||||
AM_CPPFLAGS += -DDEBUGBUILD
|
||||
endif
|
||||
if CURLDEBUG
|
||||
AM_CPPFLAGS += -DCURLDEBUG
|
||||
endif
|
||||
endif
|
||||
|
||||
# Makefile.inc provides neat definitions
|
||||
include Makefile.inc
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ foreach(_target IN LISTS UNITPROGS)
|
|||
"${PROJECT_SOURCE_DIR}/src"
|
||||
"${PROJECT_SOURCE_DIR}/tests/libtest"
|
||||
)
|
||||
set_property(TARGET ${_target_name} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
|
||||
if(CURL_TEST_BUNDLES)
|
||||
target_include_directories(${_target_name} PRIVATE "${PROJECT_SOURCE_DIR}/tests/unit")
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -51,6 +51,12 @@ LDADD = $(top_builddir)/src/libcurltool.la \
|
|||
@LIBCURL_PC_LDFLAGS_PRIVATE@ @LIBCURL_PC_LIBS_PRIVATE@
|
||||
|
||||
AM_CPPFLAGS += -DCURL_STATICLIB -DUNITTESTS
|
||||
if DEBUGBUILD
|
||||
AM_CPPFLAGS += -DDEBUGBUILD
|
||||
endif
|
||||
if CURLDEBUG
|
||||
AM_CPPFLAGS += -DCURLDEBUG
|
||||
endif
|
||||
|
||||
if BUILD_UNITTESTS
|
||||
if USE_TEST_BUNDLES
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue