Detect clangw toolset when using any clang with the ms-abi

When compiling with clang, cmake only sets MSVC when using clang-cl as
it's meant as an indication of cl.exe command line compatibility.

In this case, if one is using clang++ with the ms-abi, cmake
incorrectly takes the else branch here and library detection fails.

If instead we use MSVC_VERSION, which is empty unless a compiler
with _MSC_VER set is being used, then we get the correct behaviour.

https://cmake.org/cmake/help/latest/variable/MSVC.html

https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
This commit is contained in:
Chris Glover
2022-01-17 22:19:44 +00:00
parent f23b121b3d
commit 85cb56a87e

View File

@@ -28,7 +28,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(MSVC)
if(MSVC_VERSION)
set(BOOST_DETECTED_TOOLSET "clangw")
else()
set(BOOST_DETECTED_TOOLSET "clang")