[cmake-developers] TARGET_OBJECTS and buildsystem replacement macros

Stephen Kelly steveire at gmail.com
Wed Mar 19 12:31:18 EDT 2014


Hi,

In my target-sources-refactor topic, I turn TARGET_OBJECTS into a regular 
generator expression. That makes it possible to use it with file(GENERATE), 
and I suppose with install(FILES) too in theory.

However, the contents of the resulting list of objects contains paths which 
contain replacement macros '$(Configuration)' etc for the buildsystem tool. 
In the unit test for the feature, I replace those macros in a script.

 https://gitorious.org/cmake/steveires-cmake/source/47b04aa2d5f59afd892a4666f600bc536fce08f1:Tests/GeneratorExpression/check_object_files.cmake

I thought that maybe it could make sense to enforce that TARGET_OBJECTS can 
only be used when evaluating the SOURCES property, and possibly introduce 
something else if there is a legitimate need for the files in other 
contexts, such as file(GENERATE). 

However, I think that is not possible with Xcode. There seem to be other 
macros there and I guess the full path is not known at cmake-time at all. Is 
that right?

I checked the behavior of TARGET_FILE with file(GENERATE). I expected that 
to contain the same replacement macros, but that doesn't seem to be the 
case. I also checked the behavior of 

 install(FILES $<TARGET_OBJECTS:objLib> DESTINATION objects)

and the builsystem macros are not replaced in that context either.

Thanks,

Steve.




More information about the cmake-developers mailing list