From ef51951785a86d23ca89118dc93842a132d1b903 Mon Sep 17 00:00:00 2001 From: An Tao Date: Sat, 27 Feb 2021 17:39:13 +0800 Subject: [PATCH] Make projects created by dg_ctl support coroutines (#727) --- drogon_ctl/templates/cmake.csp | 31 ++++++++++++++++++------------- trantor | 2 +- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drogon_ctl/templates/cmake.csp b/drogon_ctl/templates/cmake.csp index 572c090b..f244b72d 100644 --- a/drogon_ctl/templates/cmake.csp +++ b/drogon_ctl/templates/cmake.csp @@ -5,11 +5,14 @@ include(CheckIncludeFileCXX) check_include_file_cxx(any HAS_ANY) check_include_file_cxx(string_view HAS_STRING_VIEW) -if(HAS_ANY AND HAS_STRING_VIEW) - set(CMAKE_CXX_STANDARD 17) -else() - set(CMAKE_CXX_STANDARD 14) -endif() +check_include_file_cxx(coroutine HAS_COROUTINE) +if (HAS_ANY AND HAS_STRING_VIEW AND HAS_COROUTINE) + set(CMAKE_CXX_STANDARD 20) +elseif (HAS_ANY AND HAS_STRING_VIEW) + set(CMAKE_CXX_STANDARD 17) +else () + set(CMAKE_CXX_STANDARD 14) +endif () set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) @@ -28,14 +31,16 @@ target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon) # ############################################################################## -if(CMAKE_CXX_STANDARD LESS 17) - # With C++14, use boost to support any and string_view - message(STATUS "use c++14") - find_package(Boost 1.61.0 REQUIRED) - target_include_directories(${PROJECT_NAME} PRIVATE ${Boost_INCLUDE_DIRS}) -else() - message(STATUS "use c++17") -endif() +if (CMAKE_CXX_STANDARD LESS 17) + # With C++14, use boost to support any and string_view + message(STATUS "use c++14") + find_package(Boost 1.61.0 REQUIRED) + target_include_directories(${PROJECT_NAME} PRIVATE ${Boost_INCLUDE_DIRS}) +elseif (CMAKE_CXX_STANDARD LESS 20) + message(STATUS "use c++17") +else () + message(STATUS "use c++20") +endif () aux_source_directory(controllers CTL_SRC) aux_source_directory(filters FILTER_SRC) diff --git a/trantor b/trantor index 6461410c..acb71c0b 160000 --- a/trantor +++ b/trantor @@ -1 +1 @@ -Subproject commit 6461410c899a7cdf083ec41c784b2beeb83c59cf +Subproject commit acb71c0beab36d5d82e09ce80b8e1593ad79c178