@@ -25,6 +25,7 @@ option(LSL_BUILD_STATIC "Build LSL as static library." OFF)
2525option (LSL_LEGACY_CPP_ABI "Build legacy C++ ABI into lsl-static" OFF )
2626option (LSL_OPTIMIZATIONS "Enable some more compiler optimizations" ON )
2727option (LSL_UNITTESTS "Build LSL library unit tests" OFF )
28+ option (LSL_BUNDLED_BOOST "Use the bundled Boost by default" ON )
2829option (LSL_BUNDLED_PUGIXML "Use the bundled pugixml by default" ON )
2930option (LSL_SLIMARCHIVE "Use experimental but smaller serialization code" OFF )
3031
@@ -165,26 +166,33 @@ set_source_files_properties("thirdparty/loguru/loguru.cpp"
165166find_package (Threads REQUIRED)
166167
167168# create the lslboost target
168- add_library (lslboost OBJECT
169- lslboost/serialization_objects.cpp
170- )
171- target_link_libraries (lslboost PUBLIC Threads::Threads)
169+ add_library (lslboost INTERFACE )
170+ if (LSL_BUNDLED_BOOST)
171+ message (STATUS "Using bundled Boost" )
172+ target_include_directories (lslboost SYSTEM INTERFACE
173+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /lslboost>)
174+ else ()
175+ message (STATUS "Using system Boost" )
176+ find_package (Boost REQUIRED)
177+ target_compile_definitions (lslboost
178+ INTERFACE
179+ lslboost=boost # allows the LSL code base to work with the original Boost namespace/headers
180+ )
181+ target_link_libraries (lslboost INTERFACE Boost::boost Boost::disable_autolinking)
182+ endif ()
172183
173- if (LSL_SLIMARCHIVE)
184+ if (LSL_SLIMARCHIVE OR NOT LSL_BUNDLED_BOOST )
174185 message (STATUS "Using shim instead of full Boost.Archive" )
175- target_compile_definitions (lslboost PUBLIC SLIMARCHIVE)
186+ target_compile_definitions (lslboost INTERFACE SLIMARCHIVE)
187+ elseif (LSL_BUNDLED_BOOST)
188+ # compile Boost.Serialization objects as part of lslobj
189+ target_sources (lslobj PRIVATE lslboost/serialization_objects.cpp)
176190endif ()
177- target_compile_features (lslboost PUBLIC cxx_std_11 cxx_lambda_init_captures)
178-
179- target_compile_definitions (lslboost
180- PUBLIC
181- BOOST_ALL_NO_LIB
182- )
183- target_include_directories (lslboost SYSTEM PUBLIC
184- $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /lslboost>)
191+ target_compile_definitions (lslboost INTERFACE BOOST_ALL_NO_LIB)
185192
186193# target configuration for the internal lslobj target
187- target_link_libraries (lslobj PRIVATE lslboost)
194+ target_link_libraries (lslobj PRIVATE lslboost Threads::Threads)
195+ target_compile_features (lslobj PUBLIC cxx_std_11 cxx_lambda_init_captures)
188196target_include_directories (lslobj
189197 PUBLIC
190198 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR} /include >
0 commit comments