HomePhabricator

[CMAKE] Avoid warning when checking flags

Authored by Fabien on Aug 5 2019, 10:59.

Description

[CMAKE] Avoid warning when checking flags

Summary:
When the CHECK_<C|CXX>_COMPILER_FLAG() is called, it uses the output
variable name to write a #define <output variable> statement to some
temporary source file that will get build to check whether the target
flag is supported.

The issue is that CMake variables character set is wider than C or C++
preprocessor #define directive. This causes the compiler to issue a
warning, which is not user facing but logged to the CMake files.

The variables used with these functions then require more sanitizing to
prevent this warning to occur. If CMake changes its behavior and starts
failing the check when a warning is detected that will cause our build
to fail. At the moment, there is no behavior change introduced by this
diff.

Test Plan:

cmake -GNinja ..
cat CMakeFiles/CMakeOutput.log | grep "whitespace after the macro name"

Should return nothing.

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Committed
FabienAug 6 2019, 09:04
Pushed
FabienAug 6 2019, 09:05
Reviewer
Restricted Project
Differential Revision
D3800: [CMAKE] Avoid warning when checking flags
Parents
rABC8f2f9c478a9e: [CMAKE] Enable -Wthread-safety-analysis
Branches
Unknown
Tags
Unknown