[cmake-developers] [PATCH] FindProtobuf: prevent redundant PROTOBUF_LIBRARIES

Brad King brad.king at kitware.com
Wed Feb 10 13:47:11 EST 2016


On 02/10/2016 04:36 AM, Antonio Perez Barrero wrote:
>     find_library(${name}_LIBRARY
[snip]
> +   select_library_configurations(${name})
> +   set(${name}_LIBRARY_DEBUG ${${name}_LIBRARY_DEBUG} PARENT_SCOPE)
> +   set(${name}_LIBRARY ${${name}_LIBRARY} PARENT_SCOPE)
> +   set(${name}_LIBRARIES ${${name}_LIBRARIES} PARENT_SCOPE)

Thanks.  IIRC select_library_configurations needs the two inputs
to be <name>_LIBRARY_DEBUG and <name>_LIBRARY_RELEASE.  We'll
have to change the first find_library call to use _RELEASE.
The whole block can be arranged in the form

 if(${name}_LIBRARY)
   set(${name}_LIBRARIES "${${name}_LIBRARY}")
 else()
   ...current block, but with _RELEASE name...
 endif()

in order to be compatible with build scripts that expect to
set just ${name}_LIBRARY in the cache.

-Brad



More information about the cmake-developers mailing list