modify CMakeLists.txt

This commit is contained in:
an-tao 2018-05-03 14:17:04 +08:00
parent aba7182851
commit 3746b57bee
1 changed files with 26 additions and 10 deletions

View File

@ -2,18 +2,28 @@ cmake_minimum_required (VERSION 2.6)
project (DROGON CXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -g -ggdb")
#EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g'" OUTPUT_VARIABLE version)
#MESSAGE(STATUS "This is gcc version:: " ${version})
#if (version LESS 6.0.0)
# MESSAGE(STATUS "old gcc")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fpermissive -g -ggdb")
#else()
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fpermissive -g -ggdb")
# MESSAGE(STATUS "new gcc")
#endif()
EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g'" OUTPUT_VARIABLE version)
MESSAGE(STATUS "This is gcc version:: " ${version})
if (version LESS 6.0.0)
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)
add_definitions(-DUSE_C++17)
MESSAGE(STATUS "c++17")
endif()
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=${CMAKE_CXX_STD_FLAGS} -fpermissive -g -ggdb)
string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake_modules/)
find_package (jsoncpp REQUIRED)
@ -24,6 +34,12 @@ find_package (UUID)
if(UUID_FOUND)
add_definitions(-DUSE_UUID)
endif()
find_package(Boost)
if(BOOST_FOUND)
add_definitions(-DUSE_BOOST)
include_directories(${Boost_INCLUDE_DIRS})
endif()
add_subdirectory(trantor)
include_directories(${PROJECT_SOURCE_DIR}/trantor ${PROJECT_SOURCE_DIR}/lib/inc)