HomePhabricator

[CMAKE] Add compiler flags to properties rather than CFLAGS/CXXFLAGS

Description

[CMAKE] Add compiler flags to properties rather than CFLAGS/CXXFLAGS

Summary:
This change the behavior of the add_(<LANG>_)compiler_flags macros.
Rather than editing the CFLAGS and/or CXXFLAGS, it adds the flag to the
COMPILE_OPTIONS property of the targets in the calling directory and
below that are added after this command is invoked.

The final goal is to avoid changing the CFLAGS/CXXFLAGS, because they
are not linked to target properties and are used in every build,
including the cmake checks such as check_cxx_source_compiles().

Depends on D4948.

Test Plan:

ninja all check check-security

Run the Gitian builds.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4947

Details

Provenance
FabienAuthored on Dec 19 2019, 11:10
FabienPushed on Jan 15 2020, 16:43
Reviewer
Restricted Project
Differential Revision
D4947: [CMAKE] Add compiler flags to properties rather than CFLAGS/CXXFLAGS
Parents
rABC7c1f0ab29538: [CMAKE] Remove extra -fPIE flag
Branches
Unknown
Tags
Unknown