[cmake-developers] Depends information in buildsystem files

Stephen Kelly steveire at gmail.com
Sat Feb 9 06:24:33 EST 2013


Brad King wrote:

> On 02/07/2013 11:42 AM, Stephen Kelly wrote:
>> It seems to me it would be much easier and less duplicative to
>> add a way to specify TARGETS in try_compile, and in cmCoreTryCompile,
>> generate the IMPORTED targets there with whatever properties they have.
> 
> ...and in CMakeExpandImportedTargets handle imported targets in
> CMAKE_REQUIRED_LIBRARIES using this underlying CMake feature, yes.

The approach that I took was to not expose the feature through the cmake 
language, and instead make the use of CMakeExpandImportedTargets obsolete, 
and make try_compile directly handle CMAKE_REQUIRED_LIBRARIES containing 
IMPORTED targets. (This also means that try_compile will compute the link 
information for the targets correctly now - the macro didn't do that).

It's in the updated try_compile_targets branch. Will I merge it to next?

>> I pushed the try_compile_targets topic to my clone as a proof of concept,
>> but it would likely need to be reworked from scratch (eg a
>> cmExportFileGenerator subclass which can re-export imported targets).
> 
> Yes.  Also along those lines, I've several times seen requests to
> allow install(TARGETS) to re-install an imported target.  It is
> usually requested by people wanting to package dependencies of
> a project for distribution with CPack.  A similar re-exporting
> feature in cmExportFileGenerator would help with that.

I didn't write the code with a view to making it useful for that usecase 
also, but parts of it can be refactored in the future to work towards that.

Thanks,

Steve.





More information about the cmake-developers mailing list