From 4ff14cbf3a54e077834aba0f4be91becc65d4b76 Mon Sep 17 00:00:00 2001 From: halx99 Date: Tue, 18 Aug 2020 11:41:42 +0800 Subject: [PATCH] Add CXX_STD for cmake to specific c++ standard, c++14,17 should be compile --- cmake/Modules/CocosConfigDefine.cmake | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/CocosConfigDefine.cmake b/cmake/Modules/CocosConfigDefine.cmake index 7afec1d675..6f702d51cd 100644 --- a/cmake/Modules/CocosConfigDefine.cmake +++ b/cmake/Modules/CocosConfigDefine.cmake @@ -57,10 +57,17 @@ define_property(TARGET FULL_DOCS "use to save depend libs of cocos2d lua project" ) +if(NOT DEFINED CXX_STD) + set(CXX_STD 14) +endif() + +message(STATUS "C_STD=11") +message(STATUS "CXX_STD=${CXX_STD}") + # check c++ standard set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD ${CXX_STD}) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF)