Add CXX_STD for cmake to specific c++ standard, c++14,17 should be compile

This commit is contained in:
halx99 2020-08-18 11:41:42 +08:00
parent d6e9427e61
commit 4ff14cbf3a
1 changed files with 8 additions and 1 deletions

View File

@ -57,10 +57,17 @@ define_property(TARGET
FULL_DOCS "use to save depend libs of cocos2d lua project" 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 # check c++ standard
set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON) 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_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)