Skip to content

Instantly share code, notes, and snippets.

@doug65536
Last active December 20, 2015 10:59
Show Gist options
  • Save doug65536/6119730 to your computer and use it in GitHub Desktop.
Save doug65536/6119730 to your computer and use it in GitHub Desktop.
cmake producer consumer test
cmake_minimum_required(VERSION 2.8)
project(producerconsumer)
set(SRC
main.cpp
util_pcqueue.h
)
if(CMAKE_COMPILER_IS_GNUCXX )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -pthread")
else()
message(FATAL "Unsupported compiler")
endif()
add_executable(test_pc_std ${SRC})
find_package(Boost COMPONENTS thread REQUIRED)
if(Boost_FOUND)
add_definitions(${Boost_DEFINES} -DWITH_BOOST)
include_directories(${Boost_INCLUDE_DIRS})
link_directories(${Boost_LIBRARY_DIRS})
add_executable(test_pc_boost ${SRC})
target_link_libraries(test_pc_boost ${Boost_LIBRARIES})
message(STATUS "boost defines: ${Boost_DEFINES}")
message(STATUS "boost include dirs: ${Boost_INCLUDE_DIRS}")
message(STATUS "boost library dirs: ${Boost_LIBRARY_DIRS}")
message(STATUS "boost libraries: ${Boost_LIBRARIES}")
endif()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment