Skip to content

Commit bfadb6e

Browse files
committed
cmake: Add APPEND_{CPP,C,CXX,LD}FLAGS cache variables
The content of those variables is appended to the each target flags added by the build system.
1 parent a6efc04 commit bfadb6e

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,14 @@ cmake_dependent_option(FUZZ "Build for fuzzing. Enabling this will disable all o
167167

168168
option(INSTALL_MAN "Install man pages." ON)
169169

170+
set(APPEND_CPPFLAGS "" CACHE STRING "Preprocessor flags that are appended to the flags added by the build system.")
171+
set(APPEND_CFLAGS "" CACHE STRING "C compiler flags that are appended to the flags added by the build system.")
172+
set(APPEND_CXXFLAGS "" CACHE STRING "(Objective) C++ compiler flags that are appended to the flags added by the build system.")
173+
set(APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the flags added by the build system.")
174+
string(APPEND CMAKE_CXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}")
175+
string(APPEND CMAKE_CXX_CREATE_SHARED_LIBRARY " ${APPEND_LDFLAGS}")
176+
string(APPEND CMAKE_CXX_LINK_EXECUTABLE " ${APPEND_LDFLAGS}")
177+
170178
set(configure_warnings)
171179

172180
include(CheckPIESupported)

cmake/secp256k1.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
enable_language(C)
1010
set(CMAKE_C_STANDARD 90)
1111
set(CMAKE_C_EXTENSIONS OFF)
12+
string(APPEND CMAKE_C_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CFLAGS}")
1213

1314
include(CheckCSourceCompiles)
1415
check_c_source_compiles("

src/qt/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
2020
set(CMAKE_OBJCXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
2121
set(CMAKE_OBJCXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
2222
set(CMAKE_OBJCXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
23+
string(APPEND CMAKE_OBJCXX_COMPILE_OBJECT " ${APPEND_CPPFLAGS} ${APPEND_CXXFLAGS}")
2324
endif()
2425

2526
function(import_plugins target)

0 commit comments

Comments
 (0)