Fix CMake checks for Apple Clang 11.0 on macOS 10.15 (#8580)

* Fix CMake checks for Apple Clang 11.0 on macOS 10.15

* Use clang++ instance clang if allowAppleClang is enabled
This commit is contained in:
Joel Pelaez Jorge 2019-10-14 18:04:05 -05:00 committed by dan-shaw
parent 96e55fb3c2
commit db3e74fa9c
2 changed files with 7 additions and 3 deletions

View File

@ -244,7 +244,7 @@ else
fi fi
if [ "$os" = "osx" ]; then if [ "$os" = "osx" ]; then
if [ "$vcpkgAllowAppleClang" = "true" ] ; then if [ "$vcpkgAllowAppleClang" = "true" ] ; then
CXX=clang CXX=clang++
else else
selectCXX CXX || exit 1 selectCXX CXX || exit 1
fi fi

View File

@ -23,7 +23,11 @@ endif()
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(GCC 1) set(GCC 1)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
if(NOT VCPKG_ALLOW_APPLE_CLANG) if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11.0.0")
set(CLANG 1)
# Disable linking with libc++fs because this features are added in libc++ library
set(NO_LIBCXXFS 1)
elseif(NOT VCPKG_ALLOW_APPLE_CLANG)
message(FATAL_ERROR message(FATAL_ERROR
"Building the vcpkg tool requires support for the C++ Filesystem TS. "Building the vcpkg tool requires support for the C++ Filesystem TS.
Apple clang versions 10.01 and below do not have support for it. Apple clang versions 10.01 and below do not have support for it.
@ -58,7 +62,7 @@ endif()
if(GCC OR (CLANG AND USES_LIBSTDCXX)) if(GCC OR (CLANG AND USES_LIBSTDCXX))
link_libraries(stdc++fs) link_libraries(stdc++fs)
elseif(CLANG AND NOT MSVC) elseif(CLANG AND NOT MSVC AND NOT NO_LIBCXXFS)
link_libraries(c++fs) link_libraries(c++fs)
endif() endif()