Ticket #12476: CMakeLists.txt

File CMakeLists.txt, 896 bytes (added by Chris Evans <chris.evans@…>, 6 years ago)
Line 
1
2cmake_minimum_required(VERSION 3.1)
3set(CMAKE_CXX_STANDARD 11)
4add_definitions( -Wall )
5add_definitions( -g )
6
7set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
8find_package(Threads REQUIRED)
9
10FIND_PACKAGE( Boost 1.40 COMPONENTS program_options filesystem system thread date_time REQUIRED )
11INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIR} )
12
13
14# Set these in one place for other CMakeLists.txt to include
15set( 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
29add_executable( producer producer.cpp )
30target_link_libraries (
31 producer
32 ${DEP_LIBS}
33 ${CMAKE_THREAD_LIBS_INIT}
34)
35
36add_executable( consumer consumer.cpp )
37target_link_libraries (
38 consumer
39 ${DEP_LIBS}
40 ${CMAKE_THREAD_LIBS_INIT}
41)