[cmake-developers] Exporting dependent library targets in multiple export sets

Alexander Neundorf neundorf at kde.org
Fri Sep 21 11:46:42 EDT 2012


On Thursday 20 September 2012, Brad King wrote:
> On 09/20/2012 12:20 PM, Alexander Neundorf wrote:
> > if(NOT TARGET Foo)
> > 
> >    if(CMAKE_FIND_PACKAGE_NAME)
> >    
> >       set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
> 
> What happens if other imported targets have already been defined?
> Then the targets file will have been partially loaded.


Yes.
Is this a problem ?

If some find-module searches several libraries, and finds only some of them, 
those FOO_LIBRARY variables which have been found also stay set, and are not 
reset, but the overall result is NOTFOUND.

> >       set(${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE
> >       
> >                    "The required target Foo does not exist !")
> >    
> >    else()
> >    
> >       message(STATUS
> >       
> >                 "Warning: the required target Foo does not exist !")
> >    
> >    endif()
> > 
> > endif()
> > 
> > 
> > or SEND_ERROR or FATAL_ERROR ?
> 
> I think FATAL_ERROR.  It is always easier to lessen this later.

Ok.

Alex



More information about the cmake-developers mailing list