[CMake] How to use FindPackageHandleStandardArgs

Marcel Loose loose at astron.nl
Thu May 14 05:00:42 EDT 2009


Hi all,

I stumbled on a problem with FindPackageHandleStandardArgs, which
probably arises from my misunderstanding of how to properly use it.

The case is the following. I check for the presence of a number of
libraries, using find_library(). I collect the values, returned by
find_library() in a XXX_LIBRARIES variable. So, effectively,
XXX_LIBRARIES becomes a list, which may contain one or more values that
evaluate to FALSE (i.e. contain YYY-NOTFOUND).

>From the many examples I found in the Find modules that ship with CMake,
I was under the impression that I need do the following:

find_package_handle_standard_args(XXX, DEFAULT_MSG XXX_LIBRARIES
XXX_INCLUDE_DIR).

However, XXX_LIBRARIES evaluates to TRUE, even if one or more of its
elements evaluate to FALSE (i.e. one of the libraries was not found and
YYY-NOTFOUND was returned). So shouldn't I be using ${XXX_LIBRARIES} as
argument to find_package_handle_standard_args() instead of
XXX_LIBRARIES? The weird thing is, though, that I didn't see any
prepackaged FindXXX.cmake files pass the values from XXX_LIBRARIES. 

So I am a bit lost here.

Best regards,
Marcel Loose.




More information about the CMake mailing list