On Wednesday 27 March 2013, Brad King wrote: > On 03/26/2013 04:07 PM, Alexander Neundorf wrote: > > there is a difference here in that the include directory properties are a > > new feature, so this wouldn't break existing code. > > It would force developers who make use of the new feature to split > > exported targets into individual components and support components > > properly in their Config.cmake files. > > I don't want to force anyone to do that. It is perfectly reasonable > to have a monolithic targets file.
>From readme.txt: "A package can provide sub-components. Those components can be listed after the COMPONENTS (or REQUIRED) or OPTIONAL_COMPONENTS keywords. The set of all listed components will be specified in a Xxx_FIND_COMPONENTS variable. For each package-specific component, say Yyy, a variable Xxx_FIND_REQUIRED_Yyy will be set to true if it listed after COMPONENTS and it will be set to false if it was listed after OPTIONAL_COMPONENTS. Using those variables a FindXxx.cmake module and also a XxxConfig.cmake package configuration file can determine whether and which components have been requested, and whether they were requested as required or as optional. For each of the requested components a Xxx_Yyy_FOUND variable should be set accordingly. The per-package Xxx_FOUND variable should be only set to true if all requested required components have been found. A missing optional component should not keep the Xxx_FOUND variable from being set to true." We should try to make that possible. find_package(Foo REQUIRED COMPONENTS Blub) If this does not error out, and if the result of that is Foo_FOUND = TRUE and Foo_Blub_FOUND = TRUE, a cmake user should be able to expect that component Blub of Foo works and can be used. Maybe instead of generating code which immediately results in failure at the find_package() step, how about generating code which contains a list of imported targets with missing dependencies/files/directories ? This can then be evaluated in the Config.cmake file and the per-component _FOUND variables can be set. Does otherwise the author of a Config.cmake file have to write cmake code to query the imported targets for their include interface properties, and check whether the referenced directories and targets exist ? With such a variable, the code in a Config.cmake file could look like this: foreach(comp ${Xxx_FIND_COMPONENTS}) include(${CMAKE_CURRENT_LIST_DIR}/${comp}Targets.cmake OPTIONAL RESULT_VARIABLE fileIncluded) set(Xxx_${comp}_FOUND TRUE) if(NOT fileIncluded) set(Xxx_${comp}_FOUND FALSE) endif() # now the suggested variable: if(Xxx_IMPORTED_TARGETS_WITH_MISSING_STUFF) set(Xxx_${comp}_FOUND FALSE) endif() endforeach() Alex -- 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