Skip to content

Commit

Permalink
Revert "host: cmake: add boost unit_test_framework required iff ENABL…
Browse files Browse the repository at this point in the history
…E_TESTS=ON"

This reverts commit 93acdfe.

The commit introduced an issue when building without specifying
ENABLE_TESTS explicitly to CMake.

Normally, if the user doesn't set ENABLE_TESTS, it gets set to ON by
default, assuming the prerequisites are met. However, there's a
chicken-and-egg problem here. UHDBoost.cmake takes the list of required
Boost components from UHD_BOOST_REQUIRED_COMPONENTS and adds them to the
Boost_LIBRARIES list. This happens before ENABLE_TESTS gets a default
value, so the Boost unit test framework library is never added to this
list, even if ENABLE_TESTS ends up getting set to ON later on by default
in the script.

But, moving LIBUHD_REGISTER_COMPONENT (the macro that sets ENABLE_TESTS
to a default value) to go before UHDBoost.cmake is included won't work,
because that macro needs variables set by UHDBoost.cmake.

It may be possible to break the circular dependency by refactoring
UHDBoost.cmake somewhat, but for the time being, master shouldn't be
broken.
  • Loading branch information
atrnati committed May 1, 2020
1 parent 257edd8 commit 1a00949
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions host/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,9 @@ set(UHD_BOOST_REQUIRED_COMPONENTS
system
serialization
thread
unit_test_framework
)

if(ENABLE_TESTS)
list(APPEND UHD_BOOST_REQUIRED_COMPONENTS unit_test_framework)
endif(ENABLE_TESTS)

include(UHDBoost)

include_directories(${Boost_INCLUDE_DIRS})
Expand Down

0 comments on commit 1a00949

Please sign in to comment.