[CMake] add_custom_command doesn't know about target; but get_target_property does

Braden McDaniel braden at endoframe.com
Fri Aug 22 08:24:48 EDT 2014


On Fri, 2014-08-22 at 12:37 +0200, Nils Gladitz wrote:
> On 22.08.2014 02:15, Braden McDaniel wrote:
> > Ah.  Bummer.
> >
> > Well, as you might have guessed, I'm trying to address an issue where
> > the LOCATION property of a target (EXPORT_TARGET, in the example above)
> > was being used.  Is there some way I can get this information about the
> > target that doesn't involve modifying the CMakeLists.txt in each
> > subdirectory where a target of interest resides?
> 
> Perhaps something like:
> 
> file(GENERATE
>      OUTPUT "${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$<CONFIG>"
>      CONTENT "$<TARGET_FILE:${EXPORT_TARGET}>"
> )
> 
> Or if you want to keep this at build time a custom command with the 
> OUTPUT signature and
> e.g. a custom target that depends on that output.

Actually, I'd rather not do it at build time; I just didn't realize I
could avoid it.  That should work quite nicely.  Thanks!

-- 
Braden McDaniel <braden at endoframe.com>



More information about the CMake mailing list