2018-04-27 03:00:24 +00:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
project (DROGON CXX)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-03 06:17:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g'" OUTPUT_VARIABLE version)
|
|
|
|
MESSAGE(STATUS "This is gcc version:: " ${version})
|
2018-05-03 10:28:37 +00:00
|
|
|
if(version LESS 4.7.0)
|
|
|
|
MESSAGE(STATUS "gcc is too old")
|
|
|
|
stop()
|
|
|
|
elseif (version LESS 6.1.0)
|
2018-05-03 06:17:04 +00:00
|
|
|
MESSAGE(STATUS "c++11")
|
|
|
|
set(CMAKE_CXX_STD_FLAGS c++11)
|
|
|
|
elseif(version LESS 7.1.0)
|
|
|
|
set(CMAKE_CXX_STD_FLAGS c++14)
|
|
|
|
MESSAGE(STATUS "c++14")
|
|
|
|
else()
|
|
|
|
set(CMAKE_CXX_STD_FLAGS c++17)
|
2018-05-03 10:28:37 +00:00
|
|
|
add_definitions(-DUSE_STD_ANY)
|
2018-05-03 06:17:04 +00:00
|
|
|
MESSAGE(STATUS "c++17")
|
|
|
|
|
2018-05-03 10:28:37 +00:00
|
|
|
endif()
|
2018-05-03 06:17:04 +00:00
|
|
|
|
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/)
|
|
|
|
|
2018-06-03 13:29:45 +00:00
|
|
|
find_package (Jsoncpp REQUIRED)
|
2018-05-02 09:45:10 +00:00
|
|
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
|
|
|
link_directories(${JSONCPP_LIBRARY_DIRS})
|
2018-05-09 10:11:56 +00:00
|
|
|
find_package (UUID REQUIRED)
|
2018-05-03 06:17:04 +00:00
|
|
|
|
|
|
|
find_package(Boost)
|
2018-05-03 10:28:37 +00:00
|
|
|
if(Boost_FOUND)
|
2018-05-03 06:17:04 +00:00
|
|
|
add_definitions(-DUSE_BOOST)
|
|
|
|
include_directories(${Boost_INCLUDE_DIRS})
|
|
|
|
endif()
|
2018-05-03 10:28:37 +00:00
|
|
|
|
|
|
|
|
2018-05-11 01:25:17 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=${CMAKE_CXX_STD_FLAGS} -g -ggdb -Wall -fpermissive")
|
2018-05-03 10:28:37 +00:00
|
|
|
|
|
|
|
#string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
|
|
|
|
|
|
|
|
MESSAGE(STATUS ${CMAKE_CXX_FLAGS})
|
|
|
|
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-28 06:34:47 +00:00
|
|
|
|
|
|
|
add_subdirectory(trantor)
|
2018-05-02 09:45:10 +00:00
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/trantor ${PROJECT_SOURCE_DIR}/lib/inc)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-28 06:34:47 +00:00
|
|
|
add_custom_target(makeVersion)
|
|
|
|
add_custom_command(TARGET makeVersion
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/get_version.sh
|
|
|
|
ARGS ${PROJECT_SOURCE_DIR}/lib/inc/drogon/version.h
|
|
|
|
VERBATIM )
|
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
add_subdirectory(examples)
|
2018-05-28 06:34:47 +00:00
|
|
|
add_subdirectory(drogon_ctl)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
aux_source_directory(${PROJECT_SOURCE_DIR}/lib/src DIR_SRCS)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
ADD_LIBRARY(drogon ${DIR_SRCS})
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
SET(CMAKE_INSTALL_PREFIX /usr/local)
|
|
|
|
|
|
|
|
install(TARGETS drogon DESTINATION lib)
|
|
|
|
|
2018-05-02 10:28:33 +00:00
|
|
|
file(GLOB trantor_net_headers "${CMAKE_CURRENT_SOURCE_DIR}/lib/inc/drogon/*.h")
|
2018-05-02 09:45:10 +00:00
|
|
|
install(FILES ${trantor_net_headers} DESTINATION include/drogon)
|
|
|
|
|
|
|
|
add_dependencies(drogon trantor)
|
2018-05-28 06:34:47 +00:00
|
|
|
add_dependencies(drogon makeVersion)
|
2018-04-27 06:38:27 +00:00
|
|
|
|
2018-05-04 01:51:12 +00:00
|
|
|
if (MAKETEST STREQUAL YES)
|
|
|
|
ADD_SUBDIRECTORY(tests)
|
|
|
|
endif ()
|
|
|
|
|
2018-05-02 09:45:10 +00:00
|
|
|
#target_link_libraries(drogon trantor pthread)
|