[cmake-developers] How to handle RelWithDebInfo and MinSizeRel when not built?

Brad King brad.king at kitware.com
Thu Feb 21 09:31:02 EST 2013


On 02/21/2013 06:42 AM, Stephen Kelly wrote:
> I'm still trying to figure out the appropriate fix for 
> 
>  https://bugreports.qt-project.org/browse/QTBUG-29186
> 
> In a previous thread, it was reported that something similar was done with 
> Qt 4, but it's not clear to me how - FindQt4 and related files don't seem to 
> do it.
> 
>  http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/45184/focus=45220

CMake supports an arbitrary list of configurations so it cannot know
how to map imported configurations to the current project's configs
automatically.  This is the purpose of MAP_IMPORTED_CONFIG_<CONFIG>:

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

but of course Qt5 doesn't know the consumer's configurations so it
would have to be up to the consumer to set the property.

As documented in the above property, when the property is not set no
matching configs are available CMake just uses the first available
configuration.  You could solve this issue in the default case by
switching the order to

 _populate_imported_target_properties(RELEASE "Qt5Core.dll" "Qt5Core.lib" )
 _populate_imported_target_properties(DEBUG "Qt5Cored.dll" "Qt5Cored.lib" )

so that RELEASE is chosen for every consumer configuration except
DEBUG.

-Brad



More information about the cmake-developers mailing list