[CMake] Trying to get build info for a target

Gary Kramlich grim at reaperworld.com
Sat Dec 31 17:45:32 EST 2011


I'm working on a module that needs to interrogate a target, and get
it's source directory, defines, cflags, and libraries that it links to.

So far, all I've been able to do is get the sources, which are relative
to the source directory of the target.  I have not been able to get the
source directory of the target, so I'm essentially stuck.

I've tried using the LOCATION property on the target, but alas that only
gives me the output location.

I've tried to get the absolute path of a source file using
get_filename_component for the ABSOLUTE property, but it just tacks on
the source filename to the current working directory, which obviously
doesn't work.

There is one idea I've had to fix this, but it's by no means ideal, and
that's to have each target set a property named SOURCE_LOCATION or
something, to CMAKE_CURRENT_SOURCE_DIR but that seems like a huge
inconvenience for potential users.

Any thoughts?

-- 
Gary Kramlich <grim at reaperworld.com>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111231/da614a97/attachment.pgp>


More information about the CMake mailing list