Allow dynamic linkage of Boost using -DBoost_USE_STATIC_LIBS=off

This commit is contained in:
Sebastian Messmer 2016-02-16 20:48:37 +01:00
parent 0c6e341e33
commit 0f3c1c501e

View File

@ -40,7 +40,14 @@ endfunction(target_enable_style_warnings)
################################################## ##################################################
function(target_add_boost TARGET) function(target_add_boost TARGET)
# Load boost libraries # Load boost libraries
set(Boost_USE_STATIC_LIBS ON) # Many supported systems don't have boost >= 1.56. Better link it statically. if(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
# Many supported systems don't have boost >= 1.56. Better link it statically.
message(STATUS "Boost will be statically linked")
set(Boost_USE_STATIC_LIBS ON)
else(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
message(STATUS "Boost will be dynamically linked")
set(Boost_USE_STATIC_LIBS OFF)
endif(NOT DEFINED Boost_USE_STATIC_LIBS OR Boost_USE_STATIC_LIBS)
find_package(Boost 1.56.0 find_package(Boost 1.56.0
REQUIRED REQUIRED
COMPONENTS ${ARGN}) COMPONENTS ${ARGN})