-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Describe the bug
When building absl using Apple Clang using cmake 3.0 or later, the following warning is produced:
CMake Warning at absl/absl/copts/AbseilConfigureCopts.cmake:61 (message):
Unknown compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++.
Building with no default flags
Call Stack (most recent call first):
absl/CMake/AbseilHelpers.cmake:18 (include)
absl/CMakeLists.txt:78 (include)
This is because CMAKE_CXX_COMPILER_ID is AppleClang.
This appears to be a regression introduced recently. The comment says MATCHES (which would be correct), but the code uses STREQUAL
The policy in question (using AppleClang for Apple's clang) is explicitly enabled by abs's CMakeLists.txt:
# Compiler id for Apple Clang is now AppleClang.
if (POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif (POLICY CMP0025)
Steps to reproduce the bug
On any Mac, using cmake 3 or later, run cmake -B build -S .. Output:
ben@BenMBP absl % cmake -B build -S .
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning at absl/copts/AbseilConfigureCopts.cmake:61 (message):
Unknown compiler:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++.
Building with no default flags
Call Stack (most recent call first):
CMake/AbseilHelpers.cmake:18 (include)
CMakeLists.txt:78 (include)
What version of Abseil are you using?
ben@BenMBP absl % git rev-parse HEAD
d9a31a2d440f33aa40d88b3b8a98f4c19ffaa182
What operating system and version are you using
macOS Big Sur 11.2.3
What compiler and version are you using?
ben@BenMBP absl % clang --version
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ben@BenMBP absl %
What build system are you using?
ben@BenMBP ycmd % cmake --version
cmake version 3.19.2
Additional context
Changing the above STREQUAL back to MATCHES resolved this issue:
ben@BenMBP absl % cmake -B build -S .
-- The CXX compiler identification is AppleClang 12.0.0.12000032
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Warning at CMakeLists.txt:156 (message):
The default and system-level install directories are unsupported except in LTS releases of Abseil. Please set CMAKE_INSTALL_PREFIX to install Abseil in your source or build tree directly.
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/ben/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/absl/build