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 -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers