Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(799)

Side by Side Diff: third_party/protobuf/cmake/install.cmake

Issue 2599263002: third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Address comments Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 include(GNUInstallDirs) 1 include(GNUInstallDirs)
2 2
3 foreach(_library 3 foreach(_library
4 libprotobuf-lite 4 libprotobuf-lite
5 libprotobuf 5 libprotobuf
6 libprotoc) 6 libprotoc)
7 set_property(TARGET ${_library} 7 set_property(TARGET ${_library}
8 PROPERTY INTERFACE_INCLUDE_DIRECTORIES 8 PROPERTY INTERFACE_INCLUDE_DIRECTORIES
9 $<BUILD_INTERFACE:${protobuf_source_dir}/src>
9 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) 10 $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
10 install(TARGETS ${_library} EXPORT protobuf-targets 11 install(TARGETS ${_library} EXPORT protobuf-targets
11 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library} 12 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT ${_library}
12 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library} 13 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}
13 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library}) 14 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT ${_library})
14 endforeach() 15 endforeach()
15 16
16 install(TARGETS protoc EXPORT protobuf-targets 17 install(TARGETS protoc EXPORT protobuf-targets
17 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc) 18 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
18 19
19 if(TRUE) 20 file(STRINGS extract_includes.bat.in _extract_strings
20 file(STRINGS extract_includes.bat.in _extract_strings 21 REGEX "^copy")
21 REGEX "^copy") 22 foreach(_extract_string ${_extract_strings})
22 foreach(_extract_string ${_extract_strings}) 23 string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" ""
23 string(REPLACE "copy \${PROTOBUF_SOURCE_WIN32_PATH}\\" "" 24 _extract_string ${_extract_string})
24 _extract_string ${_extract_string}) 25 string(REPLACE "\\" "/" _extract_string ${_extract_string})
25 string(REPLACE "\\" "/" _extract_string ${_extract_string}) 26 string(REGEX MATCH "^[^ ]+"
26 string(REGEX MATCH "^[^ ]+" 27 _extract_from ${_extract_string})
27 _extract_from ${_extract_string}) 28 string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1"
28 string(REGEX REPLACE "^${_extract_from} ([^$]+)" "\\1" 29 _extract_to ${_extract_string})
29 _extract_to ${_extract_string}) 30 get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from}" ABSOLUTE)
30 get_filename_component(_extract_from "${protobuf_SOURCE_DIR}/${_extract_from }" ABSOLUTE) 31 get_filename_component(_extract_name ${_extract_to} NAME)
31 get_filename_component(_extract_name ${_extract_to} NAME) 32 get_filename_component(_extract_to ${_extract_to} PATH)
32 get_filename_component(_extract_to ${_extract_to} PATH) 33 string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/"
33 string(REPLACE "include/" "${CMAKE_INSTALL_INCLUDEDIR}/" 34 _extract_to "${_extract_to}")
34 _extract_to "${_extract_to}") 35 if(EXISTS "${_extract_from}")
35 if(EXISTS "${_extract_from}") 36 install(FILES "${_extract_from}"
36 install(FILES "${_extract_from}" 37 DESTINATION "${_extract_to}"
37 DESTINATION "${_extract_to}" 38 COMPONENT protobuf-headers
38 COMPONENT protobuf-headers 39 RENAME "${_extract_name}")
39 RENAME "${_extract_name}") 40 else()
40 else() 41 message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in "
41 message(AUTHOR_WARNING "The file \"${_extract_from}\" is listed in " 42 "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" "
42 "\"${protobuf_SOURCE_DIR}/cmake/extract_includes.bat.in\" " 43 "but there not exists. The file will not be installed.")
43 "but there not exists. The file will not be installed.") 44 endif()
44 endif() 45 endforeach()
45 endforeach()
46 endif()
47 46
48 # Internal function for parsing auto tools scripts 47 # Internal function for parsing auto tools scripts
49 function(_protobuf_auto_list FILE_NAME VARIABLE) 48 function(_protobuf_auto_list FILE_NAME VARIABLE)
50 file(STRINGS ${FILE_NAME} _strings) 49 file(STRINGS ${FILE_NAME} _strings)
51 set(_list) 50 set(_list)
52 foreach(_string ${_strings}) 51 foreach(_string ${_strings})
53 set(_found) 52 set(_found)
54 string(REGEX MATCH "^[ \t]*${VARIABLE}[ \t]*=[ \t]*" _found "${_string}") 53 string(REGEX MATCH "^[ \t]*${VARIABLE}[ \t]*=[ \t]*" _found "${_string}")
55 if(_found) 54 if(_found)
56 string(LENGTH "${_found}" _length) 55 string(LENGTH "${_found}" _length)
(...skipping 18 matching lines...) Expand all
75 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_file_path}" 74 DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_file_path}"
76 COMPONENT protobuf-protos 75 COMPONENT protobuf-protos
77 RENAME "${_file_name}") 76 RENAME "${_file_name}")
78 else() 77 else()
79 message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in " 78 message(AUTHOR_WARNING "The file \"${_file_from}\" is listed in "
80 "\"${protobuf_SOURCE_DIR}/../src/Makefile.am\" as nobase_dist_proto_DATA " 79 "\"${protobuf_SOURCE_DIR}/../src/Makefile.am\" as nobase_dist_proto_DATA "
81 "but there not exists. The file will not be installed.") 80 "but there not exists. The file will not be installed.")
82 endif() 81 endif()
83 endforeach() 82 endforeach()
84 83
85 # Export configuration 84 # Install configuration
85 set(_cmakedir_desc "Directory relative to CMAKE_INSTALL to install the cmake con figuration files")
86 if(NOT MSVC)
87 set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/protobuf" CACHE STRI NG "${_cmakedir_desc}")
88 else()
89 set(CMAKE_INSTALL_CMAKEDIR "cmake" CACHE STRING "${_cmakedir_desc}")
90 endif()
91 mark_as_advanced(CMAKE_INSTALL_CMAKEDIR)
92
93 configure_file(protobuf-config.cmake.in
94 ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config.cmake @ONLY)
95 configure_file(protobuf-config-version.cmake.in
96 ${CMAKE_INSTALL_CMAKEDIR}/protobuf-config-version.cmake @ONLY)
97 configure_file(protobuf-module.cmake.in
98 ${CMAKE_INSTALL_CMAKEDIR}/protobuf-module.cmake @ONLY)
99 configure_file(protobuf-options.cmake
100 ${CMAKE_INSTALL_CMAKEDIR}/protobuf-options.cmake @ONLY)
101
102 # Allows the build directory to be used as a find directory.
103 export(TARGETS libprotobuf-lite libprotobuf libprotoc protoc
104 NAMESPACE protobuf::
105 FILE ${CMAKE_INSTALL_CMAKEDIR}/protobuf-targets.cmake
106 )
86 107
87 install(EXPORT protobuf-targets 108 install(EXPORT protobuf-targets
88 DESTINATION "lib/cmake/protobuf" 109 DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
110 NAMESPACE protobuf::
89 COMPONENT protobuf-export) 111 COMPONENT protobuf-export)
90 112
91 configure_file(protobuf-config.cmake.in 113 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_CMAKEDIR}/
92 protobuf-config.cmake @ONLY) 114 DESTINATION "${CMAKE_INSTALL_CMAKEDIR}"
93 configure_file(protobuf-config-version.cmake.in 115 COMPONENT protobuf-export
94 protobuf-config-version.cmake @ONLY) 116 PATTERN protobuf-targets.cmake EXCLUDE
95 configure_file(protobuf-module.cmake.in 117 )
96 protobuf-module.cmake @ONLY)
97 118
98 install(FILES 119 option(protobuf_INSTALL_EXAMPLES "Install the examples folder" OFF)
99 "${protobuf_BINARY_DIR}/protobuf-config.cmake" 120 if(protobuf_INSTALL_EXAMPLES)
100 "${protobuf_BINARY_DIR}/protobuf-config-version.cmake" 121 install(DIRECTORY ../examples/ DESTINATION examples
101 "${protobuf_BINARY_DIR}/protobuf-module.cmake" 122 COMPONENT protobuf-examples)
102 DESTINATION "lib/cmake/protobuf" 123 endif()
103 COMPONENT protobuf-export)
OLDNEW
« no previous file with comments | « third_party/protobuf/cmake/extract_includes.bat.in ('k') | third_party/protobuf/cmake/libprotobuf.cmake » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698