[CMake] Incoherent compiler detection in MacOSX 10.7.4
Pere Mato Vila
Pere.Mato at cern.ch
Wed Oct 3 03:27:28 EDT 2012
In my Mac system (10.7.4) with Xcode (4.4.1) CMake finds by default the GNU compiler for C and Clang for C++. This posses problems later when building my package. The package can be built correctly either with Clang or with GCC but not in a mixed mode. See the cmake output:
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is Clang 4.0.0
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /Developer/usr/bin/gcc
-- Check for working C compiler: /Developer/usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
The question is how this is possible? What is the logic to detect the compiler used by CMake? I know that I can force a given compiler with the CMAKE_XXX_COMPILER or by defining the environment variables CXX and CC but it would be nice that the proper selection is done without any user intervention.
% which cc c++
/usr/bin/cc
/usr/bin/c++
% ls -ls /usr/bin/cc
8 lrwxr-xr-x 1 root wheel 5 Aug 22 09:09 /usr/bin/cc -> clang
% ls -ls /usr/bin/c++
8 lrwxr-xr-x 1 root wheel 7 Aug 22 09:09 /usr/bin/c++ -> clang++
-------------------------------------------------------------
Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland
e-mail: pere.mato at cern.ch tel: +41 22 76 78696
fax: +41 22 76 68792 gsm: +41 76 48 70855
More information about the CMake
mailing list