[cmake-developers] Setting includes, defines and other usage requirements with one command

Brad King brad.king at kitware.com
Thu Jan 31 09:02:17 EST 2013


On 01/31/2013 05:34 AM, Stephen Kelly wrote:
> I've left it in on export because it might make sense to use it with 
> generator expressions even on export:
> 
>  set(lib_genex $<$<CONFIG:Debug>:debuglib>)
>  tll(tgt $<TARGET_DEFINED:${lib_genex}:$<TARGET_PROPERTY:${lib_genex},FOO>)

Okay.  As long as $<LINKED:...> is removed for non-targets then this won't
be an issue.  I see your branch does this already :)

> I've made the LINKED generator expression a first-class expression, not just 
> something to be preprocessed away. I think this addresses much of the cost 
> concern.

Nice!  Here are a few comments:

* I got a warning while building your branch:

 .../Source/cmExportFileGenerator.cxx: In member function ‘void cmExportFileGenerator::ResolveTargetsInGeneratorExpression(std::string&, cmTarget*, std::vector<std::basic_string<char> >&)’:
 .../Source/cmExportFileGenerator.cxx:425:12: warning: unused variable ‘error’ [-Wunused-variable]

* I think $<LINKED:...> can be removed completely on export.  If the
  item is not a target then remove it (already done in your impl).
  If it is a target then replace it with the appropriate
  $<TARGET_PROPERTY:...,...> reference in the export.  This way the
  $<LINKED:...> expression lives only as long as needed.

* We could document $<LINKED:...> it as an internal implementation
  detail subject to future changes.  It should never be written by
  a project, only by tll.  It is transformed properly on export.
  I'd like to leave room for an alternative solution to out-of-order
  target interfaces in the future.

* Can the INCLUDE_DIRETORIES and COMPILE_DEFINITIONS property avoid
  $<LINKED:foo> references if foo is linked more than once?  Skip
  appending it if the same reference already exists earlier.  In
  the BEFORE case, prepend it and remove later instances.

Thanks,
-Brad



More information about the cmake-developers mailing list