<div dir="ltr">1) Why do I need Foo_FIND_QUIET in FooConfig.cmake ?<br>First, I would like to display a message with the Foo version found if QUIET is not used.<br><br>2) Why do I need Foo_FIND_REQUIRED in FooConfig.cmake ?<br>
FooConfig.cmake will be packaged and installed on various systems (in a Foo-devel package). Therefore, even if FooConfig.cmake is found, I need to check that its mandatory dependencies are found too before setting Foo_FOUND. For instance, I have a mandatory dependency on Boost and I would like to have the following code in FooConfig.cmake:<br>
<br># Looking for Boost dependency<br>if( Foo_FIND_QUIET )<br> find_package( Boost QUIET )<br>else( Foo_FIND_QUIET )<br>
find_package( Boost )<br>
endifif( Foo_FIND_QUIET )<br><br># Assert that all required dependencies are found<br># and show messages depending on QUIET and <br># REQUIRED options.<br>
if( Boost_FOUND )<br> set( Foo_FOUND true )<br> if( NOT Foo_FIND_QUIET )<br> message( STATUS "Found Foo" )<br>
endif( Foo_FIND_QUIET )<br>
else( Boost_FOUND )<br>
set( Foo_FOUND false )<br> if( NOT Foo_FIND_QUIET )<br>
if( Foo_FIND_REQUIRED )<br> message( FATAL_ERROR "Found not found due to missing dependency" )<br>
else( Foo_FIND_REQUIRED )<br>
message( STATUS "Found not found due to missing dependency" )<br>
endif( Foo_FIND_REQUIRED )<br>
endif( Boost_FOUND )<br>
<br><br> The FooConfig.cmake use find_package( Boost )<br>
> Hmm, I don't understand.<br>
> You shouldn't need them in this case.<br>
> If you use FooConfig.cmake, it will be found automatically, if not, i.e. when<br>
> you would have to check whether it was required or not, you are not able to<br>
> check it, since the script which could check it wasn't found and can't do<br>
> anything.<br>> What exactly do you want to do ?<br>
><br>> Alex<br>
><br>> On Saturday 30 August 2008, Yann Cointepas wrote:<br>
> > Hi,<br>> ><br>
> > I would like to use XXX-config.cmake file (generated from a<br>
> > <a href="http://xxx-config.cmake.in/" target="_blank">XXX-config.cmake.in</a>) in the same way as if it was FindXXX.cmake (I want to<br>
> > use the search policy of Config mode). But no XXX_FIND_REQUIRED nor<br>
> > XXX_FIND_QUIET variables are defined when XXX-config.cmake is executed with<br>
> > find_package( XXX REQUIRED|QUIET ). Is there another way to get this<br>
> > information ?<br>
<br><br><br>-- <br>Yann Cointepas Tel: +33 1 69 08 78 31<br>CEA - Neurospin Fax: +33 1 69 08 79 80<br>Bātiment 145, Point Courrier 156<br>91191 Gif-sur-Yvette cedex, France<br>
</div>