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

Braden McDaniel braden at endoframe.com
Fri Aug 22 12:18:01 EDT 2014


Nils Gladitz <nilsgladitz at ...> writes:

> Perhaps something like:
> 
> file(GENERATE
>      OUTPUT "${CMAKE_BINARY_DIR}/${LIB_PATHS}/${EXPORT_TARGET}_$<CONFIG>"
>      CONTENT "$<TARGET_FILE:${EXPORT_TARGET}>"
> )

Actually, upon closer inspection, it looks like this doesn't work because
 $<TARGET_FILE:${EXPORT_TARGET}> won't be aware of the current configuration at CMake
 configure-time. I'm trying to get the configuration-dependent path of the emitted library.
(And I need to support Windows project files.)
 
> 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.

It's not clear to me that this approach would solve the above problem.

Braden




More information about the CMake mailing list