[CMake] Set Different Project Languages on Different Platforms?

Rolf Eike Beer eike at sf-mail.de
Sat Sep 29 14:46:17 EDT 2012


digitalriptide wrote:
> Is it possible to set different project languages on different
> platforms? I was thinking of simply detecting the platform and having
> different project calls for different platforms, but variables such as
> ${CMAKE_SYSTEM_NAME} don't seem to be set until *after* project is
> called.
> 
> The reason I ask is that, on OS X, qt4 does not seem to require a CC
> definition, but on Linux it does.

You could just always enable C:

project(something C)

and then do something like

if (UNIX)
  enable_language(CXX)
endif()

But: using Qt4 without an enabled C++-compiler is nonsense. It may work by 
accident if the compiler automatically acts as C++ compiler or something like 
that, but relying on such behavior is just asking for later trouble.

Eike
-- 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120929/d422791f/attachment.pgp>


More information about the CMake mailing list