I'm writing a single threaded application. I use CMake to compile it. My application is being written in C++ using Boost. When run 'make' linking of my application fails with following error message:
Linking CXX executable whisk
cd <project>/build/src && /usr/bin/cmake -E cmake_link_script CMakeFiles/whisk.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/whisk.dir/driver_simdag.cpp.o CMakeFiles/whisk.dir/whisk.cpp.o CMakeFiles/whisk.dir/driver_miror.cpp.o CMakeFiles/whisk.dir/driver.cpp.o CMakeFiles/whisk.dir/main.cpp.o -o whisk -rdynamic -lboost_program_options
/usr/bin/ld: CMakeFiles/whisk.dir/whisk.cpp.o: undefined reference to symbol 'pthread_rwlock_unlock@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
This is the error itself:
undefined reference to symbol 'pthread_rwlock_unlock@@GLIBC_2.2.5'
My CMakeLists.txt from the src directory is following:
file(GLOB whisk_SRC "[a-zA-Z]*.cpp")
add_executable(whisk ${whisk_SRC})
FIND_PACKAGE( Boost 1.40 COMPONENTS program_options log REQUIRED )
set(Boost_USE_MULTITHREADED OFF)
# set_property(TARGET whisk PROPERTY Boost_USE_MULTITHREADED OFF)
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
set_property(TARGET whisk PROPERTY CXX_STANDARD 11)
set_property(TARGET whisk PROPERTY CXX_STANDARD_REQUIRED ON)
target_link_libraries(whisk ${Boost_PROGRAM_OPTIONS_LIBRARY})
install(TARGETS whisk DESTINATION bin)
How do I tell CMake and Boost that I do not pthreads at all and I want single threaded version to be compiled?