[CMake] Obtaining info about the compiler command arguments

Michael Wild themiwi at gmail.com
Thu Aug 12 11:54:15 EDT 2010


On 12. Aug, 2010, at 15:59 , Óscar Fuentes wrote:

> Óscar Fuentes <ofv at wanadoo.es> writes:
> 
>> How to know the compiler arguments set by include_directories,
>> add_definitions, etc?
>> 
>> CMAKE_<LANG>_FLAGS (with and whitout the uppercase build_type suffix)
>> doesn't contain anything that was set by the cmake commands mentioned
>> above.
> 
> I guess that the lack of response indicates that there is no way to do
> that. Why so basic feature is missing? Something with the internals of
> cmake that makes it hard to implement?

Well, your question isn't very clear. Are you interested in the compiler flag (i.e. -I or -D) or would you like to query the active include directories and definitions?

The former are available through the variables CMAKE_INCLUDE_FLAG_C and CMAKE_<lang>_DEFINE_FLAG, although AFAIK the latter may not be set and defaults to -D.

The latter are available through the directory properties INCLUDE_DIRECTORIES and DEFINITIONS. But doing some RTFM would have told you that...


Michael


More information about the CMake mailing list