[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-buildsystem
Subject:    Re: find_package(Foo REQUIRED)
From:       Allen Winter <winter () kde ! org>
Date:       2009-06-17 23:09:03
Message-ID: 200906171909.03780.winter () kde ! org
[Download RAW message or body]

On Wednesday 17 June 2009 9:15:18 am Brad King wrote:
> Allen Winter wrote:
> > Maybe this should be a feature of cmake itself.. but I wish for
> > find_package(Foo REQUIRED) to print a nicer message 
> > if Foo is not found.
> > 
> > We have the macro_log_feature() stuff for the optional packages
> > which creates the nice summary at the end of the cmake run,
> > but when required FOO is not found all we get is a terse error and quit.
> > 
> > I wonder.. can we overload find_package() with a COMMENT option?
> > i.e. 
> > find_package(Foo REQUIRED COMMENT "Foo is a critical library and this software
> > cannot be build without it. Please install Foo <http://www.foo.org> version 2.9 \
> > or higher") 
> > and have the COMMENT printed on termination?
> 
> In this case you're talking about improving the message using
> information specific to the call site.  You can just do this:
> 
> find_package(Foo QUIET)
> if(NOT Foo_FOUND)
> message(FATAL_ERROR
> "Foo is a critical library and this software cannot be build without it.  "
> "Please install Foo <http://www.foo.org> version 2.9 or higher.")
> endif()
> 
Perfect.  Now why didn't I think of that? :)

Using or logging feature, this example becomes:
find_package(Foo QUIET)
macro_log_feature(Foo_FOUND "Foo" "Foo Library" "http://www.foo.org" TRUE "2.9" "Foo \
is a critical library and this software cannot be built without it.") \
_______________________________________________ Kde-buildsystem mailing list
Kde-buildsystem@kde.org
https://mail.kde.org/mailman/listinfo/kde-buildsystem


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic