Hi,

I think find_package in Config mode might still need some more work.

When the FooConfig.cmake has been found, Foo_FOUND is set to TRUE:

 // Set a variable marking whether the package was found.
  std::string foundVar = this->Name;
  foundVar += "_FOUND";


This means it is true in all cases that the Config.cmake file has been found 
(and the version was compatible).

Now I have to questions:


* how to handle COMPONENTS ?


If a package is requested with COMPONENTS, these should be considered for 
setting Foo_FOUND:
find_package(Foo REQUIRED COMPONENTS A B C)
should only succeed if A, B and C are found.

This is how I would expect COMPONENTS to be handled in a FindFoo.cmake:
(a) all components are searched by the Find-module, and each per-component 
X_Y_FOUND is set accordingly

(b) there is a package-specific default subset of these components which have 
to be found to make the package found, i.e. FOO_FOUND=TRUE

(c) by adding COMPONENTS to the find_package() call, these components are 
added to the set of components which have to be found to make FOO_FOUND=TRUE

(d) if REQUIRED is used and FOO_FOUND is false, it errors out



* how to handle dependencies ?


Let's say the exported targets of Foo link against other imported/exported 
targets. So that the imported targets work properly, the targets for the 
libraries it depends on must have been found and imported before.
Where should this 
find_package(Bar)
be done ?
In FooConfig.cmake ?
This would be possible only if Bar can be found in Config mode, because 
otherwise Foo cannot rely on FindBar.cmake being available.

For Find-modules, it is clear that a Find-module should also find all its 
dependencies.
For a Config file I'm not sure about it. Shouldn't this be only a source of 
information, purely declarative, and not initiate searching other packages ?

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

Reply via email to