[cmake-developers] Depends information in buildsystem files

Brad King brad.king at kitware.com
Mon Feb 11 14:10:12 EST 2013


On 02/11/2013 01:34 PM, Stephen Kelly wrote:
> I also considered splitting the targets from the non-targets in the 
> implementation of the macros. That would mean changing the order of the 
> content of target_link_libraries calls generated by cmCoreTryCompile because 
> we would have two lists send from the macros to try_compile (one of 
> libraries, the other of targets). That would maybe need a policy.

I don't think we need to split anything.  The macros can pass everything
in ${CMAKE_REQUIRED_LIBRARIES} to -DLINK_LIBRARIES and take the targets
out of it to pass to a TARGETS argument for transformation.  The latter
would handle the export/import and the former would work as it does now
but without CMakeExpandImportedTargets.

> I wonder if we can detect dangerous code:
> 
>  export(TARGETS foo bar NAMESPACE exp_)
>  try_compile( ... TARGETS exp_foo exp_bar)

The export() command won't make the exp_ targets available in the current
project.  It would have to load the targets file to do that, and IMO then
the project is on its own, especially since we want to disallow that
behavior with a policy later.

-Brad



More information about the cmake-developers mailing list