cmake: sync tests scripts by using the variable BUNDLE

To reduce the diff between tests CMakeFiles.txt, and syncing with
autotools, which already used the `BUNDLE` variable like this.

Also:
- fold lines that went over 132 chars after this change.
- autotools: sync order of macros with cmake.

Closes #17667
This commit is contained in:
Viktor Szakats 2025-06-19 10:22:27 +02:00
parent ea782134e5
commit d9b89d4fa9
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
7 changed files with 41 additions and 34 deletions

View file

@ -35,17 +35,18 @@ add_custom_command(OUTPUT "${BUNDLE_SRC}"
${FIRSTFILES} ${UTILS} ${CURLX_SRCS} ${TESTFILES}
VERBATIM)
add_executable(servers EXCLUDE_FROM_ALL "${BUNDLE_SRC}")
add_dependencies(testdeps servers)
target_include_directories(servers PRIVATE
add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE_SRC}")
add_dependencies(testdeps ${BUNDLE})
target_include_directories(${BUNDLE} PRIVATE
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
"${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
"${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h", "tool_xattr.h"
"${PROJECT_SOURCE_DIR}/tests/server" # for "first.h"
)
target_link_libraries(servers ${CURL_LIBS})
set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL" "CURL_NO_OLDIES")
target_link_libraries(${BUNDLE} ${CURL_LIBS})
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES")
# 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
@ -53,6 +54,6 @@ set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL
# files on Windows targets it is necessary to build the test servers
# with CURL_STATICLIB defined, independently of how libcurl is built.
if(WIN32)
set_property(TARGET servers APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_STATICLIB")
endif()
set_target_properties(servers PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF)
set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF)

View file

@ -50,10 +50,11 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
# Prevent LIBS from being used for all link targets
LIBS = $(BLANK_AT_MAKETIME)
AM_CPPFLAGS += -DWITHOUT_LIBCURL
AM_CPPFLAGS += -DCURL_NO_OLDIES
if DOING_NATIVE_WINDOWS
AM_CPPFLAGS += -DCURL_STATICLIB
endif
AM_CPPFLAGS += -DWITHOUT_LIBCURL -DCURL_NO_OLDIES
$(BUNDLE_SRC): $(top_srcdir)/scripts/mk-unity.pl Makefile.inc $(FIRSTFILES) $(UTILS) $(CURLX_SRCS) $(TESTFILES)
@PERL@ $(top_srcdir)/scripts/mk-unity.pl --include $(UTILS) $(CURLX_SRCS) --test $(TESTFILES) > $(BUNDLE_SRC)