Format CMakeLists.txt
This commit is contained in:
parent
a314404e89
commit
4a26730c2e
|
@ -1,26 +1,25 @@
|
||||||
cmake_minimum_required (VERSION 2.6)
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
|
||||||
project (DROGON CXX)
|
project (DROGON CXX)
|
||||||
|
|
||||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g' | sed s'/-.*//g'" OUTPUT_VARIABLE version)
|
EXEC_PROGRAM (gcc ARGS "--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g' | sed s'/-.*//g'" OUTPUT_VARIABLE version)
|
||||||
MESSAGE(STATUS "This is gcc version:: " ${version})
|
MESSAGE(STATUS "This is gcc version:: " ${version})
|
||||||
if(version LESS 4.8.5)
|
if(version LESS 4.8.5)
|
||||||
MESSAGE(STATUS "gcc is too old")
|
MESSAGE(STATUS "gcc is too old")
|
||||||
stop()
|
stop()
|
||||||
elseif (version LESS 6.1.0)
|
elseif (version LESS 6.1.0)
|
||||||
MESSAGE(STATUS "c++11")
|
MESSAGE(STATUS "c++11")
|
||||||
set(CMAKE_CXX_STD_FLAGS c++11)
|
set(CMAKE_CXX_STD_FLAGS c++11)
|
||||||
elseif(version LESS 7.1.0)
|
elseif(version LESS 7.1.0)
|
||||||
set(CMAKE_CXX_STD_FLAGS c++14)
|
set(CMAKE_CXX_STD_FLAGS c++14)
|
||||||
MESSAGE(STATUS "c++14")
|
MESSAGE(STATUS "c++14")
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_STD_FLAGS c++17)
|
set(CMAKE_CXX_STD_FLAGS c++17)
|
||||||
#add_definitions(-DUSE_STD_ANY)
|
#add_definitions(-DUSE_STD_ANY)
|
||||||
set(DR_DEFS "USE_STD_ANY")
|
set(DR_DEFS "USE_STD_ANY")
|
||||||
MESSAGE(STATUS "c++17")
|
MESSAGE(STATUS "c++17")
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
set(CMAKE_CXX_STD_FLAGS c++11)
|
set(CMAKE_CXX_STD_FLAGS c++11)
|
||||||
endif()
|
endif()
|
||||||
|
@ -31,28 +30,28 @@ find_package (Jsoncpp REQUIRED)
|
||||||
include_directories(${JSONCPP_INCLUDE_DIRS})
|
include_directories(${JSONCPP_INCLUDE_DIRS})
|
||||||
#message(STATUS ${JSONCPP_LIBRARIES})
|
#message(STATUS ${JSONCPP_LIBRARIES})
|
||||||
if(NOT EXISTS ${JSONCPP_INCLUDE_DIRS}/json/version.h)
|
if(NOT EXISTS ${JSONCPP_INCLUDE_DIRS}/json/version.h)
|
||||||
message(STATUS "jsoncpp lib is too old.....stop")
|
message(STATUS "jsoncpp lib is too old.....stop")
|
||||||
stop()
|
stop()
|
||||||
endif()
|
endif()
|
||||||
EXEC_PROGRAM(cat ARGS "${JSONCPP_INCLUDE_DIRS}/json/version.h |grep JSONCPP_VERSION_STRING|sed s'/.*define/define/'|awk '{printf $3}'|sed s'/\"//g'" OUTPUT_VARIABLE jsoncpp_ver)
|
EXEC_PROGRAM(cat ARGS "${JSONCPP_INCLUDE_DIRS}/json/version.h |grep JSONCPP_VERSION_STRING|sed s'/.*define/define/'|awk '{printf $3}'|sed s'/\"//g'" OUTPUT_VARIABLE jsoncpp_ver)
|
||||||
message(STATUS "jsoncpp verson:" ${jsoncpp_ver})
|
message(STATUS "jsoncpp verson:" ${jsoncpp_ver})
|
||||||
if(jsoncpp_ver LESS 1.7)
|
if(jsoncpp_ver LESS 1.7)
|
||||||
MESSAGE(STATUS "jsoncpp lib is too old,please get new version from https://github.com/open-source-parsers/jsoncpp")
|
MESSAGE(STATUS "jsoncpp lib is too old,please get new version from https://github.com/open-source-parsers/jsoncpp")
|
||||||
stop()
|
stop()
|
||||||
endif()
|
endif()
|
||||||
find_package (UUID REQUIRED)
|
find_package (UUID REQUIRED)
|
||||||
|
|
||||||
find_package (OpenSSL REQUIRED)
|
find_package (OpenSSL REQUIRED)
|
||||||
if(OpenSSL_FOUND)
|
if(OpenSSL_FOUND)
|
||||||
#add_definitions(-DUSE_OPENSSL)
|
#add_definitions(-DUSE_OPENSSL)
|
||||||
set(DR_DEFS "USE_OPENSSL;${DR_DEFS}")
|
set(DR_DEFS "USE_OPENSSL;${DR_DEFS}")
|
||||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||||
endif()
|
endif()
|
||||||
message(STATUS "openssl inc path:" ${OPENSSL_INCLUDE_DIR})
|
message(STATUS "openssl inc path:" ${OPENSSL_INCLUDE_DIR})
|
||||||
|
|
||||||
find_package(Boost)
|
find_package(Boost)
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
# add_definitions(-DUSE_BOOST)
|
# add_definitions(-DUSE_BOOST)
|
||||||
set(DR_DEFS "USE_BOOST;${DR_DEFS}")
|
set(DR_DEFS "USE_BOOST;${DR_DEFS}")
|
||||||
include_directories(${Boost_INCLUDE_DIRS})
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
endif()
|
endif()
|
||||||
|
@ -124,7 +123,7 @@ file(APPEND "${CONFIG_HEADER}" "\n" "const char compileFlags[]=\"" ${CMAKE_CXX_F
|
||||||
get_target_property(INS drogon INCLUDE_DIRECTORIES)
|
get_target_property(INS drogon INCLUDE_DIRECTORIES)
|
||||||
file(APPEND "${CONFIG_HEADER}" "\nconst char includeDirs[]=\"")
|
file(APPEND "${CONFIG_HEADER}" "\nconst char includeDirs[]=\"")
|
||||||
foreach(loop_var ${INS})
|
foreach(loop_var ${INS})
|
||||||
file(APPEND "${CONFIG_HEADER}" "-I" ${loop_var} " ")
|
file(APPEND "${CONFIG_HEADER}" "-I" ${loop_var} " ")
|
||||||
endforeach(loop_var)
|
endforeach(loop_var)
|
||||||
file(APPEND "${CONFIG_HEADER}" "\";\n")
|
file(APPEND "${CONFIG_HEADER}" "\";\n")
|
||||||
EXEC_PROGRAM(${PROJECT_SOURCE_DIR}/update_config.sh ARGS "${CONFIG_HEADER} ${PROJECT_SOURCE_DIR}/lib/inc/drogon/config.h")
|
EXEC_PROGRAM(${PROJECT_SOURCE_DIR}/update_config.sh ARGS "${CONFIG_HEADER} ${PROJECT_SOURCE_DIR}/lib/inc/drogon/config.h")
|
||||||
|
|
Loading…
Reference in New Issue