[bootstrap-vcpkg.sh] Test for ${CC} rather than gcc on systems using vcpkgUseSystem (#36828)

Fixes #36807
This commit is contained in:
Alonso Schaich 2024-02-27 17:41:53 +09:00 committed by GitHub
parent 77fbdaf616
commit 2004757cba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -102,20 +102,12 @@ fi
if [ "$UNAME" = "OpenBSD" ]; then
vcpkgUseSystem="ON"
if [ -z "$CXX" ]; then
CXX=/usr/bin/clang++
fi
if [ -z "$CC" ]; then
CC=/usr/bin/clang
fi
fi
if [ "$vcpkgUseSystem" = "ON" ]; then
vcpkgCheckRepoTool cmake
vcpkgCheckRepoTool ninja
vcpkgCheckRepoTool git
vcpkgCheckRepoTool gcc
fi
vcpkgCheckEqualFileHash()
@ -200,27 +192,6 @@ fi
if [ "$vcpkgDownloadTool" = "ON" ]; then
vcpkgDownloadFile "https://github.com/microsoft/vcpkg-tool/releases/download/$VCPKG_TOOL_RELEASE_TAG/$vcpkgToolName" "$vcpkgRootDir/vcpkg" $vcpkgToolReleaseSha
else
if [ "x$CXX" = "x" ]; then
if which g++-12 >/dev/null 2>&1; then
CXX=g++-12
elif which g++-11 >/dev/null 2>&1; then
CXX=g++-11
elif which g++-10 >/dev/null 2>&1; then
CXX=g++-10
elif which g++-9 >/dev/null 2>&1; then
CXX=g++-9
elif which g++-8 >/dev/null 2>&1; then
CXX=g++-8
elif which g++-7 >/dev/null 2>&1; then
CXX=g++-7
elif which g++-6 >/dev/null 2>&1; then
CXX=g++-6
elif which g++ >/dev/null 2>&1; then
CXX=g++
fi
# If we can't find g++, allow CMake to do the look-up
fi
vcpkgToolReleaseTarball="$VCPKG_TOOL_RELEASE_TAG.tar.gz"
vcpkgToolUrl="https://github.com/microsoft/vcpkg-tool/archive/$vcpkgToolReleaseTarball"
baseBuildDir="$vcpkgRootDir/buildtrees/_vcpkg"
@ -246,7 +217,7 @@ else
cmakeConfigOptions=" $cmakeConfigOptions '-DCMAKE_JOB_POOL_COMPILE:STRING=compile' '-DCMAKE_JOB_POOL_LINK:STRING=link' '-DCMAKE_JOB_POOLS:STRING=compile=$VCPKG_MAX_CONCURRENCY;link=$VCPKG_MAX_CONCURRENCY' "
fi
(cd "$buildDir" && CXX="$CXX" eval cmake "$srcDir" $cmakeConfigOptions) || exit 1
(cd "$buildDir" && cmake "$srcDir" $cmakeConfigOptions) || exit 1
(cd "$buildDir" && cmake --build .) || exit 1
rm -rf "$vcpkgRootDir/vcpkg"