@@ -169,6 +169,14 @@ cmake_dependent_option(FUZZ "Build for fuzzing. Enabling this will disable all o
169169
170170option (INSTALL_MAN "Install man pages." ON )
171171
172+ set (APPEND_CPPFLAGS "" CACHE STRING "Preprocessor flags that are appended to the flags added by the build system." )
173+ set (APPEND_CFLAGS "" CACHE STRING "C compiler flags that are appended to the flags added by the build system." )
174+ set (APPEND_CXXFLAGS "" CACHE STRING "(Objective) C++ compiler flags that are appended to the flags added by the build system." )
175+ set (APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the flags added by the build system." )
176+ string (APPEND CMAKE_CXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS} " )
177+ string (APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY " ${APPEND_LDFLAGS} " )
178+ string (APPEND CMAKE_CXX_LINK_EXECUTABLE " ${APPEND_LDFLAGS} " )
179+
172180set (configure_warnings)
173181
174182include (CheckPIESupported)
@@ -630,15 +638,15 @@ endif()
630638message ("Cross compiling ....................... ${cross_status} " )
631639message ("Preprocessor defined macros ........... ${definitions} " )
632640message ("C compiler ............................ ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} , ${CMAKE_C_COMPILER} " )
633- message ("CFLAGS ................................ ${CMAKE_C_FLAGS} " )
641+ message ("CFLAGS ................................ ${CMAKE_C_FLAGS} ${APPEND_CPPFLAGS} ${APPEND_CFLAGS} " )
634642message ("C++ compiler .......................... ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION} , ${CMAKE_CXX_COMPILER} " )
635- message ("CXXFLAGS .............................. ${CMAKE_CXX_FLAGS} " )
643+ message ("CXXFLAGS .............................. ${CMAKE_CXX_FLAGS} ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS} " )
636644get_target_interface(common_compile_options core_interface COMPILE_OPTIONS)
637645message ("Common compile options ................ ${common_compile_options} " )
638646get_target_interface(common_link_options core_interface LINK_OPTIONS)
639647message ("Common link options ................... ${common_link_options} " )
640- message ("Linker flags for executables .......... ${CMAKE_EXE_LINKER_FLAGS} " )
641- message ("Linker flags for shared libraries ..... ${CMAKE_SHARED_LINKER_FLAGS} " )
648+ message ("Linker flags for executables .......... ${CMAKE_EXE_LINKER_FLAGS} ${APPEND_LDFLAGS} " )
649+ message ("Linker flags for shared libraries ..... ${CMAKE_SHARED_LINKER_FLAGS} ${APPEND_LDFLAGS} " )
642650print_config_flags()
643651message ("Attempt to harden executables ......... ${HARDENING} " )
644652message ("Treat compiler warnings as errors ..... ${WERROR} " )
0 commit comments