cmake_minimum_required(VERSION 3.1) set(CMAKE_CXX_STANDARD 11) add_definitions( -Wall ) add_definitions( -g ) set(CMAKE_THREAD_PREFER_PTHREAD TRUE) find_package(Threads REQUIRED) FIND_PACKAGE( Boost 1.40 COMPONENTS program_options filesystem system thread date_time REQUIRED ) INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} ) # Set these in one place for other CMakeLists.txt to include set( DEP_LIBS ${Boost_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} # NOTE: project won't compile without linking librt beacuse of boost interprocess rt ) set( DEP_LINK_DIRS ) set( DEP_INCLUDE_DIRS ${Boost_SYSTEM_INCLUDE_DIRS} ) add_executable( producer producer.cpp ) target_link_libraries ( producer ${DEP_LIBS} ${CMAKE_THREAD_LIBS_INIT} ) add_executable( consumer consumer.cpp ) target_link_libraries ( consumer ${DEP_LIBS} ${CMAKE_THREAD_LIBS_INIT} )