HomePhabricator

[CMAKE] Improve link flag compiler support detection

Description

[CMAKE] Improve link flag compiler support detection

Summary:
The add_linker_flag method is able to prevent from introducing link
time errors, but not warnings. This may cause some noise with clang,
which will issue a -Wunused-command-line-argument warning when an
unknown linker flag is set (then ignore it).

This diff promotes the warning to error so the unused link flag will not
be set.

Test Plan:

mkdir buildcmake_osx && cd buildcmake_osx
cmake -GNinja .. -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/OSX.cmake
ninja

Check the following warning disappeared with this patch:

clang: warning: argument unused during compilation: '-pie'
[-Wunused-command-line-argument]

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
FabienAuthored on Aug 1 2019, 19:08
FabienPushed on Aug 5 2019, 07:30
Reviewer
Restricted Project
Differential Revision
D3792: [CMAKE] Improve link flag compiler support detection
Parents
rSTAGING5387896dacfc: [CMAKE] Fix OSX native build
Branches
Unknown
Tags
Unknown