[cmake-developers] target-LOCATION-policy topic

Brad King brad.king at kitware.com
Fri Oct 11 15:04:18 EDT 2013


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.

Also, this policy means it will not be possible for a project
to support both the next release of CMake and CMake < 2.8.4
unless it sets the policy to OLD, and 2.8.4 is not too old.
Generally I prefer to recommend against ever setting a policy
to OLD instead of fixing the code except in an existing project
release maintenance branch to quiet the warning.

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.

Thanks,
-Brad



More information about the cmake-developers mailing list