diff --git a/ecl_build/cmake/ecl_cx11.cmake b/ecl_build/cmake/ecl_cx11.cmake index 67d8b99..2d00133 100644 --- a/ecl_build/cmake/ecl_cx11.cmake +++ b/ecl_build/cmake/ecl_cx11.cmake @@ -26,20 +26,32 @@ endmacro() # # Note, there are better ways of doing this in 3.1+. macro(ecl_enable_cxx11_compiler) - ecl_check_for_cxx11_compiler(CXX11_COMPILER_FOUND) - if(CXX11_COMPILER_FOUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + if (MSVC) + if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + endif() else() - message(FATAL_ERROR "Requested cxx11 flags, but this compiler does not support it.") + ecl_check_for_cxx11_compiler(CXX11_COMPILER_FOUND) + if(CXX11_COMPILER_FOUND) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + else() + message(FATAL_ERROR "Requested cxx11 flags, but this compiler does not support it.") + endif() endif() endmacro() macro(ecl_enable_cxx0x_compiler) - ecl_check_for_cxx0x_compiler(CXX0X_COMPILER_FOUND) - if(CXX0X_COMPILER_FOUND) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + if (MSVC) + if(NOT CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) + endif() else() - message(FATAL_ERROR "Requested cxx0x flags, but this compiler does not support it.") + ecl_check_for_cxx0x_compiler(CXX0X_COMPILER_FOUND) + if(CXX0X_COMPILER_FOUND) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + else() + message(FATAL_ERROR "Requested cxx0x flags, but this compiler does not support it.") + endif() endif() endmacro()