[CMake] Getting the path to object files?

Paul Smith paul at mad-scientist.net
Wed Feb 27 09:06:54 EST 2019


On Wed, 2019-02-27 at 08:39 -0500, Robert Maynard wrote:
> CMake only provides an official way to get the location of the object
> files for OBJECT targets ( $<TARGET_OBJECTS:objLib> ). For other
> target types the location is an implementation detail.

Yes, but sometimes (as in my case) I need to know it :).  I need to
examine the object files as part of my link processing.

Exactly _because_ it's an implementation detail, it would be nice if
there were some way to retrieve it from CMake.  I can file an
enhancement request if that seems appropriate.

I could use an OBJECT target if it weren't for the Xcode restriction
that a STATIC or SHARED library must have at least one source file and
can't consist solely of an OBJECT library.

I'm hopeful we can throw away our MacOS builds entirely but until that
happens...


Thanks for the reply Robert!



More information about the CMake mailing list