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.m...@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

Reply via email to