[cmake-developers] target-LOCATION-policy topic

Stephen Kelly steveire at gmail.com
Fri Oct 11 15:21:52 EDT 2013


Brad King wrote:

> Steve,
> 
> Please extend the CMP0026 message to suggest file(GENERATE)
> as a way of putting the target location in a generated file.
> Some projects not supporting multi-config generators may
> use LOCATION with configure_file.

Done.

> Can the policy NEW behavior instead be to return the LOCATION
> as a $<TARGET_FILE:...> generator expression?  That would
> allow projects to do
> 
>  if(POLICY CMP0026)
>    cmake_policy(SET CMP0026 NEW)
>  endif()
>  get_property(loc TARGET myexe PROPERTY LOCATION)
>  add_custom_command(... ${loc} ...)
> 
> and work with both CMake < 2.8.4 and with whatever release
> includes the policy.

I don't know. That seems like a lot of magic and bound to break existing 
code.

 get_property(loc TARGET myexe PROPERTY LOCATION)
 file(WRITE "some_script.bat" "./${loc}")

KDE4 does this:

 get_target_property(_executable ${_target_NAME} LOCATION )
 set_target_properties(${_target_NAME} PROPERTIES WRAPPER_SCRIPT 
   ${_executable})

and the WRAPPER_SCRIPT is used elsewhere.

Thanks,

Steve.





More information about the cmake-developers mailing list