[CMake] 2.8.8-rc1 CXX compiler id

Matt Lamont Matthew.Lamont at unlimitedrealities.com
Mon Apr 2 22:07:06 EDT 2012


Hi,

There appears to be a difference in what C++ compiler is detected on OS X, depending on what generator is selected.

Xcode generator:

-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1

Makefiles generator:

-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is Clang 3.1.0


This 'breaks' a number of open source projects (BZip2 and Assimp are two examples I have encountered), as this piece of code seems to be common:

if (CMAKE_COMPILER_IS_GNUCXX)
  set ( CMAKE_C_FLAGS     "${CMAKE_C_FLAGS} -fpic")
  set ( CMAKE_CXX_FLAGS   "${CMAKE_CXX_FLAGS} -fpic")
endif (CMAKE_COMPILER_IS_GNUCXX)


For now, i've been adding "OR APPLE" to the if condition, although I'm not sure if that's the right approach.
Is Clang still considered to be "gcc compatible"?


-Matt.


More information about the CMake mailing list