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

Alexander Neundorf neundorf at kde.org
Sun Sep 23 13:22:15 EDT 2012


On Friday 21 September 2012, Alexander Neundorf wrote:
> 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.

This is now in the export-sets-2 branch on stage, including a basic test.

Comments ? Ok to merge into next ?

Alex



More information about the cmake-developers mailing list