Add -allowAppleClang option to bootstrap.sh. (fixes #4698) (#5915)

* Add -allowAppleClang option to bootstrap.sh. (fixes #4698)

* [vcpkg-bootstrap] Simplify appleclang changes and reformat

* [vcpkg-bootstrap] Remove enviroment variable VCPKG_ALLOW_APPLE_CLANG
This commit is contained in:
soroshsabz 2019-04-11 12:02:03 +04:30 committed by Robert Schumacher
parent b625cbf82f
commit 246bd61ba1
2 changed files with 8 additions and 2 deletions

View File

@ -2,12 +2,15 @@
vcpkgDisableMetrics="OFF"
vcpkgUseSystem=false
vcpkgAllowAppleClang=OFF
for var in "$@"
do
if [ "$var" = "-disableMetrics" -o "$var" = "--disableMetrics" ]; then
vcpkgDisableMetrics="ON"
elif [ "$var" = "-useSystemBinaries" -o "$var" = "--useSystemBinaries" ]; then
vcpkgUseSystem=true
elif [ "$var" = "-allowAppleClang" -o "$var" = "--allowAppleClang" ]; then
vcpkgAllowAppleClang=ON
elif [ "$var" = "-help" -o "$var" = "--help" ]; then
echo "Usage: ./bootstrap-vcpkg.sh [options]"
echo
@ -15,6 +18,7 @@ do
echo " -help Display usage help"
echo " -disableMetrics Do not build metrics reporting into the executable"
echo " -useSystemBinaries Force use of the system utilities for building vcpkg"
echo " -allowAppleClang Set VCPKG_ALLOW_APPLE_CLANG to build vcpkg in apple with clang anyway"
exit 1
else
echo "Unknown argument $var. Use '-help' for help."
@ -234,7 +238,7 @@ buildDir="$vcpkgRootDir/toolsrc/build.rel"
rm -rf "$buildDir"
mkdir -p "$buildDir"
(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics") || exit 1
(cd "$buildDir" && CXX=$CXX "$cmakeExe" .. -DCMAKE_BUILD_TYPE=Release -G "Ninja" "-DCMAKE_MAKE_PROGRAM=$ninjaExe" "-DDEFINE_DISABLE_METRICS=$vcpkgDisableMetrics" "-DVCPKG_ALLOW_APPLE_CLANG=$vcpkgAllowAppleClang") || exit 1
(cd "$buildDir" && "$cmakeExe" --build .) || exit 1
rm -rf "$vcpkgRootDir/vcpkg"

View File

@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.3)
project(vcpkg C CXX)
OPTION(DEFINE_DISABLE_METRICS "Option for disabling metrics" OFF)
OPTION(VCPKG_ALLOW_APPLE_CLANG "Option for allowing apple clang" OFF)
if(CMAKE_COMPILER_IS_GNUXX OR CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(GCC 1)
@ -11,7 +13,7 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
"Building the vcpkg tool requires support for the C++ Filesystem TS.
Apple clang versions 9 and below do not have support for it.
Please install gcc6 or newer from homebrew (brew install gcc6).
If you would like to try anyway, set VCPKG_ALLOW_APPLE_CLANG.")
If you would like to try anyway, pass --allowAppleClang to bootstrap.sh.")
else()
set(CLANG 1)
endif()