[CMake] How to use FindPackageHandleStandardArgs

Marcel Loose loose at astron.nl
Thu May 14 08:10:56 EDT 2009


Hi Denis,

I think I understand what's going wrong.
I collect the *values* from the variables returned by find_library() in
XXX_LIBRARIES, not the names of these variables.

So, instead of passing LIB1 LIB2 LIB3 to
find_package_handle_standard_args() I'm actually passing ${LIB1} ${LIB2}
${LIB3}, which is, of course, quite different.

What's the best way to proceed. Should I collect the names of variables
used in the find_library() calls in a separate list variable and use
that for find_package_handle_standard_args(), or should I just handle
the REQUIRED and QUIET stuff myself in this case. Any recommendations?

Best regards,
Marcel Loose.

On Thu, 2009-05-14 at 04:45 -0700, Denis Scherbakov wrote:
> 
> > Yes, that's right. But...
> > 
> > The number of libraries I need to find depends on the
> > COMPONENTS that
> > were specified by the user in his CMakeLists.txt file. So I
> > cannot hard
> > code these variables as arguments to
> > find_package_handle_standard_args(). That's why I chose to
> > collect them
> > in XXX-LIBRARIES first and pass that variable.
> > 
> > So, I'm still stuck I'm afraid.
> 
> You may pass a LIST of variables, this also works.
> 
> INCLUDE(FindPackageHandleStandardArgs)
> 
> LIST(APPEND myList "GSL_LIBRARIES" "GSL_LIBRARY" "GSL_CBLAS_LIBRARY" "GSL_INCLUDE_DIR")
> 
> FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSL DEFAULT_MSG ${myList})
> 
> Denis
> 
> 
>       



More information about the CMake mailing list