message(WARNING "This curl build is Debug-enabled and insecure, do not use in production.")
endif()
option(ENABLE_CURLDEBUG "Enable TrackMemory debug feature" ${ENABLE_DEBUG})
+option(ENABLE_SERVER_DEBUG "Apply curl debug options to test servers" OFF)
+set(CURL_DEBUG_MACROS "")
if(ENABLE_DEBUG)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "DEBUGBUILD")
+ list(APPEND CURL_DEBUG_MACROS "DEBUGBUILD")
endif()
-
if(ENABLE_CURLDEBUG)
- set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "CURLDEBUG")
+ list(APPEND CURL_DEBUG_MACROS "CURLDEBUG")
endif()
option(CURL_CLANG_TIDY "Run the build through clang-tidy" OFF)
CURL_CHECK_OPTION_WARNINGS
CURL_CHECK_OPTION_WERROR
CURL_CHECK_OPTION_CURLDEBUG
+AM_CONDITIONAL(CURLDEBUG, test x$want_curldebug = xyes)
CURL_CHECK_OPTION_SYMBOL_HIDING
CURL_CHECK_OPTION_ARES
CURL_CHECK_OPTION_RT
fi
AM_CONDITIONAL(BUILD_UNITTESTS, test x$want_unittests = xyes)
+dnl Apply curl debug options to test servers
+OPT_SERVER_DEBUG="default"
+AC_ARG_ENABLE(server-debug,
+AS_HELP_STRING([--enable-server-debug],[Enable debug options for test servers])
+AS_HELP_STRING([--disable-server-debug],[Disable debug options for test servers]),
+OPT_SERVER_DEBUG=$enableval)
+case "$OPT_SERVER_DEBUG" in
+ no)
+ dnl --disable-server-debug option used
+ want_server_debug="no"
+ ;;
+ *)
+ dnl --enable-server-debug option used or not specified
+ want_server_debug="no"
+ ;;
+esac
+AC_MSG_RESULT([$want_server_debug])
+AM_CONDITIONAL(ENABLE_SERVER_DEBUG, test x$want_server_debug = xyes)
+
dnl **********************************************************************
dnl Compilation based checks should not be done before this point.
dnl **********************************************************************
- `ENABLE_CURLDEBUG`: Enable TrackMemory debug feature. Default: =`ENABLE_DEBUG`
- `ENABLE_CURL_MANUAL`: Build the man page for curl and enable its `-M`/`--manual` option. Default: `ON`
- `ENABLE_DEBUG`: Enable curl debug features (for developing curl itself). Default: `OFF`
+- `ENABLE_SERVER_DEBUG`: Apply curl debug options to test servers. Default: `OFF`
- `IMPORT_LIB_SUFFIX`: Import library suffix. Default: `_imp` for MSVC-like toolchains, otherwise empty.
- `LIBCURL_OUTPUT_NAME`: Basename of the curl library. Default: `libcurl`
- `PICKY_COMPILER`: Enable picky compiler options. Default: `ON`
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")
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
dnl as a request to disable curldebug.
if test "$want_debug" = "yes"; then
AC_MSG_RESULT([(assumed) yes])
- AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
else
AC_MSG_RESULT([no])
fi
dnl --disable-curldebug had been given setting shell variable
dnl want_curldebug to 'no'.
want_curldebug="yes"
- AC_DEFINE(CURLDEBUG, 1, [to enable curl debug memory tracking])
AC_MSG_RESULT([yes])
;;
esac
*)
dnl --enable-debug option used
want_debug="yes"
- AC_DEFINE(DEBUGBUILD, 1, [enable debug build options])
;;
esac
AC_MSG_RESULT([$want_debug])
#
###########################################################################
set(EXE_NAME curl)
+set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
set(_curl_cfiles_gen "")
set(_curl_hfiles_gen "")
if USE_CPPFLAG_CURL_STATICLIB
AM_CPPFLAGS += -DCURL_STATICLIB
endif
+if DEBUGBUILD
+AM_CPPFLAGS += -DDEBUGBUILD
+endif
+if CURLDEBUG
+AM_CPPFLAGS += -DCURLDEBUG
+endif
AM_LDFLAGS =
if USE_UNICODE
"${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()
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 =
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()
"${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
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
"${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()
@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