[cmake-developers] cmLocalGenerator::GetTargetFlags

Tobias Hunger Tobias.Hunger at qt.io
Wed Jun 8 04:23:44 EDT 2016


Hi everybody,

what use is the "flags" out-parameter in cmLocalGenerator::GetTargetFlags? It is
only ever set for targets of type EXECUTABLE and is filled based on the *linker
language* of the target.

I really do not see any use for this information, and indeed the flag seems
unused in the cmake code base, except for the Ninja generator, where that may or
may not make sense (probably not).

Can the flag get removed altogether and the method get renamed to
GetTargetLinkerFlags? Maybe it could return the linker language instead, that is
a piece of data that is more important in its context IMHO.

While discussing this method: How about moving the method to cmTargetGenerator?
That would get rid of the target parameter. That is where I would actually look
for information on targets.



Which brings me back to my original question: How can I find the compiler flags
in use for a cmSourceFile/cmGeneratorTarget? The only place that I found that
seems to do what I want is cmCommonTargetGenerator::GetFlags. Or is that
concerned about cmake internal flags that need to get mapped to compiler flags
later? Is there another copy of that code in a place more convenient to use or
do I need to create that?

cmCommonTargetGenerator does caching of results. Should this be also done for
cmLocalGenerator::GetTargetFlags, etc?

Best Regards,
Tobias

-- 
Tobias Hunger, Senior Software Engineer | The Qt Company
The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Mika Harjuaho. Sitz der
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B


More information about the cmake-developers mailing list