aboutsummaryrefslogtreecommitdiff
path: root/cmake/protobuf-config.cmake.in
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2015-08-02 16:31:28 +0300
committerKonstantin Podsvirov <konstantin@podsvirov.pro>2015-08-02 16:31:28 +0300
commit0be0789018645de0b20f60b203d2627d8bc27159 (patch)
tree13673d7475e4fa65423aec0f72c730a704f06154 /cmake/protobuf-config.cmake.in
parent743ec448c5358a95d10e655ab256d7911e2145d5 (diff)
downloadprotobuf-0be0789018645de0b20f60b203d2627d8bc27159.tar.gz
protobuf-0be0789018645de0b20f60b203d2627d8bc27159.tar.bz2
protobuf-0be0789018645de0b20f60b203d2627d8bc27159.zip
CMake installation now compatible with origin FindProtobuf module
Diffstat (limited to 'cmake/protobuf-config.cmake.in')
-rw-r--r--cmake/protobuf-config.cmake.in28
1 files changed, 26 insertions, 2 deletions
diff --git a/cmake/protobuf-config.cmake.in b/cmake/protobuf-config.cmake.in
index 38fa58da..51d715cf 100644
--- a/cmake/protobuf-config.cmake.in
+++ b/cmake/protobuf-config.cmake.in
@@ -1,3 +1,27 @@
-set(protobuf_VERSION_STRING "@protobuf_VERSION_STRING@")
+# Version info variables
+set(PROTOBUF_VERSION "@protobuf_VERSION@")
+set(PROTOBUF_VERSION_STRING "@protobuf_VERSION_STRING@")
-include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")
+# Current dir
+get_filename_component(_PROTOBUF_PACKAGE_PREFIX
+ "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+# Imported targets
+include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-targets.cmake")
+
+# Compute the installation prefix relative to this file.
+get_filename_component(_PROTOBUF_IMPORT_PREFIX
+ "${_PROTOBUF_PACKAGE_PREFIX}" PATH)
+get_filename_component(_PROTOBUF_IMPORT_PREFIX
+ "${_PROTOBUF_IMPORT_PREFIX}" PATH)
+get_filename_component(_PROTOBUF_IMPORT_PREFIX
+ "${_PROTOBUF_IMPORT_PREFIX}" PATH)
+
+# CMake FindProtobuf module compatible file
+if(NOT DEFINED PROTOBUF_MODULE_COMPATIBLE OR "${PROTOBUF_MODULE_COMPATIBLE}")
+ include("${_PROTOBUF_PACKAGE_PREFIX}/protobuf-module.cmake")
+endif()
+
+# Cleanup temporary variables.
+set(_PROTOBUF_PACKAGE_PREFIX)
+set(_PROTOBUF_IMPORT_PREFIX)