[cmake-developers] Disallowing include() of export() result

Matthew Woehlke matthew.woehlke at kitware.com
Fri Jun 28 12:27:29 EDT 2013


On 2013-06-28 08:40, Brad King wrote:
> What about the APPEND mode of export?  Do you plan to try to
> collect all the appended pieces together, all delayed until
> generate time?

That would be great if you could! One of my big gripes with export() is 
how much less elegant it is generating a build-time targets.cmake than 
at install time. If the calls to export() could be collected and parsed 
once (preferably without duplicating the boilerplate for every call) 
that would be a welcome improvement.

> Perhaps the policy could also disallow the
> APPEND mode altogether.  IIRC I've participated in discussion
> in the past about how APPEND is a bad approach anyway.

Maybe I am unclear how export() is supposed to be used, but I have 
always used it as a trio of add_library()/export()/install() (often in a 
helper function), per library. That seems quite a bit more convenient 
than collecting a list of all targets in the project for one-time 
export(). Would this make the latter approach the only possible way to 
use export()? (That would probably break quite a few projects :-(.)

To me it would make much more sense if export() was more like 
install(EXPORT), where one declares at the point of the add_library() 
the desire to export a target, which adds to a list the CMake keeps 
track of internally in order to generate an export file later.

-- 
Matthew




More information about the cmake-developers mailing list