Commit 40ae6cc5 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] fix Boost use

Using both ADD_PROJECT_DEPEDENCY & FIND_PACKAGE for Boost breaks uses of
${Boost_LIBRARIES}: only the last call to one ore the other is taken
into account.

I suggest to use ${Boost_LIBRARIES} for exported ones, and eg.
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} for the private ones.
parent 870c6a6d
......@@ -31,9 +31,9 @@ CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
INCLUDE(cmake/pthread.cmake) # needs to be included after the CXX definition
# Project dependencies
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization system thread)
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization system thread)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
SEARCH_FOR_PTHREAD()
# Add configuration headers for plug-ins.
......@@ -129,10 +129,10 @@ ADD_LIBRARY(${PROJECT_NAME} SHARED
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
IF(UNIX)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CMAKE_DL_LIBS} pthread)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} pthread)
ENDIF(UNIX)
IF(SUFFIX_SO_VERSION)
......
......@@ -8,7 +8,7 @@ ADD_DEFINITIONS(-DTESTS_DYNLIBSUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}")
MACRO(DYNAMIC_GRAPH_TEST NAME)
ADD_UNIT_TEST(${NAME} ${NAME}.cpp)
TARGET_LINK_LIBRARIES(${NAME} ${PROJECT_NAME} ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${NAME} PRIVATE ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
ENDMACRO(DYNAMIC_GRAPH_TEST)
# Signal cast test.
......@@ -16,7 +16,7 @@ SET(signalcast_libs signal-cast-registerer-libA signal-cast-registerer-libB)
FOREACH(lib ${signalcast_libs})
ADD_LIBRARY(${lib} SHARED ${lib})
TARGET_LINK_LIBRARIES(${lib} ${PROJECT_NAME})
TARGET_LINK_LIBRARIES(${lib} PRIVATE ${PROJECT_NAME})
ENDFOREACH()
DYNAMIC_GRAPH_TEST(signal-cast-registerer)
......@@ -34,13 +34,13 @@ DYNAMIC_GRAPH_TEST(signal-ptr)
DYNAMIC_GRAPH_TEST(real-time-logger)
DYNAMIC_GRAPH_TEST(debug-trace)
DYNAMIC_GRAPH_TEST(debug-tracer)
TARGET_LINK_LIBRARIES(debug-tracer tracer)
TARGET_LINK_LIBRARIES(debug-tracer PRIVATE tracer)
DYNAMIC_GRAPH_TEST(debug-real-time-tracer)
TARGET_LINK_LIBRARIES(debug-real-time-tracer tracer-real-time tracer)
TARGET_LINK_LIBRARIES(debug-real-time-tracer PRIVATE tracer-real-time tracer)
DYNAMIC_GRAPH_TEST(debug-logger)
DYNAMIC_GRAPH_TEST(debug-logger-winit)
DYNAMIC_GRAPH_TEST(signal-all)
DYNAMIC_GRAPH_TEST(command-test)
DYNAMIC_GRAPH_TEST(test-mt)
TARGET_LINK_LIBRARIES(test-mt tracer)
TARGET_LINK_LIBRARIES(test-mt PRIVATE tracer)
DYNAMIC_GRAPH_TEST(exceptions)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment