Skip to content
Snippets Groups Projects
Commit a1abc5ca authored by Markus Blatt's avatar Markus Blatt
Browse files

[CMake] Stops linking Boost_LIBRARIES by default (Fixes FS#1312)

Previously, when adding boost flags, we always linked all
Boost_LIBRARIES. At least for the core modules this not needed
and resulted in errors on some systems.

This patch changes the add_dune_boost_flags function. By default no
libraries are linked, but one can either provide the libraries using
the LIBRARIES option or request linkage of all boost libraries with
the LINK_ALL_BOOST_LIBRARIES option.
parent 9170fc45
Branches
Tags
No related merge requests found
# Searches for boost and provides the following function:
#
# add_dune_boost_flags(targets)
# add_dune_boost_flags(targets [LINK_ALL_BOOST_LIBRARIES]
# LIBRARIES lib1 lib2 ...)
#
# Adds boost compiler flags and libraries, and activates
# Boost for the specified targets.
# Boost for the specified targets. Libraries can either be
# provided by listing them after the LIBRARIES keyword or one
# can request linking with all available boost libraries by
# passing the LINK_ALL_BOOST_LIBRARIES option to the function
# call.
find_package(Boost)
set(HAVE_DUNE_BOOST ${Boost_FOUND})
function(add_dune_boost_flags _targets)
cmake_parse_arguments(DUNE_BOOST LINK_ALL_BOOST_LIBRARIES "" LIBRARIES ${ARGN})
if(Boost_FOUND)
include_directories("${Boost_INCLUDE_DIRS}")
foreach(_target ${_targets})
target_link_libraries(${_target} ${Boost_LIBRARIES})
if(DUNE_BOOST_LINK_ALL_BOOST_LIBRARIES)
target_link_libraries(${_target} "${DUNE_Boost_LIBRARIES}")
else(DUNE_BOOST_LINK_ALL_BOOST_LIBRARIES)
target_link_libraries(${_target} "${DUNE_BOOST_LIBRARIES}")
endif(DUNE_BOOST_LINK_ALL_BOOST_LIBRARIES)
# The definitions are a hack as we do not seem to know which MPI implementation was
# found.
GET_TARGET_PROPERTY(_props ${_target} COMPILE_FLAGS)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment