@@ -69,30 +69,6 @@ if(MSVC)
6969 set (CMAKE_MSVC_RUNTIME_LIBRARY
7070 "MultiThreaded$<$<CONFIG :Debug >:Debug >$<$<BOOL :${MSVC_LINK_DYNAMIC_RUNTIME} >:DLL >" )
7171
72- # link against static boost libraries
73- if (NOT DEFINED Boost_USE_STATIC_LIBS)
74- if (BUILD_SHARED_LIBS )
75- set (Boost_USE_STATIC_LIBS 0)
76- else ()
77- set (Boost_USE_STATIC_LIBS 1)
78- endif ()
79- endif ()
80-
81- # Boost static runtime ON for MSVC
82- if (NOT DEFINED Boost_USE_STATIC_RUNTIME)
83- if (BUILD_SHARED_LIBS OR (MSVC AND MSVC_LINK_DYNAMIC_RUNTIME))
84- set (Boost_USE_STATIC_RUNTIME 0)
85- else ()
86- set (Boost_USE_STATIC_RUNTIME 1)
87- endif ()
88- endif ()
89-
90-
91-
92- IF (NOT Boost_USE_STATIC_LIBS)
93- add_definitions (-DBOOST_ALL_DYN_LINK )
94- add_definitions (-DBOOST_TEST_DYN_LINK )
95- endif ()
9672 add_compile_options (/external:env:BOOST )
9773 add_compile_options (/external:W0 )
9874 add_compile_definitions (_SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING )
@@ -137,9 +113,8 @@ else()
137113 set (BUILD_SHARED_LIBS ON )
138114 endif ()
139115
140- # link against dynamic boost libraries
141- add_definitions (-DBOOST_ALL_DYN_LINK )
142- add_definitions (-DBOOST_TEST_DYN_LINK )
116+ # Issue with Boost CMake finder introduced in version 1.70
117+ set (Boost_NO_BOOST_CMAKE ON )
143118
144119 # avoid a crash in valgrind that sometimes occurs if this flag is not defined
145120 add_definitions (-DBOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS )
@@ -196,8 +171,33 @@ else()
196171 # if QuantLib is build separately
197172 include_directories ("${CMAKE_CURRENT_LIST_DIR} /../QuantLib/build" )
198173
174+ endif ()
199175
176+ # Boost #
177+ # link against static boost libraries
178+ if (NOT DEFINED Boost_USE_STATIC_LIBS)
179+ if (BUILD_SHARED_LIBS )
180+ set (Boost_USE_STATIC_LIBS OFF )
181+ else ()
182+ set (Boost_USE_STATIC_LIBS ON )
183+ endif ()
184+ endif ()
185+
186+ # Boost static runtime. ON for MSVC
187+ if (NOT DEFINED Boost_USE_STATIC_RUNTIME)
188+ if (BUILD_SHARED_LIBS OR (MSVC AND MSVC_LINK_DYNAMIC_RUNTIME))
189+ set (Boost_USE_STATIC_RUNTIME OFF )
190+ else ()
191+ set (Boost_USE_STATIC_RUNTIME ON )
192+ endif ()
193+ endif ()
194+
195+ if (NOT Boost_USE_STATIC_LIBS)
196+ # link against dynamic boost libraries
197+ add_definitions (-DBOOST_ALL_DYN_LINK )
198+ add_definitions (-DBOOST_TEST_DYN_LINK )
200199endif ()
200+ # Boost end #
201201
202202# workaround when building with boost 1.81, see https://github.com/boostorg/phoenix/issues/111
203203add_definitions (-DBOOST_PHOENIX_STL_TUPLE_H_ )
0 commit comments