[cmake-developers] [PATCH] FindProtobuf: fix wrong library list for Unix

Brad King brad.king at kitware.com
Mon Feb 8 16:39:00 EST 2016


On 02/08/2016 04:24 PM, Antonio Pérez Barrero wrote:
> Yes, it is possible, but currently it's not looking for the debug
> library with a different name, just in a different path that is
> unlikely to exist in a Unix system.

The fact that a separate find_library is called for it and the result
is stored in a separate (user-settable) cache entry means that it is
possible to get two different values.  This convention is well established
in several find modules.

> Having the PROTOBUF_LIBRARIES variable getting the afore mentioned
> value messes up the client code using `find_package(Protobuf)` on Unix.

The only supported use for PROTOBUF_LIBRARIES is to pass it to
target_link_libraries, and that interprets the 'optimized' and 'debug'
keywords.  This is shown in the module documentation example:

    target_link_libraries(bar ${PROTOBUF_LIBRARIES})

The documentation makes no other guarantees about the variable value.

-Brad



More information about the cmake-developers mailing list