Boost dynamic linking
I wonder why the Boost::dynamic_linking
defined only for MSVC. I get undefined reference on ubuntu for the following:
cmake_minimum_required(VERSION 3.1)
find_package(Boost COMPONENTS log)
add_executable(Test main.cpp)
target_link_libraries(Test Boost::log)
main.cpp
is the boost trivial logging example:
#include <boost/log/trivial.hpp>
int main(int, char*[])
{
BOOST_LOG_TRIVIAL(trace) << "A trace severity message";
BOOST_LOG_TRIVIAL(debug) << "A debug severity message";
BOOST_LOG_TRIVIAL(info) << "An informational severity message";
BOOST_LOG_TRIVIAL(warning) << "A warning severity message";
BOOST_LOG_TRIVIAL(error) << "An error severity message";
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message";
return 0;
}
Add add_definitions(-DBOOST_ALL_DYN_LINK)
to CMakeLists.txt
gets work.