CMake 3.14 not detecting AppleCLang in MacOS Mojave + XCode 10.1
I'm facing a unexpected behaviour in MacOS Mojave / Xcode 10 (AppleCLang 10.x) in CMake.
I'm expecting CMAKE_C_COMPILER_ID / CMAKE_CXX_COMPILER_ID variables in CMake filled with "AppleClang" instead of "Clang" only, to make sure which compiler I'm using.
What I'm doing wrong? Or its a bug in CMake 3.14?
(Also read about policy CMP0025 but in this simple test I'm not using it. It makes no difference for me setting CMP00025 to NEW or OLD, only prints a warning message saying old behaviour will be removed in a future version).
Below, the simple CMakeLists.txt, configure with CMake 3.14 (downloaded from CMake site), and the output of CMake.
macbook:CMakeBugApple virgiliofornazin$ cat CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
message(STATUS "CMAKE_C_COMPILER ${CMAKE_C_COMPILER}")
message(STATUS "CMAKE_C_COMPILER_ID ${CMAKE_C_COMPILER_ID}")
message(STATUS "CMAKE_C_COMPILER_VERSION ${CMAKE_C_COMPILER_VERSION}")
message(STATUS "CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}")
message(STATUS "CMAKE_CXX_COMPILER_ID ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "CMAKE_CXX_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION}")
macbook:CMakeBugApple virgiliofornazin$ rm -rf build/
macbook:CMakeBugApple virgiliofornazin$ mkdir build
macbook:CMakeBugApple virgiliofornazin$ cd build
macbook:build virgiliofornazin$ export PATH=/Applications/CMake.app/Contents/bin:$PATH
macbook:build virgiliofornazin$ cmake ..
-- The C compiler identification is AppleClang 10.0.0.10001145
-- The CXX compiler identification is AppleClang 10.0.0.10001145
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_C_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- CMAKE_C_COMPILER_ID Clang
-- CMAKE_C_COMPILER_VERSION 10.0.0.10001145
-- CMAKE_CXX_COMPILER /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- CMAKE_CXX_COMPILER_ID Clang
-- CMAKE_CXX_COMPILER_VERSION 10.0.0.10001145
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/ffcei/sources/CMakeBugApple/build
Edited by Virgilio Fornazin