From 0f3c1c501e688721ccef0ed8b4fe4809590634cc Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Tue, 16 Feb 2016 20:48:37 +0100 Subject: [PATCH] Allow dynamic linkage of Boost using -DBoost_USE_STATIC_LIBS=off --- utils.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils.cmake b/utils.cmake index 9c037dd7..1003d196 100644 --- a/utils.cmake +++ b/utils.cmake @@ -40,7 +40,14 @@ endfunction(target_enable_style_warnings) ################################################## function(target_add_boost TARGET) # 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 REQUIRED COMPONENTS ${ARGN})