Page MenuHomePhabricator

[CMAKE] BOOST_TEST_DYN_LINK is defined twice
ClosedPublic

Authored by Fabien on Jun 1 2020, 13:16.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Commits
rABC3d0621759062: [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

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested review of this revision.Jun 1 2020, 13:16
This revision is now accepted and ready to land.Jun 1 2020, 13:19
This revision was automatically updated to reflect the committed changes.