[CMake] CMAKE_COMPILER_IS_GNUC vs. CMAKE_COMPILER_IS_GNUCC
Todd Gamblin
tgamblin at llnl.gov
Mon Jul 5 06:00:35 EDT 2010
On Jul 5, 2010, at 1:23 AM, Michael Wild wrote:
>
> On 5. Jul, 2010, at 7:46 , Todd Gamblin wrote:
>
>> The documentation here:
>>
>> http://*www.*cmake.org/cmake/help/cmake2.6docs.html#variable:CMAKE_COMPILER_IS_GNULANG
>>
>> is in conflict with the documentation here:
>>
>> http://*www.*cmake.org/Wiki/CMake_Useful_Variables
>>
>> And this thread (though it's from 2008) seems to imply that the second link above is right, even though the first is more current:
>>
>> http://*www.*mail-archive.com/cmake@cmake.org/msg16863.html
>>
>>
>> I'm using CMake 2.8.2, and I'm noticing that CMAKE_COMPILER_IS_GNUC is empty, which conflicts with the latest documentation on the wiki. This makes it hard to do things like this:
>>
>>> for (lang C CXX Fortran)
>>> if (CMAKE_COMPILER_IS_GNU${lang})
>>> ...
>>> endif()
>>> endfor()
>>
>> Looking through the CMake source, it doesn't look like CMAKE_COMPILER_IS_GNUFortran is used anywhere. I tested it, and it looks like it's empty too. Would it be possible to add CMAKE_COMPILER_IS_GNUC and CMAKE_COMPILER_IS_GNUFortran so that they actually work? I think this would be more consistent than the current setup.
>>
>> These issues are coming up in the platform files I'm making for BlueGeneP. I think writing things like this would be easier if this were more consistent.
>>
>> -Todd
>
> The variables are called CMAKE_COMPILER_IS_GNUC, CMAKE_COMPILER_IS_GNUCXX and CMAKE_COMPILER_IS_GNUG77 (the latter is admittedly weird)
I don't think this is correct, at least not in the platform files in CMake 2.8.2. If I look at the value of CMAKE_COMPILER_IS_GNUC, it's empty. If I look at CMAKE_COMPILER_IS_GNUCC, it's getting set to what I'd expect. Is CMAKE_COMPILER_IS_GNUC set somewhere else, after the platform file gets included?
G77 is weird, since as far as I can tell it's "Fortran" for all the other variables. Like I said, that really precludes you from doing something like this, especially if you try to set something inside the loop:
for (lang C CXX Fortran)
if (CMAKE_COMPILER_IS_GNU${lang})
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
endif()
endfor()
Since now ${lang} needs to be something different in all those places.
>
> Michael
More information about the CMake
mailing list