Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
ebfca175
Commit
ebfca175
authored
Aug 03, 2015
by
Konstantin Podsvirov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Install well-known type proto files from CMake project
parent
0be07890
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
3 deletions
+57
-3
install.cmake
cmake/install.cmake
+46
-2
protobuf-module.cmake.in
cmake/protobuf-module.cmake.in
+11
-1
No files found.
cmake/install.cmake
View file @
ebfca175
...
...
@@ -5,7 +5,8 @@ foreach(_library
libprotobuf
libprotoc
)
set_property
(
TARGET
${
_library
}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES $<INSTALL_INTERFACE:include>
)
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
$<INSTALL_INTERFACE:
${
CMAKE_INSTALL_INCLUDEDIR
}
>
)
install
(
TARGETS
${
_library
}
EXPORT protobuf-targets
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
COMPONENT
${
_library
}
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
COMPONENT
${
_library
}
...
...
@@ -29,6 +30,8 @@ if(MSVC)
get_filename_component
(
_extract_from
"
${
protobuf_SOURCE_DIR
}
/
${
_extract_from
}
"
ABSOLUTE
)
get_filename_component
(
_extract_name
${
_extract_to
}
NAME
)
get_filename_component
(
_extract_to
${
_extract_to
}
PATH
)
string
(
REPLACE
"include/"
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/"
_extract_to
"
${
_extract_to
}
"
)
if
(
EXISTS
"
${
_extract_from
}
"
)
install
(
FILES
"
${
_extract_from
}
"
DESTINATION
"
${
_extract_to
}
"
...
...
@@ -42,6 +45,45 @@ if(MSVC)
endforeach
()
endif
()
# Internal function for parsing auto tools scripts
function
(
_protobuf_auto_list FILE_NAME VARIABLE
)
file
(
STRINGS
${
FILE_NAME
}
_strings
)
set
(
_list
)
foreach
(
_string
${
_strings
}
)
set
(
_found
)
string
(
REGEX MATCH
"^[
\t
]*
${
VARIABLE
}
[
\t
]*=[
\t
]*"
_found
"
${
_string
}
"
)
if
(
_found
)
string
(
LENGTH
"
${
_found
}
"
_length
)
string
(
SUBSTRING
"
${
_string
}
"
${
_length
}
-1 _draft_list
)
foreach
(
_item
${
_draft_list
}
)
string
(
STRIP
"
${
_item
}
"
_item
)
list
(
APPEND _list
"
${
_item
}
"
)
endforeach
()
endif
()
endforeach
()
set
(
${
VARIABLE
}
${
_list
}
PARENT_SCOPE
)
endfunction
()
# Install well-known type proto files
_protobuf_auto_list
(
"../src/Makefile.am"
nobase_dist_proto_DATA
)
foreach
(
_file
${
nobase_dist_proto_DATA
}
)
get_filename_component
(
_file_from
"../src/
${
_file
}
"
ABSOLUTE
)
get_filename_component
(
_file_name
${
_file
}
NAME
)
get_filename_component
(
_file_path
${
_file
}
PATH
)
if
(
EXISTS
"
${
_file_from
}
"
)
install
(
FILES
"
${
_file_from
}
"
DESTINATION
"
${
CMAKE_INSTALL_INCLUDEDIR
}
/
${
_file_path
}
"
COMPONENT protobuf-protos
RENAME
"
${
_file_name
}
"
)
else
()
message
(
AUTHOR_WARNING
"The file
\"
${
_file_from
}
\"
is listed in "
"
\"
${
protobuf_SOURCE_DIR
}
/../src/Makefile.am
\"
as nobase_dist_proto_DATA "
"but there not exists. The file will not be installed."
)
endif
()
endforeach
()
# Export configuration
install
(
EXPORT protobuf-targets
DESTINATION
"lib/cmake/protobuf"
COMPONENT protobuf-export
)
...
...
@@ -50,10 +92,12 @@ configure_file(protobuf-config.cmake.in
protobuf-config.cmake @ONLY
)
configure_file
(
protobuf-config-version.cmake.in
protobuf-config-version.cmake @ONLY
)
configure_file
(
protobuf-module.cmake.in
protobuf-module.cmake @ONLY
)
install
(
FILES
"
${
protobuf_BINARY_DIR
}
/protobuf-config.cmake"
"
${
protobuf_BINARY_DIR
}
/protobuf-config-version.cmake"
"
${
protobuf_
SOURCE
_DIR
}
/protobuf-module.cmake"
"
${
protobuf_
BINARY
_DIR
}
/protobuf-module.cmake"
DESTINATION
"lib/cmake/protobuf"
COMPONENT protobuf-export
)
cmake/protobuf-module.cmake
→
cmake/protobuf-module.cmake
.in
View file @
ebfca175
...
...
@@ -23,6 +23,10 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS)
set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR})
endif()
# Add well-nkown type protos include path
list(APPEND _protobuf_include_path
-I "${_PROTOBUF_IMPORT_PREFIX}/@CMAKE_INSTALL_INCLUDEDIR@")
if(DEFINED PROTOBUF_IMPORT_DIRS)
foreach(DIR ${PROTOBUF_IMPORT_DIRS})
get_filename_component(ABS_PATH ${DIR} ABSOLUTE)
...
...
@@ -63,8 +67,10 @@ endfunction()
function(_protobuf_find_libraries name filename)
get_target_property(${name}_LIBRARY lib${filename}
IMPORTED_LOCATION_RELEASE)
set(${name}_LIBRARY "${${name}_LIBRARY}" PARENT_SCOPE)
get_target_property(${name}_LIBRARY_DEBUG lib${filename}
IMPORTED_LOCATION_DEBUG)
set(${name}_LIBRARY_DEBUG "${${name}_LIBRARY_DEBUG}" PARENT_SCOPE)
if(NOT ${name}_LIBRARY_DEBUG)
# There is no debug library
...
...
@@ -114,11 +120,15 @@ if(UNIX)
endif()
# Set the include directory
set
(
PROTOBUF_INCLUDE_DIR
"
${
_PROTOBUF_IMPORT_PREFIX
}
/
include
"
)
set(PROTOBUF_INCLUDE_DIR "${_PROTOBUF_IMPORT_PREFIX}/
@CMAKE_INSTALL_INCLUDEDIR@
")
# Set the protoc Executable
get_target_property(PROTOBUF_PROTOC_EXECUTABLE protoc
IMPORTED_LOCATION_RELEASE)
if(NOT PROTOBUF_PROTOC_EXECUTABLE)
get_target_property(PROTOBUF_PROTOC_EXECUTABLE protoc
IMPORTED_LOCATION_DEBUG)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PROTOBUF DEFAULT_MSG
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment