aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/install.cmake
diff options
context:
space:
mode:
authorGravatar Konstantin Podsvirov <konstantin@podsvirov.pro>2016-06-01 17:00:08 +0300
committerGravatar Konstantin Podsvirov <konstantin@podsvirov.pro>2016-06-04 00:10:07 +0300
commit71556295ffe315be34ce70e1a6821860fb088f07 (patch)
tree2429940c0d78972693670df9aea755cf23ec9d59 /cmake/install.cmake
parent20b532544fde1dff34429b52db95c3a96409b73c (diff)
CMake project updates
A series of improvements: - Improved Protobuf module compatibility (disabled by default); - Hide advanced settings; - Added build tree configuration; - Added build of examples.
Diffstat (limited to 'cmake/install.cmake')
-rw-r--r--cmake/install.cmake25
1 files changed, 19 insertions, 6 deletions
diff --git a/cmake/install.cmake b/cmake/install.cmake
index a5040b22..6d7aa1e0 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -87,22 +87,35 @@ if(NOT MSVC)
else()
set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}")
endif()
+mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
+# Import configuration
install(EXPORT protobuf-targets
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
NAMESPACE protobuf::
COMPONENT protobuf-export)
configure_file(protobuf-config.cmake.in
- protobuf-config.cmake @ONLY)
+ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
configure_file(protobuf-config-version.cmake.in
- protobuf-config-version.cmake @ONLY)
+ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
configure_file(protobuf-module.cmake.in
- protobuf-module.cmake @ONLY)
+ ${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
+
+# Build tree import configuration (for import from subprojects)
+if(NOT EXISTS "${protobuf_DIR}")
+ set(protobuf_DIR "${protobuf_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}")
+ set(Protobuf_DIR "${protobuf_DIR}")
+ file(COPY
+ "${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake"
+ DESTINATION "${protobuf_DIR}")
+endif()
install(FILES
- "${protobuf_BINARY_DIR}/protobuf-config.cmake"
- "${protobuf_BINARY_DIR}/protobuf-config-version.cmake"
- "${protobuf_BINARY_DIR}/protobuf-module.cmake"
+ "${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake"
+ "${protobuf_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake"
+ "${protobuf_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake"
+ "${protobuf_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake"
DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
COMPONENT protobuf-export)