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