HomePhabricator

[build] set _FORTIFY_SOURCE=2 for -O* builds only

Description

[build] set _FORTIFY_SOURCE=2 for -O* builds only

Summary:
currently building with -DCMAKE_BUILD_TYPE=Debug floods the cli
with warnings about how _FORTIFY_SOURCE=2 requires optimization.

Our Debug build compiles with -O0 because apparently -Og drops some
symbols, so this flag should only be set for Release, RelWithDebInfo
and RelMinSize

h/t @Fabien for help with the CMake generator expressions

Test Plan:

cmake .. -GNinja -DCMAKE_BUILD_TYPE=Debug
ninja

see no warnings that _FORTIFY_SOURCE requires compiling with
optimization

cmake .. -GNinja -DCMAKE_BUILD_TYPE=[the other three]
ninja -nv

see the correct flags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 set
in the dry run output

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

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

Details

Provenance
majcostaAuthored on May 22 2020, 23:57
majcostaPushed on May 24 2020, 00:46
Reviewer
Restricted Project
Differential Revision
D6237: [build] set _FORTIFY_SOURCE=2 for -O* builds only
Parents
rABCbef2081ba9f0: refactor: Add handleNotifications method to wallet
Branches
Unknown
Tags
Unknown