summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-05-19 18:17:47 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-05-19 18:17:50 (GMT)
commit561e5edc3c63495bb7f9d09b5b1fda136bc07cf4 (patch)
tree0398b138b49cd644cdca4142894707d68efca425 /Modules
parenta2f1c8bd98decaaf7402519217dbf0fd386f92ff (diff)
parent37627217082be815cb42611d1d23721ad0799c5c (diff)
downloadCMake-561e5edc3c63495bb7f9d09b5b1fda136bc07cf4.zip
CMake-561e5edc3c63495bb7f9d09b5b1fda136bc07cf4.tar.gz
CMake-561e5edc3c63495bb7f9d09b5b1fda136bc07cf4.tar.bz2
Merge topic 'FindProtobuf-targets'
37627217 Help: Add notes for topic 'FindProtobuf-targets' e4e1d194 FindProtobuf: add tests f29635b6 FindProtobuf: add targets Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !861
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindProtobuf.cmake81
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)