On 5. Jul, 2010, at 12:00 , Todd Gamblin wrote:

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

Well, I got this information by simply grepping through the sources:

$ egrep -roh 'CMAKE_COMPILER_IS_GNU[A-Z0-9]*' Modules | sort -u
CMAKE_COMPILER_IS_GNUCC
CMAKE_COMPILER_IS_GNUCXX
CMAKE_COMPILER_IS_GNUG77

And you're right, it is CMAKE_COMPILER_IS_GNUCC and not CMAKE_COMPILER_IS_GNUC. 
But that is kind of consistent with the variable names used in GNU Makefiles to 
refer to the C, C++ and G77 compilers. If you are not happy with the names (for 
the reason you posted above), you can use CMAKE_<LANG>_COMPILER_ID which should 
be set to GNU if it is a GNU compiler:

for(lang C CXX Fortran)
  if(CMAKE_${lang}_COMPILER_ID STREQUAL GNU)
    set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-shared")
   endif()
endforeach()


HTH

Michael
_______________________________________________
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