[cmake-developers] Handling of Config specific imported targets?

Brad King brad.king at kitware.com
Wed May 16 08:55:45 EDT 2012


On 05/16/2012 06:42 AM, Stephen Kelly wrote:
> In Qt 5 we currently generate IMPORTED_LOCATION_${Config} for the Debug or 
> Release (or both, depending on platform), depending on how Qt is configured.
> 
> If both exist (on windows) and the caller uses CMAKE_BUILD_TYPE == Debug or 
> Release, the correct location should be used. However, this doesn't account 
> for having a different or empty CMAKE_BUILD_TYPE. 

We already have some logic to account for a mismatch between the set of
valid configurations in the exporting v. importing project.  See logic
here:

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmTarget.cxx;hb=v2.8.8#l4093

and these properties:

 http://www.cmake.org/cmake/help/v2.8.8/cmake.html#prop_tgt:LOCATION_CONFIG
 http://www.cmake.org/cmake/help/v2.8.8/cmake.html#prop_tgt:MAP_IMPORTED_CONFIG_CONFIG

CMake code should only ever *set* the IMPORTED_LOCATION properties.
If it wants to *get* the location it should use LOCATION_<CONFIG>.
CMake will follow the above approach to find a suitable match for
the requested <CONFIG>.

-Brad



More information about the cmake-developers mailing list