diff options
author | Ray Molenkamp <github@lazydodo.com> | 2019-10-01 21:36:11 +0300 |
---|---|---|
committer | Ray Molenkamp <github@lazydodo.com> | 2019-10-01 21:36:11 +0300 |
commit | 34bd23dbb71b2f8bfc696acf5107650bd750364d (patch) | |
tree | 038dc3019c13624eb83918f6f0abd1242137fa5f /CMakeLists.txt | |
parent | c06350d8a79fa1bfeda0772d683cb91218ea3cb7 (diff) |
MSVC: Support Building clang+ninja+VS2019
1) Clang was given the wrong VS version to emulate when used in
combination with VS2019 causing build issues.
2) The erroneous supplied parameter `-std::c++11`caused CMake to
fail running its compiler detection scripts.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 258e79b7d4a..cddb93dd7ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1610,15 +1610,19 @@ if(WITH_PYTHON) endif() endif() -if( +if(MSVC) + # MSVC needs to be tested first, since clang on windows will + # match the compiler test below but clang-cl does not accept -std=c++11 + # since it is on by default and cannot be turned off. + # + # Nothing special is needed, C++11 features are available by default. +elseif( CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Intel" ) # TODO(sergey): Do we want c++11 or gnu-c++11 here? set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -elseif(MSVC) - # Nothing special is needed, C++11 features are available by default. else() message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build") endif() |