HomePhabricator

[CMAKE] BOOST_TEST_DYN_LINK is defined twice

Description

[CMAKE] BOOST_TEST_DYN_LINK is defined twice

Summary:
This is a confusing feature from check_cxx_source_compiles. From the
documentation related to the usage of CMAKE_REQUIRED_DEFINITIONS
(which is NOT used!):

A definition for the name specified by <resultVar> will also be added
automatically.

What this means is that the check for BOOST_TEST_DYN_LINK will build
with a -DBOOST_TEST_DYN_LINK flag, because the result variable is also
named BOOST_TEST_DYN_LINK. This in turns cause the check to fail with
-Werror due to a GCC redefinition warning being promoted to error.

This diff renames the output variable to prevent this redefinition. It
also makes the check easier to read. This has no impact on the behavior
without an additional -Werror flag.

Test Plan:

cmake -GNinja .. \
  -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
  -DCMAKE_C_FLAGS=-Werror -DCMAKE_CXX_FLAGS=-Werror

Look at the cmake output and check the test for BOOST_TEST_DYN_LINK
doesn't fail.

ninja all check-all

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

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

Details

Provenance
FabienAuthored on Jun 1 2020, 11:56
FabienPushed on Jun 1 2020, 13:47
Reviewer
Restricted Project
Differential Revision
D6312: [CMAKE] BOOST_TEST_DYN_LINK is defined twice
Parents
rABC0079e0bfa716: [CMAKE] Add a facility to add flag groups and use it for -Wformat-*
Branches
Unknown
Tags
Unknown