| 1 |
|
|---|
| 2 | cmake_minimum_required(VERSION 3.1)
|
|---|
| 3 | set(CMAKE_CXX_STANDARD 11)
|
|---|
| 4 | add_definitions( -Wall )
|
|---|
| 5 | add_definitions( -g )
|
|---|
| 6 |
|
|---|
| 7 | set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|---|
| 8 | find_package(Threads REQUIRED)
|
|---|
| 9 |
|
|---|
| 10 | FIND_PACKAGE( Boost 1.40 COMPONENTS program_options filesystem system thread date_time REQUIRED )
|
|---|
| 11 | INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 | # Set these in one place for other CMakeLists.txt to include
|
|---|
| 15 | set( DEP_LIBS
|
|---|
| 16 | ${Boost_LIBRARIES}
|
|---|
| 17 | ${CMAKE_THREAD_LIBS_INIT}
|
|---|
| 18 | # NOTE: project won't compile without linking librt beacuse of boost interprocess
|
|---|
| 19 | rt
|
|---|
| 20 | )
|
|---|
| 21 |
|
|---|
| 22 | set( DEP_LINK_DIRS
|
|---|
| 23 | )
|
|---|
| 24 |
|
|---|
| 25 | set( DEP_INCLUDE_DIRS
|
|---|
| 26 | ${Boost_SYSTEM_INCLUDE_DIRS}
|
|---|
| 27 | )
|
|---|
| 28 |
|
|---|
| 29 | add_executable( producer producer.cpp )
|
|---|
| 30 | target_link_libraries (
|
|---|
| 31 | producer
|
|---|
| 32 | ${DEP_LIBS}
|
|---|
| 33 | ${CMAKE_THREAD_LIBS_INIT}
|
|---|
| 34 | )
|
|---|
| 35 |
|
|---|
| 36 | add_executable( consumer consumer.cpp )
|
|---|
| 37 | target_link_libraries (
|
|---|
| 38 | consumer
|
|---|
| 39 | ${DEP_LIBS}
|
|---|
| 40 | ${CMAKE_THREAD_LIBS_INIT}
|
|---|
| 41 | )
|
|---|