HomePhabricator

[CMAKE] Add an option to enable/disable hardening

Description

[CMAKE] Add an option to enable/disable hardening

Summary:
Tis mimics the --enable-hardening and --disable-hardening from
autotools. The default is to enable hardening.

Depends on D2653

Test Plan:

mkdir buildcmake && cd buildcmake
cmake -GNinja ..
ninja -v

Check the -fPIE flags is added on the compile lines.
Check the -pie flag is added on the linker lines.

rm -rf *
cmake -GNinja .. -DENABLE_HARDENING=ON
ninja -v

Check the -fPIE flags is added on the compile lines.
Check the -pie flag is added on the linker lines.

rm -rf *
cmake -GNinja .. -DENABLE_HARDENING=OFF
ninja -v

Check the -fPIE flags is no longer on the compile lines.
Check the -pie flag is no longer on the linker lines.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: teamcity, schancel

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

Details

Provenance
FabienAuthored on Mar 8 2019, 13:22
FabienPushed on Mar 13 2019, 12:30
Reviewer
Restricted Project
Differential Revision
D2674: [CMAKE] Add an option to enable/disable hardening
Parents
rABCfe5563885a6e: [CMAKE] Check for linker flag support
Branches
Unknown
Tags
Unknown