diff options
author | André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de> | 2017-05-17 08:04:12 (GMT) |
---|---|---|
committer | André Apitzsch <andre.apitzsch@etit.tu-chemnitz.de> | 2017-05-18 11:57:01 (GMT) |
commit | f29635b66746324e1d6e1f17097dd7bd4ed347b0 (patch) | |
tree | 902901cb6b24e97c7a0bea6467410c90dbb985eb /Modules/FindProtobuf.cmake | |
parent | d1233a38cb70e6ca6c4e6062407d8f95379b877a (diff) | |
download | CMake-f29635b66746324e1d6e1f17097dd7bd4ed347b0.zip CMake-f29635b66746324e1d6e1f17097dd7bd4ed347b0.tar.gz CMake-f29635b66746324e1d6e1f17097dd7bd4ed347b0.tar.bz2 |
FindProtobuf: add targets
Diffstat (limited to 'Modules/FindProtobuf.cmake')
-rw-r--r-- | Modules/FindProtobuf.cmake | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 102ed42..6dc0444 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -40,6 +40,15 @@ # ``Protobuf_LITE_LIBRARIES`` # The protobuf-lite libraries # +# The following :prop_tgt:`IMPORTED` targets are also defined: +# +# ``Protobuf::protobuf`` +# The protobuf library. +# ``Protobuf::protobuf-lite`` +# The protobuf lite library. +# ``Protobuf::protoc`` +# The protoc library. +# # The following cache variables are also available to set or use: # # ``Protobuf_LIBRARY`` @@ -409,6 +418,78 @@ if(Protobuf_INCLUDE_DIR) message(WARNING "Protobuf compiler version ${_PROTOBUF_PROTOC_EXECUTABLE_VERSION}" " doesn't match library version ${Protobuf_VERSION}") endif() + + if(Protobuf_LIBRARY) + if(NOT TARGET Protobuf::protobuf) + add_library(Protobuf::protobuf UNKNOWN IMPORTED) + set_target_properties(Protobuf::protobuf PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}") + if(EXISTS "${Protobuf_LIBRARY}") + set_target_properties(Protobuf::protobuf PROPERTIES + IMPORTED_LOCATION "${Protobuf_LIBRARY}") + endif() + if(EXISTS "${Protobuf_LIBRARY_RELEASE}") + set_property(TARGET Protobuf::protobuf APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Protobuf::protobuf PROPERTIES + IMPORTED_LOCATION_RELEASE "${Protobuf_LIBRARY_RELEASE}") + endif() + if(EXISTS "${Protobuf_LIBRARY_DEBUG}") + set_property(TARGET Protobuf::protobuf APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Protobuf::protobuf PROPERTIES + IMPORTED_LOCATION_DEBUG "${Protobuf_LIBRARY_DEBUG}") + endif() + endif() + endif() + + if(Protobuf_LITE_LIBRARY) + if(NOT TARGET Protobuf::protobuf-lite) + add_library(Protobuf::protobuf-lite UNKNOWN IMPORTED) + set_target_properties(Protobuf::protobuf-lite PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}") + if(EXISTS "${Protobuf_LITE_LIBRARY}") + set_target_properties(Protobuf::protobuf-lite PROPERTIES + IMPORTED_LOCATION "${Protobuf_LITE_LIBRARY}") + endif() + if(EXISTS "${Protobuf_LITE_LIBRARY_RELEASE}") + set_property(TARGET Protobuf::protobuf-lite APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Protobuf::protobuf-lite PROPERTIES + IMPORTED_LOCATION_RELEASE "${Protobuf_LITE_LIBRARY_RELEASE}") + endif() + if(EXISTS "${Protobuf_LITE_LIBRARY_DEBUG}") + set_property(TARGET Protobuf::protobuf-lite APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Protobuf::protobuf-lite PROPERTIES + IMPORTED_LOCATION_DEBUG "${Protobuf_LITE_LIBRARY_DEBUG}") + endif() + endif() + endif() + + if(Protobuf_PROTOC_LIBRARY) + if(NOT TARGET Protobuf::protoc) + add_library(Protobuf::protoc UNKNOWN IMPORTED) + set_target_properties(Protobuf::protoc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${Protobuf_INCLUDE_DIR}") + if(EXISTS "${Protobuf_PROTOC_LIBRARY}") + set_target_properties(Protobuf::protoc PROPERTIES + IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}") + endif() + if(EXISTS "${Protobuf_PROTOC_LIBRARY_RELEASE}") + set_property(TARGET Protobuf::protoc APPEND PROPERTY + IMPORTED_CONFIGURATIONS RELEASE) + set_target_properties(Protobuf::protoc PROPERTIES + IMPORTED_LOCATION_RELEASE "${Protobuf_PROTOC_LIBRARY_RELEASE}") + endif() + if(EXISTS "${Protobuf_PROTOC_LIBRARY_DEBUG}") + set_property(TARGET Protobuf::protoc APPEND PROPERTY + IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(Protobuf::protoc PROPERTIES + IMPORTED_LOCATION_DEBUG "${Protobuf_PROTOC_LIBRARY_DEBUG}") + endif() + endif() + endif() endif() include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) |