build: tidy up compiler definition for tests

- tests: merge cmake commands.
- tests: use `target_compile_definitions()`.
- tests/server: use generator expression for platform-specific macro.
- tests/unit: sync `Makefile.am` comment with cmake.
- tests/unit: merge two `AM_CPPFLAGS` lines to keep synced with cmake.
- tests: move macro definitions to `first.h` headers from build level.
  `CURL_NO_OLDIES`, `CURL_DISABLE_DEPRECATION`, `WITHOUT_LIBCURL`,
  `CURL_STATICLIB` (for servers).
  To share more logic.
  Pass `CURL_STATICLIB` in server on all platforms for simplicity.
  (On non-Windows, it's a no-op. It's already done like this with curlu
  and libcurltool.)

Also for lib:
- lib: merge commands.
- lib: sync macro order with tests (also in `Makefile.am`).

Closes #17768
This commit is contained in:
Viktor Szakats 2025-06-28 00:01:49 +02:00
parent 58b9c6134b
commit 2c90c3aac0
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
15 changed files with 26 additions and 33 deletions

View file

@ -24,8 +24,7 @@
set(LIBCURL_OUTPUT_NAME "${LIB_NAME}" 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}")
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${CURL_DEBUG_MACROS} "BUILDING_LIBCURL")
configure_file("curl_config.h.cmake" "${CMAKE_CURRENT_BINARY_DIR}/curl_config.h")

View file

@ -66,7 +66,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
AM_CPPFLAGS += -DBUILDING_LIBCURL
AM_LDFLAGS =
AM_CFLAGS =
if DEBUGBUILD
@ -75,6 +74,7 @@ endif
if CURLDEBUG
AM_CPPFLAGS += -DCURLDEBUG
endif
AM_CPPFLAGS += -DBUILDING_LIBCURL
if DOING_NATIVE_WINDOWS
CSOURCES += dllmain.c