[CMake] cmake 2.6.3 RC 5

Brad King brad.king at kitware.com
Mon Dec 8 16:37:28 EST 2008


Alexander Neundorf wrote:
> Just a small thing:
> I'm slowly converting a few of the FindFoo-modules from kdelibs to the new 
> Config-style.
> E.g. for automoc4 our FindAutomoc4.cmake looks (basically) like:
> 
> set(_FIND_QUIETLY ${Automoc4_FIND_QUIETLY})
> find_package(Automoc4 QUIET NO_MODULE)
> set(Automoc4_FIND_QUIETLY ${_FIND_QUIETLY})
> 
> include(FindPackageHandleStandardArgs)
> find_package_handle_standard_args(Automoc4  DEFAULT_MSG  AUTOMOC4_EXECUTABLE)
> 
> 
> The slightly ugly thing is the saving and restoring of the 
> Automoc4_FIND_QUIETLY variable. 
> I want to call find_packlage( NO_MODULE) with quiet, otherwise the user sees 
> the verbose built-in error message if no Config-file was found. But I don't 
> want this, since I just want the standard error message from 
> FindPackageHandleStandardArgs.cmake and even if the Config-mode fails, I 
> could still have my own handling and do some other searching. 
> Because of this I want to use QUIET for the NO_MODULE, but still want to 
> _FIND_QUIETLY variable as the user put it for the outer FindFoo.cmake file.
> 
> So, I think it would be nice if find_package(NO_MODULE) would restore the 
> FIND_QUIETLY variable to the state it was before (as I'm doing here 
> manually).

Good idea.  I don't think we make any guarantee either way about the
value of this variable *after* a call, but we do document how it is set
*inside* the find-module (which is the case after the call in your
example), so we should preserve it.

I've added this to my todo-list.  Fortunately fixing it won't break your
work-around.

-Brad


More information about the CMake mailing list