On 12/09/2012 08:48 AM, Stephen Kelly wrote: > I think the 'Setting include directories via target_link_libraries() ?' > thread needs to be concluded first (with reasoning), as that affects > everything else.
While thinking about my next response to that discussion I realized that most of our discussion so far about exported interfaces has missed a major piece. You briefly mentioned it while we discussed the syntax of the $<CONFIG_DEBUG> expression. It is MAP_IMPORTED_CONFIG_<CONFIG>: http://www.cmake.org/cmake/help/v2.8.10/cmake.html#prop_tgt:MAP_IMPORTED_CONFIG_CONFIG Every part of an exported interface (link interface libraries, include dirs, compile definitions, etc.) potentially depends on the configuration being exported from the project. The exporting project knows nothing of the importing projects' configurations. All evaluation of its generator expressions must be done using only one of the original configurations for expressions like $<CONFIG:...>, $<CONFIG_DEBUG> and $<CONFIGURATION>. One approach to this is to perform partial evaluation of all exported interfaces to resolve generator expressions that depend on the config. Then store the results in exported properties ending in _<CONFIG>. This is essentially what CMake <= 2.8.10 does to produce properties like IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>, but that is actually full evaluation because there is no support for generator expressions. The importing project then selects one of the exported configurations using heuristics and MAP_IMPORTED_CONFIG_<CONFIG> if defined. Another approach is to try to honor the configuration mapping while evaluating exported generator expressions in the importing project. Evaluation would need to track when it crosses into expressions that came from another project and lookup the configuration mapping. Note that the above holds for not only link interface libraries but for any new usage requirements support too. For example in the partial evaluation approach the exported interfaces would need properties like (IMPORTED_)?INCLUDE_DIRECTORIES_<CONFIG> (IMPORTED_)?COMPILE_DEFINITIONS_<CONFIG> Such properties are distinct from properties like INCLUDE_DIRECTORIES in that they will not contain config-dependent generator expressions. Comments? -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers