[CMake] Does FIND_PACKAGE ignore REQUIRED and QUIET in Config mode ?

Yann Cointepas yann at sapetnioc.org
Fri Sep 5 17:08:46 EDT 2008


 On Fri, Sep 5, 2008 at 10:13 PM, Brad King <brad.king at kitware.com> wrote:

> I disagree.  The fact that FooConfig.cmake was loaded means that Foo
> *was* found.  It is up to the module to report other information for
> consumption by the project.  Perhaps the project finding Foo just wants
> to load some documentation files from it and doesn't care about its
> linking dependencies.  For this reason the find_package command in
> Config mode defines "found" to mean that the module was found and
> loaded.  It is going to set Foo_FOUND to true after loading
> FooConfig.cmake no matter what the module does (unless it has a syntax
> error).  Setting it inside the module will have no effect (though the
> fatal error message will prevent the overall configuration from
> succeeding).


Ok, thanks for this explaination.


> I do not recommend searching for required dependencies inside
> "FooConfig.cmake".  The process that put it there in the first place
> should have hard-coded inside it the locations of all dependencies.  If
> it comes with a system package file (like a .deb), then that file should
> have a dependency on the boost package and know where it will be
> installed.  If it comes from the user having built and installed Foo,
> then that build/install process should have found boost on the machine
> already.  Using a different boost could lead to problems, so the
> location should be hard-coded.


I agree that ideally the paths should be hardcoded. But it means that I must
provide one devel package per target system. Unfortunately, I cannot do that
for two reasons:
- I do not have the infrastructure to compile and make package on many
systems.
- I work with people that have the bad habit of installing software in non
standard places. Some of them cannot be blamed because they have no admin
privilege and must install missing software on their home directory.

This is why my foo-devel.tar.gz will be as system independant as possible by
providing a FooConfig.cmake looking for depedencies and allowing users to
specify non-standard places. In this case the config file has the
responsability of checking that the packages found have compatible version
and config (which can probably be difficult for software using
add_definition and  #if... directives).

Best regards,

      Yann Cointepas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080905/e1a81b2e/attachment.htm>


More information about the CMake mailing list