[vcpkg] Hopefully fix build on macOS 10.13/10.14 (#11205)

This commit is contained in:
nicole mazzuca 2020-05-11 16:31:04 -07:00 committed by GitHub
parent 09b769bf5e
commit 6c159b7766
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,26 +3,35 @@ function(vcpkg_detect_compiler)
if(NOT DEFINED CACHE{VCPKG_COMPILER}) if(NOT DEFINED CACHE{VCPKG_COMPILER})
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0) if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)
message(FATAL_ERROR message(FATAL_ERROR [[
"The g++ version picked up is too old; please install a newer compiler such as g++-7. The g++ version picked up is too old; please install a newer compiler such as g++-7.
On Ubuntu try the following: On Ubuntu try the following:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update -y sudo apt-get update -y
sudo apt-get install g++-7 -y sudo apt-get install g++-7 -y
On CentOS try the following: On CentOS try the following:
sudo yum install centos-release-scl sudo yum install centos-release-scl
sudo yum install devtoolset-7 sudo yum install devtoolset-7
scl enable devtoolset-7 bash") scl enable devtoolset-7 bash
]])
endif() endif()
set(COMPILER "gcc") set(COMPILER "gcc")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "11.0.0" AND NOT VCPKG_ALLOW_APPLE_CLANG) #[[
message(FATAL_ERROR Note: CMAKE_SYSTEM_VERSION uses darwin versions
"Building the vcpkg tool requires support for the C++ Filesystem TS. - Darwin 19.0.0 = macOS 10.15, iOS 13
Apple clang versions 10.01 and below do not have support for it. - Darwin 18.0.0 = macOS 10.14, iOS 12
Please install gcc6 or newer from homebrew (brew install gcc). - Darwin 17.0.0 = macOS 10.13, iOS 11
If you would like to try anyway, pass --allowAppleClang to bootstrap.sh.") - Darwin 16.0.0 = macOS 10.12, iOS 10
]]
if(CMAKE_SYSTEM_VERSION VERSION_LESS "19.0.0" AND NOT VCPKG_ALLOW_APPLE_CLANG)
message(FATAL_ERROR [[
Building the vcpkg tool requires support for the C++ Filesystem TS.
macOS versions below 10.15 do not have support for it with Apple Clang.
Please install gcc6 or newer from homebrew (brew install gcc).
If you would like to try anyway, pass --allowAppleClang to bootstrap.sh.
]])
endif() endif()
set(COMPILER "clang") set(COMPILER "clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang") elseif(CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
@ -48,26 +57,29 @@ function(vcpkg_detect_standard_library)
# note: since <ciso646> is the smallest header, generally it's used to get the standard library version # note: since <ciso646> is the smallest header, generally it's used to get the standard library version
set(CMAKE_REQUIRED_QUIET ON) set(CMAKE_REQUIRED_QUIET ON)
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if !defined(__GLIBCXX__) #if !defined(__GLIBCXX__)
#error \"not libstdc++\" #error "not libstdc++"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_STANDARD_LIBRARY_LIBSTDCXX) _VCPKG_STANDARD_LIBRARY_LIBSTDCXX)
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if !defined(_LIBCPP_VERSION) #if !defined(_LIBCPP_VERSION)
#error \"not libc++\" #error "not libc++"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_STANDARD_LIBRARY_LIBCXX) _VCPKG_STANDARD_LIBRARY_LIBCXX)
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if !defined(_MSVC_STL_VERSION) #if !defined(_MSVC_STL_VERSION)
#error \"not MSVC stl\" #error "not MSVC stl"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_STANDARD_LIBRARY_MSVC_STL) _VCPKG_STANDARD_LIBRARY_MSVC_STL)
if(_VCPKG_STANDARD_LIBRARY_LIBSTDCXX) if(_VCPKG_STANDARD_LIBRARY_LIBSTDCXX)
set(STANDARD_LIBRARY "libstdc++") set(STANDARD_LIBRARY "libstdc++")
@ -98,32 +110,35 @@ function(vcpkg_detect_std_filesystem)
set(CMAKE_REQUIRED_QUIET ON) set(CMAKE_REQUIRED_QUIET ON)
if(VCPKG_STANDARD_LIBRARY STREQUAL "libstdc++") if(VCPKG_STANDARD_LIBRARY STREQUAL "libstdc++")
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 9 #if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE >= 9
#error \"libstdc++ after version 9 does not require -lstdc++fs\" #error "libstdc++ after version 9 does not require -lstdc++fs"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_REQUIRE_LINK_CXXFS) _VCPKG_REQUIRE_LINK_CXXFS)
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < 8 #if !defined(_GLIBCXX_RELEASE) || _GLIBCXX_RELEASE < 8
#error \"libstdc++ before version 8 does not support <filesystem>\" #error "libstdc++ before version 8 does not support <filesystem>"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_USE_STD_FILESYSTEM) _VCPKG_USE_STD_FILESYSTEM)
elseif(VCPKG_STANDARD_LIBRARY STREQUAL "libc++") elseif(VCPKG_STANDARD_LIBRARY STREQUAL "libc++")
if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
# AppleClang never requires (or allows) -lc++fs, even with libc++ version 8.0.0 # AppleClang never requires (or allows) -lc++fs, even with libc++ version 8.0.0
set(_VCPKG_REQUIRE_LINK_CXXFS OFF) set(_VCPKG_REQUIRE_LINK_CXXFS OFF)
else() else()
check_cxx_source_compiles( check_cxx_source_compiles([[
"#include <ciso646> #include <ciso646>
#if _LIBCPP_VERSION >= 9000 #if _LIBCPP_VERSION >= 9000
#error \"libc++ after version 9 does not require -lc++fs\" #error "libc++ after version 9 does not require -lc++fs"
#endif #endif
int main() {}" int main() {}
]]
_VCPKG_REQUIRE_LINK_CXXFS) _VCPKG_REQUIRE_LINK_CXXFS)
endif() endif()