Skip to content

Commit

Permalink
Merge #282: cmake: Allow overriding flags in compiler/linker flag checks
Browse files Browse the repository at this point in the history
ed471c5 fixup! cmake: Add `APPEND_{CPP,C,CXX,LD}FLAGS` cache variables (Hennadii Stepanov)

Pull request description:

  The `APPEND_{CPP,C,CXX,LD}FLAGS` flags are now considered when checking compiler/linker flags.

  Fixes #279.

Top commit has no ACKs.

Tree-SHA512: 217ab660508d19bcf8196833c05cc75c1439d1685e8f2718ddaa9248c4964a8d0e9d1e37bf2b08ce1e20aa2fc5d2a0faf532a8e20d71d7ac3d5f025f07c2b6d3
  • Loading branch information
hebasto committed Jul 30, 2024
2 parents d41a407 + ed471c5 commit 02afae4
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,22 @@ set(CLIENT_VERSION_RC 0)
set(CLIENT_VERSION_IS_RELEASE "false")
set(COPYRIGHT_YEAR "2024")

# During the enabling of the CXX and CXXOBJ languages, we modify
# CMake's compiler/linker invocation strings by appending the content
# of the user-defined `APPEND_*` variables, which allows overriding
# any flag. We also ensure that the APPEND_* flags are considered
# during CMake's tests, which use the `try_compile()` command.
#
# CMake's docs state that the `CMAKE_TRY_COMPILE_PLATFORM_VARIABLES`
# variable "is meant to be set by CMake's platform information modules
# for the current toolchain, or by a toolchain file." We do our best
# to set it before the `project()` command.
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
CMAKE_CXX_COMPILE_OBJECT
CMAKE_OBJCXX_COMPILE_OBJECT
CMAKE_CXX_LINK_EXECUTABLE
)

project(BitcoinCore
VERSION ${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_BUILD}
DESCRIPTION "Bitcoin client software"
Expand Down

0 comments on commit 02afae4

Please sign in to comment.