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:
@@ -1610,15 +1610,19 @@ if(WITH_PYTHON)
|
|||||||
endif()
|
endif()
|
||||||
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_COMPILER_IS_GNUCC OR
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
|
CMAKE_C_COMPILER_ID MATCHES "Clang" OR
|
||||||
CMAKE_C_COMPILER_ID MATCHES "Intel"
|
CMAKE_C_COMPILER_ID MATCHES "Intel"
|
||||||
)
|
)
|
||||||
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
|
# TODO(sergey): Do we want c++11 or gnu-c++11 here?
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
||||||
elseif(MSVC)
|
|
||||||
# Nothing special is needed, C++11 features are available by default.
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
|
message(FATAL_ERROR "Unknown compiler ${CMAKE_C_COMPILER_ID}, can't enable C++11 build")
|
||||||
endif()
|
endif()
|
||||||
|
@@ -30,9 +30,15 @@ set LLVM_DIR=
|
|||||||
:DetectionComplete
|
:DetectionComplete
|
||||||
set CC=%LLVM_DIR%\bin\clang-cl
|
set CC=%LLVM_DIR%\bin\clang-cl
|
||||||
set CXX=%LLVM_DIR%\bin\clang-cl
|
set CXX=%LLVM_DIR%\bin\clang-cl
|
||||||
|
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
|
rem build and tested against 2017 15.7
|
||||||
set CFLAGS=-m64 -fmsc-version=1914
|
set CFLAGS=-m64 -fmsc-version=1914
|
||||||
set CXXFLAGS=-m64 -fmsc-version=1914
|
set CXXFLAGS=-m64 -fmsc-version=1914
|
||||||
|
)
|
||||||
if "%WITH_ASAN%"=="1" (
|
if "%WITH_ASAN%"=="1" (
|
||||||
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
set BUILD_CMAKE_ARGS=%BUILD_CMAKE_ARGS% -DWITH_COMPILER_ASAN=On
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user