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.
This commit is contained in:
parent
c06350d8a7
commit
34bd23dbb7
|
@ -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()
|
||||
|
|
|
@ -30,9 +30,15 @@ set LLVM_DIR=
|
|||
:DetectionComplete
|
||||
set CC=%LLVM_DIR%\bin\clang-cl
|
||||
set CXX=%LLVM_DIR%\bin\clang-cl
|
||||
rem build and tested against 2017 15.7
|
||||
set CFLAGS=-m64 -fmsc-version=1914
|
||||
set CXXFLAGS=-m64 -fmsc-version=1914
|
||||
if "%BUILD_VS_YEAR%" == "2019" (
|
||||
rem build and tested against 2019 16.2
|
||||
set CFLAGS=-m64 -fmsc-version=1922
|
||||
set CXXFLAGS=-m64 -fmsc-version=1922
|
||||
) else (
|
||||
rem build and tested against 2017 15.7
|
||||
set CFLAGS=-m64 -fmsc-version=1914
|
||||
set CXXFLAGS=-m64 -fmsc-version=1914
|
||||
)
|
||||
if "%WITH_ASAN%"=="1" (
|
||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue