I am compiling a simple project (shared library) using CMake, this is the content of the CMakeLists.txt
set (CMAKE_BUILD_TYPE Release)
set (LibName test)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(test CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${warnings}")
add_definitions(${GCC_NARROWING})
add_definitions(${GCC_RESOLVEALL})
add_definitions(-DTESTFRAMEWORK_GOOGLE)
add_definitions(-DVARIADIC_MAX=10)
add_definitions(-DENCODING=8)
#include_directories(${GTEST_PATH}/include)
include_directories(${BOOST_PATH}) #${BOOST_PATH} is defined by parent CMakeList
include_directories(${GTEST_PATH}/include ../../ThirdParty/rapidjson_master/include)
set (SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/Test.cpp
${CMAKE_CURRENT_SOURCE_DIR}/Test.h
)
message(${LibName})
add_library(${LibName} SHARED ${SOURCES})
target_link_libraries(${LibName}
${OUTDIR}/libboost_system.a
${OUTDIR}/libboost_thread.a
${OUTDIR}/libboost_chrono.a
)
I dont receive any error when compiling, when running the program that loads this shared library I receive:
./test.so: undefined symbol: _ZN5boost6system15system_categoryEv
The program that loads this shared library just do the following:
void *m_hTest = dlopen("./test.so", RTLD_NOW);
if (m_hTest == NULL) {
return -1;
}
The shared library uses a Thread Local Storage from Boost, inside a class one of the members is:
boost::thread_specific_ptr<TLSData> threadData;
That is the only thing I am using from boost