Skip to content

Commit

Permalink
Ensure boost tests are linked statically or dynamically, depending on…
Browse files Browse the repository at this point in the history
… build (#23)
  • Loading branch information
emmenlau authored and erikerlandson committed Jan 10, 2020
1 parent ae21401 commit 9ca89ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ if (Boost_FOUND)
ut_ordered.cpp
ut_keyed.cpp
)
include_directories(${Boost_INCLUDE_DIR})
target_compile_definitions(unit_tests PRIVATE BOOST_ALL_NO_LIB=1)
target_link_libraries(unit_tests ${Boost_LIBRARIES})
if (NOT Boost_USE_STATIC_LIBS)
target_compile_definitions(unit_tests PRIVATE BOOST_TEST_DYN_LINK=1)
endif ()
target_link_libraries(unit_tests Boost::unit_test_framework)

add_test(NAME unit_tests COMMAND unit_tests)
add_custom_target(test COMMAND unit_tests DEPENDS unit_tests)
Expand Down
1 change: 0 additions & 1 deletion tests/unit_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE st_tree
#include <boost/test/unit_test.hpp>

0 comments on commit 9ca89ad

Please sign in to comment.