[CMake] Getting the path to object files?

Robert Maynard robert.maynard at kitware.com
Wed Feb 27 09:34:59 EST 2019


You can file an enhancement request that the $<TARGET_OBJECTS>
generator expression to be relaxed to include STATIC, SHARED, and
MODULE libraries.

My suggestion is that a dummy source file to workaround the Xcode
limitation on targets, is not as hacky
as reverse engineering the object file locations.


On Wed, Feb 27, 2019 at 9:06 AM Paul Smith <paul at mad-scientist.net> wrote:
>
> 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