[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