Update CMakeLists.txt
This commit is contained in:
parent
c1c0170c63
commit
868ac73345
|
@ -7,21 +7,16 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
|||
if(version LESS 4.9.0)
|
||||
MESSAGE(STATUS "gcc is too old")
|
||||
stop()
|
||||
endif()
|
||||
include(CheckCXXCompilerFlag)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++14" COMPILER_SUPPORTS_CXX14)
|
||||
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
|
||||
if(COMPILER_SUPPORTS_CXX17)
|
||||
message(STATUS "support c++17")
|
||||
elseif (version LESS 6.1.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)
|
||||
set(DR_DEFS "USE_STD_ANY")
|
||||
elseif(COMPILER_SUPPORTS_CXX14)
|
||||
message(STATUS "support c++14")
|
||||
set(CMAKE_CXX_STD_FLAGS c++14)
|
||||
elseif(COMPILER_SUPPORTS_CXX11)
|
||||
message(STATUS "support c++11")
|
||||
set(CMAKE_CXX_STD_FLAGS c++11)
|
||||
MESSAGE(STATUS "c++17")
|
||||
endif()
|
||||
else()
|
||||
set(CMAKE_CXX_STD_FLAGS c++11)
|
||||
|
|
|
@ -28,31 +28,28 @@ static void newCmakeFile(std::ofstream &cmakeFile,const std::string &projectName
|
|||
"if(OpenSSL_FOUND)\n"
|
||||
"link_libraries(ssl crypto)\n"
|
||||
"endif()\n"
|
||||
"\n"
|
||||
"IF (CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n"
|
||||
" EXEC_PROGRAM (gcc ARGS \"--version | grep '^gcc'|awk '{print $3}' | sed s'/)//g' | sed s'/-.*//g'\" OUTPUT_VARIABLE version)\n"
|
||||
" MESSAGE(STATUS \"This is gcc version:: \" ${version})\n"
|
||||
" if(version LESS 4.9.0)\n"
|
||||
" MESSAGE(STATUS \"gcc is too old\")\n"
|
||||
" stop()\n"
|
||||
" endif()\n"
|
||||
" include(CheckCXXCompilerFlag)\n"
|
||||
" CHECK_CXX_COMPILER_FLAG(\"-std=c++11\" COMPILER_SUPPORTS_CXX11)\n"
|
||||
" CHECK_CXX_COMPILER_FLAG(\"-std=c++14\" COMPILER_SUPPORTS_CXX14)\n"
|
||||
" CHECK_CXX_COMPILER_FLAG(\"-std=c++17\" COMPILER_SUPPORTS_CXX17)\n"
|
||||
" if(COMPILER_SUPPORTS_CXX17)\n"
|
||||
" message(STATUS \"support c++17\")\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++17)\n"
|
||||
" set(DEFS \"USE_STD_ANY\")\n"
|
||||
" elseif(COMPILER_SUPPORTS_CXX14)\n"
|
||||
" message(STATUS \"support c++14\")\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++14)\n"
|
||||
" elseif(COMPILER_SUPPORTS_CXX11)\n"
|
||||
" message(STATUS \"support c++11\")\n"
|
||||
" elseif (version LESS 6.1.0)\n"
|
||||
" MESSAGE(STATUS \"c++11\")\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++11)\n"
|
||||
" elseif(version LESS 7.1.0)\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++14)\n"
|
||||
" MESSAGE(STATUS \"c++14\")\n"
|
||||
" else()\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++17)\n"
|
||||
" set(DR_DEFS \"USE_STD_ANY\")\n"
|
||||
" MESSAGE(STATUS \"c++17\")\n"
|
||||
" endif()\n"
|
||||
"else()\n"
|
||||
" set(CMAKE_CXX_STD_FLAGS c++11)\n"
|
||||
"endif()\n"
|
||||
"\n"
|
||||
"if(CMAKE_BUILD_TYPE STREQUAL \"\")\n"
|
||||
" set(CMAKE_BUILD_TYPE Release)\n"
|
||||
"endif()\n"
|
||||
|
|
Loading…
Reference in New Issue