Skip to content

Instantly share code, notes, and snippets.

@FONQRI
Last active June 25, 2018 14:57
Show Gist options
  • Save FONQRI/17ca8676d7b1f9a199dc89195ff4834a to your computer and use it in GitHub Desktop.
Save FONQRI/17ca8676d7b1f9a199dc89195ff4834a to your computer and use it in GitHub Desktop.
Sample Boost Cmake
cmake_minimum_required(VERSION 2.8.12)
project(UCCP_Server_Boost)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
include_directories(./src)
#seting file pathes
file(GLOB Headers ./src/*.h)
file(GLOB Cpp ./src/*.cpp)
#library
add_library(Server
${Headers}
${Cpp}
)
set (CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++14 -D__STRICT_ANSI__")
find_package (Threads)
find_package(Boost 1.58 REQUIRED COMPONENTS
date_time
filesystem
iostreams
thread)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} "posix_main.cpp" )
target_link_libraries(${PROJECT_NAME}
Boost::date_time
Boost::filesystem
Boost::iostreams
Boost::thread
${CMAKE_THREAD_LIBS_INIT}
Server
)
endif(Boost_FOUND)
set(Boost_USE_STATIC_LIBS ON) # only find static libs
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment