Objective-C/C++ doesn't respect CC/CXX environment variables
With the following example:
enable_languages(C OBJC)
CC=clang-8 cmake -GNinja ..
You can see that cmake selects clang-8
for the C compiler but clang
for the Objective-C compiler!
-- The C compiler identification is Clang 8.0.1
-- The OBJC compiler identification is Clang 8.0.1
-- Check for working C compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-102-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang-8
-- Check for working C compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-102-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang-8 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working OBJC compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-102-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang
-- Check for working OBJC compiler: /Users/tobias/.conan_plex/.conan/data/clang/8.0.1-102-0/plex/stable/package/0b647f069fa6c3d1e66c05f0cc32933e0ff5e065/bin/clang -- works
-- Detecting OBJC compiler ABI info
-- Detecting OBJC compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tobias/tmp/objc-test/b
The same is true for CXX/ObjCXX
I think it's very reasonable to think that it would use the same compiler in this case. Instead of having to pass -DCMAKE_OBJC_COMPILER