From 23d644e7661a09f13fd90b6836b0a1361e5a5d89 Mon Sep 17 00:00:00 2001 From: Xie Han <63350856@qq.com> Date: Wed, 17 Jul 2024 16:12:42 +0800 Subject: [PATCH] Update C++ standard to c++14. --- src/CMakeLists.txt | 2 +- test/CMakeLists.txt | 17 +---------------- tutorial/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b47ee69..7c2d5b3b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,7 +60,7 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /Zc:__cplusplus /std:c++14") else () set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe -std=gnu90") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++11 -fno-exceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++14 -fno-exceptions") endif () add_subdirectory(generator) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6d35c10d..82a2252c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -68,22 +68,7 @@ else () find_package(GTest REQUIRED) endif () -set(CXX_STD "c++11") -if (GTest_VERSION VERSION_GREATER_EQUAL "1.13.0") - set(CXX_STD "c++14") -else () - get_filename_component(GTEST_PATH ${GTEST_LIBRARY} DIRECTORY ABSOLUTE) - execute_process(COMMAND grep Version "${GTEST_PATH}/pkgconfig/gtest.pc" - RESULT_VARIABLE GTEST_VERSION_RESULT - OUTPUT_VARIABLE GTEST_VERSION_OUTPUT) - if (${GTEST_VERSION_RESULT} EQUAL "0") - string(REPLACE " " ";" GTEST_VERSION_STR ${GTEST_VERSION_OUTPUT}) - list(GET GTEST_VERSION_STR 1 GTEST_VERSION) - if (${GTEST_VERSION} VERSION_GREATER_EQUAL "1.13.0") - set(CXX_STD "c++14") - endif () - endif () -endif () +set(CXX_STD "c++14") if (WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP /wd4200") diff --git a/tutorial/CMakeLists.txt b/tutorial/CMakeLists.txt index f2f8eff7..970bfb8c 100644 --- a/tutorial/CMakeLists.txt +++ b/tutorial/CMakeLists.txt @@ -107,7 +107,7 @@ if (WIN32) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /wd4200 /Zc:__cplusplus /std:c++14") else () set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -fPIC -pipe -std=gnu90") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++11 -fno-exceptions") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -pipe -std=c++14 -fno-exceptions") endif () set(TUTORIAL_PB_LIST