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

Brad King brad.king at kitware.com
Thu Sep 20 13:03:07 EDT 2012


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.

>       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.

-Brad



More information about the cmake-developers mailing list