[CMake] Incoherent compiler detection in MacOSX 10.7.4

David Cole david.cole at kitware.com
Wed Oct 3 07:36:48 EDT 2012


On Wed, Oct 3, 2012 at 3:49 AM, Nick Overdijk <nick at astrant.net> wrote:
> I'm not sure where it was, but CMake prefers gcc over cc, and cxx over g++. You can force it by setting CC=clang.
>
> On 2012-03-10, at 09:27:28 , Pere Mato Vila wrote:
>
>> 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
>>
>>
>> --
>>
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.cmake.org/mailman/listinfo/cmake
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


The mismatch problem should be fixed in the builds of CMake 2.8.10-rc1
that we released yesterday. Give that a try and see if the default
compiler selection is better here -- it should be.

Let us know if there's still an issue...


Thanks,
David


More information about the CMake mailing list