cppcheck/cmake/cxx11.cmake
Oliver Stöneberg e8b0f12367
replaced if(MATCHES) with if(STREQUAL) (#4263)
`MATCHES` does regular expression matching which is not the intended behavior here. `Clang` still requires it since it also needs to match `AppleClang.
2022-07-11 10:46:18 +02:00

16 lines
509 B
CMake

macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif ()
else ()
set (CMAKE_CXX_STANDARD 11 CACHE STRING "C++ standard to use")
set (CMAKE_CXX_STANDARD_REQUIRED ON)
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif ()
endif ()
endmacro(use_cxx11)