Skip to content

Commit

Permalink
chore: add optional dynamic linking to boost::log
Browse files Browse the repository at this point in the history
When building boost as a dynamic library, during linking, hundreds of
`undefined reference to `boost::log` errors occure. As the default behavior
currently is to statically link against boost::log, it is best to add a new
option that explicitly enables dynamically linking to boost::log. This new
option is called MENDER_USE_DYNAMIC_BOOST_LOG.

Signed-off-by: Adam Duskett <aduskett@gmail.com>
  • Loading branch information
aduskett committed Sep 9, 2024
1 parent a16c5e8 commit 853c786
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/common/cmake/boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
find_package(Boost 1.74 COMPONENTS log)

option(MENDER_DOWNLOAD_BOOST "Download Boost if it is not found (Default: OFF)" OFF)
option(MENDER_USE_DYNAMIC_BOOST_LOG "Link dynamically to boost::log (Default: OFF)" OFF)
if(MENDER_USE_DYNAMIC_BOOST_LOG)
ADD_DEFINITIONS(-DBOOST_LOG_DYN_LINK)
endif()

if(NOT MENDER_DOWNLOAD_BOOST AND NOT ${Boost_FOUND})
message(FATAL_ERROR
Expand Down

0 comments on commit 853c786

Please sign in to comment.