[cmake-developers] TARGET_OBJECTS and buildsystem replacement macros

Brad King brad.king at kitware.com
Wed Mar 19 12:50:58 EDT 2014


On 03/19/2014 12:31 PM, Stephen Kelly wrote:
> However, the contents of the resulting list of objects contains paths which 
> contain replacement macros '$(Configuration)' etc for the buildsystem tool.

At least for the configuration, it is known when evaluating the genex.
Whatever is adding the placeholders can be taught to put the real
configuration in there, no?

See also ExpandCFGIntDir for logic that removes the placeholders.

> 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.

IIRC for Xcode there is $(CURRENT_ARCH) in the path to the object files.
This is necessary for universal binary builds because the architecture
is substituted at build time by Xcode.  This is not a problem in the
Makefile and Ninja generators because those handle universal binaries
by putting all architectures in one object file (multiple -arch flags
to one compiler invocation).

> 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.

That's because TARGET_FILE evaluation knows to use the per-config
location of the target.

-Brad




More information about the cmake-developers mailing list