[cmake-developers] [Patch] FindPkgConfig: optionally create imported target for the found libraries

Rolf Eike Beer eike at sf-mail.de
Fri May 13 12:21:05 EDT 2016


Am Freitag, 13. Mai 2016, 11:16:28 schrieb Brad King:
> On 05/13/2016 11:02 AM, Rolf Eike Beer wrote:
> > Should all be done now.
> 
> Thanks.
> 
> The test fails for me with
> 
>     CMake Error at /.../Modules/FindPkgConfig.cmake:239
> (set_target_properties): set_target_properties called with incorrect number
> of arguments.
> At least part of the problem is here:
> > +    if(${_prefix}_INCLUDE_DIRS)
> > +      list(APPEND _props INTERFACE_INCLUDE_DIRECTORIES
> > "${${_prefix}_INCLUDE_DIRS}") +    endif()
> > +    if(_libs)
> > +      list(APPEND _props INTERFACE_LINK_LIBRARIES "${_libs}")
> > +    endif()
> > +    if(${_prefix}_CFLAGS_OTHER)
> > +      list(APPEND _props INTERFACE_COMPILE_OPTIONS
> > "${${_prefix}_CFLAGS_OTHER}") +    endif()
> > +    set_target_properties(PkgConfig::${_prefix} PROPERTIES ${_props})
> 
> If any of the property values is empty the `${_props}` will
> remove it from the argument list to set_target_properties.
> Can you just use
> 
>   set_property(TARGET PkgConfig::${_prefix} PROPERTY ...)
> 
> in each `if()` block?

I had this before, but I thought I avoid multiple target lookups. You should 
only ever see that message if none of the branches is taken I think. And that 
should never happen, or the if before is wrong. Can you add a message() and 
show what is actually in _props there?

Greetings,

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160513/1e09d8d3/attachment.sig>


More information about the cmake-developers mailing list