Command line warning D9002: ignoring unknown option '-std=c++11'

The -std=c++11 option is for GCC/CLang only, it is not available in Visual Studio. C++ 11 support in Visual Studio should be turned on by default. So, you should use this option for GCC-like compilers only:

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()

If you are using the latest versions of CMake you might try to use new compiler features mechanism : http://www.cmake.org/cmake/help/v3.1/manual/cmake-compile-features.7.html


Microsoft Visual Studio Compiler (MSVC) has it own set of compiler flags. In short: The solution to fix the issue is to use following command instead the one you have used.

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")