mardi 17 novembre 2020

Can't set c++ version in CMake [duplicate]

I'm trying to set the C++ version to 11 with cmake, but despite trying multiple methods it just doesn't seem to do anything. I've reduce the issue down to 2 files: CMakeLists.txt

cmake_minimum_required(VERSION 3.17.0)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(test)
add_executable(${CMAKE_PROJECT_NAME} test.cpp)

test.cpp

#if __cplusplus < 201103L
#error not c++ 11
#endif

I'm running CMake version 3.17.20032601-MSVC_2, from the CMake extension in visual studio code.

Aucun commentaire:

Enregistrer un commentaire