build: tidy up header paths, use srcdir where possible

To improve readability.

Also add more comments on why each is necessary.

Closes #17630
This commit is contained in:
Viktor Szakats 2025-06-14 17:06:58 +02:00
parent 548873921c
commit 8e47c8a764
No known key found for this signature in database
GPG Key ID: B5ABD165E2AEF201
13 changed files with 30 additions and 25 deletions

View File

@ -50,6 +50,7 @@ CFLAGS += @CURL_CFLAG_EXTRAS@
#
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(srcdir) for the generated unity source to find included sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \

View File

@ -79,11 +79,10 @@ if(BUILD_STATIC_CURL)
endif()
set_property(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
"${PROJECT_BINARY_DIR}/lib" # for "curl_config.h"
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
"${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx functions
# This is needed as tool_hugehelp.c is generated in the binary dir
"${PROJECT_SOURCE_DIR}/src" # for "tool_hugehelp.h"
"${CMAKE_CURRENT_SOURCE_DIR}" # for "tool_hugehelp.c"
)
add_executable(${EXE_NAME} ${CURL_CFILES} ${_curl_cfiles_gen} ${CURLX_CFILES} ${CURL_HFILES} ${_curl_hfiles_gen})

View File

@ -38,14 +38,14 @@ EXTRA_DIST = mk-file-embed.pl mkhelp.pl \
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_builddir)/src is for curl's generated src/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(top_srcdir)/src is for curl's src/tool_setup.h and "curl-private" files
# $(srcdir) for generated sources to find included sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_builddir)/src \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/curlx \
-I$(top_srcdir)/src
-I$(srcdir)
bin_PROGRAMS = curl

View File

@ -47,7 +47,7 @@ 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
"${CMAKE_CURRENT_SOURCE_DIR}" # for "first.h"
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
)
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES")
set_target_properties(${BUNDLE} PROPERTIES OUTPUT_NAME "${BUNDLE}" PROJECT_LABEL "Test ${BUNDLE}" UNITY_BUILD OFF)

View File

@ -31,6 +31,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(srcdir) for the generated bundle source to find included test sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \

View File

@ -55,8 +55,8 @@ target_include_directories(${BUNDLE} PRIVATE
"${PROJECT_SOURCE_DIR}/lib" # for "curl_setup.h"
"${PROJECT_SOURCE_DIR}/lib/curlx" # for curlx
"${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h"
"${PROJECT_SOURCE_DIR}/tests/libtest" # to be able to build generated tests
"${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
"${PROJECT_SOURCE_DIR}/tests/unit" # for "curlcheck.h"
)
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")

View File

@ -31,13 +31,14 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(srcdir) for the generated bundle source to find included test sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/curlx \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tests/libtest \
-I$(srcdir) \
-I$(top_srcdir)/tests/unit
# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES variables

View File

@ -39,11 +39,11 @@ add_executable(${BUNDLE} EXCLUDE_FROM_ALL "${BUNDLE_SRC}")
add_dependencies(testdeps ${BUNDLE})
target_link_libraries(${BUNDLE} ${CURL_LIBS})
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"
"${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"
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
)
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "WITHOUT_LIBCURL")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES")

View File

@ -32,13 +32,14 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(top_srcdir)/src for "tool_binmode.h", "tool_xattr.h"
# $(srcdir) for the generated bundle source to find included test sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/lib/curlx \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tests/server
-I$(srcdir)
# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, CURLX_SRCS, TESTFILES variables
include Makefile.inc

View File

@ -40,10 +40,10 @@ 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"
"${PROJECT_SOURCE_DIR}/tests/libtest"
"${PROJECT_SOURCE_DIR}/tests/unit" # for curlcheck.h
"${PROJECT_SOURCE_DIR}/tests/tunit"
"${PROJECT_SOURCE_DIR}/src" # for tool headers
"${PROJECT_SOURCE_DIR}/tests/libtest" # for "first.h"
"${PROJECT_SOURCE_DIR}/tests/unit" # for "curlcheck.h"
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
)
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")

View File

@ -31,6 +31,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(srcdir) for the generated bundle source to find included test sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
@ -39,7 +40,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tests/libtest \
-I$(top_srcdir)/tests/unit \
-I$(top_srcdir)/tests/tunit
-I$(srcdir)
# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
include Makefile.inc

View File

@ -40,9 +40,9 @@ 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"
"${PROJECT_SOURCE_DIR}/tests/libtest"
"${PROJECT_SOURCE_DIR}/tests/unit"
"${PROJECT_SOURCE_DIR}/src" # for "tool_binmode.h"
"${PROJECT_SOURCE_DIR}/tests/libtest" # for "first.h"
"${CMAKE_CURRENT_SOURCE_DIR}" # for the generated bundle source to find included test sources
)
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "${CURL_DEBUG_MACROS}")
set_property(TARGET ${BUNDLE} APPEND PROPERTY COMPILE_DEFINITIONS "CURL_NO_OLDIES" "CURL_DISABLE_DEPRECATION")

View File

@ -31,6 +31,7 @@ AUTOMAKE_OPTIONS = foreign nostdinc
# $(top_srcdir)/include is for libcurl's external include files
# $(top_builddir)/lib is for libcurl's generated lib/curl_config.h file
# $(top_srcdir)/lib for libcurl's lib/curl_setup.h and other "borrowed" files
# $(srcdir) for the generated bundle source to find included test sources
AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_builddir)/lib \
@ -38,7 +39,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/include \
-I$(top_srcdir)/lib/curlx \
-I$(top_srcdir)/src \
-I$(top_srcdir)/tests/libtest \
-I$(top_srcdir)/tests/unit
-I$(srcdir)
# Get BUNDLE, BUNDLE_SRC, FIRSTFILES, UTILS, TESTFILES variables
include Makefile.inc