[cmake-developers] Exporting dependent library targets in multiple export sets
Alexander Neundorf
neundorf at kde.org
Thu Sep 20 12:20:27 EDT 2012
On Thursday 20 September 2012, Brad King wrote:
> On 09/19/2012 04:14 PM, Alexander Neundorf wrote:
> > On Wednesday 19 September 2012, Alexander Neundorf wrote:
> >> Hmm, I was almost done implementing it...
> >> when creating the export file, we do not know how the Config file will
> >> be named, i.e. we do not know the name of the package, so we cannot set
> >> <package>_FOUND to FALSE...
> >> Am I missing something ?
> >
> > cmFindPackage could set a CMAKE_FIND_PACKAGE_NAME variable, which I could
> > use then...
>
> Okay with me, but target files may not always be loaded from Config
> files under find_package. Some projects may load them in other
> contexts. If CMAKE_FIND_PACKAGE_NAME or one of the other variables
> you need to detect the case is not set then we need to do something
> else (error, warning?).
Like this ?
if(NOT TARGET Foo)
if(CMAKE_FIND_PACKAGE_NAME)
set(${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)
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 ?
Alex
More information about the cmake-developers
mailing list