Commit 675d7e37 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] Boost: use only components

parent cdfd6548
......@@ -31,7 +31,9 @@ CHECK_MINIMAL_CXX_STANDARD(11 ENFORCE)
INCLUDE(cmake/pthread.cmake) # needs to be included after the CXX definition
# Project dependencies
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
IF(BUILD_TESTING)
FIND_PACKAGE(Boost REQUIRED COMPONENTS unit_test_framework)
ENDIF()
ADD_PROJECT_DEPENDENCY(Boost REQUIRED COMPONENTS serialization system thread)
ADD_PROJECT_DEPENDENCY(Eigen3 REQUIRED PKG_CONFIG_REQUIRES eigen3)
SEARCH_FOR_PTHREAD()
......@@ -126,10 +128,9 @@ SET(${PROJECT_NAME}_SOURCES
ADD_LIBRARY(${PROJECT_NAME} SHARED
${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} SYSTEM PUBLIC ${EIGEN3_INCLUDE_DIR})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_NAME} PUBLIC $<INSTALL_INTERFACE:include>)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Boost::serialization Boost::system Boost::thread)
IF(UNIX)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${CMAKE_DL_LIBS} pthread)
......@@ -148,7 +149,9 @@ SET(PKG_CONFIG_EXTRA "plugindir=${DYNAMIC_GRAPH_PLUGINDIR}")
SET(CMAKE_INSTALL_RPATH "${DYNAMIC_GRAPH_PLUGINDIR}")
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(tests)
IF(BUILD_TESTING)
ADD_SUBDIRECTORY(tests)
ENDIF(BUILD_TESTING)
PKG_CONFIG_APPEND_LIBS(${PROJECT_NAME})
INSTALL(FILES package.xml DESTINATION share/${PROJECT_NAME})
......@@ -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} PRIVATE ${PROJECT_NAME} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
TARGET_LINK_LIBRARIES(${NAME} PRIVATE ${PROJECT_NAME} Boost::unit_test_framework)
ENDMACRO(DYNAMIC_GRAPH_TEST)
# Signal cast test.
......
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