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
6aa981f9
Commit
6aa981f9
authored
Jun 07, 2016
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1624 from yeswalrus/cmake-prerelease-versioning
CMake prerelease versioning
parents
dfe0c9ad
0420eab1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
17 deletions
+30
-17
CMakeLists.txt
cmake/CMakeLists.txt
+8
-1
protobuf-config-version.cmake.in
cmake/protobuf-config-version.cmake.in
+22
-16
No files found.
cmake/CMakeLists.txt
View file @
6aa981f9
...
...
@@ -51,17 +51,24 @@ string(REGEX REPLACE "${protobuf_AC_INIT_REGEX}" "\\2"
string
(
REGEX REPLACE
"
${
protobuf_AC_INIT_REGEX
}
"
"
\\
3"
protobuf_CONTACT
"
${
protobuf_AC_INIT_LINE
}
"
)
# Parse version tweaks
set
(
protobuf_VERSION_REGEX
"^([0-9]+)
\\
.([0-9]+)
\\
.([0-9]+)
.*
$"
)
set
(
protobuf_VERSION_REGEX
"^([0-9]+)
\\
.([0-9]+)
\\
.([0-9]+)
-?(.*)
$"
)
string
(
REGEX REPLACE
"
${
protobuf_VERSION_REGEX
}
"
"
\\
1"
protobuf_VERSION_MAJOR
"
${
protobuf_VERSION_STRING
}
"
)
string
(
REGEX REPLACE
"
${
protobuf_VERSION_REGEX
}
"
"
\\
2"
protobuf_VERSION_MINOR
"
${
protobuf_VERSION_STRING
}
"
)
string
(
REGEX REPLACE
"
${
protobuf_VERSION_REGEX
}
"
"
\\
3"
protobuf_VERSION_PATCH
"
${
protobuf_VERSION_STRING
}
"
)
string
(
REGEX REPLACE
"
${
protobuf_VERSION_REGEX
}
"
"
\\
4"
protobuf_VERSION_PRERELEASE
"
${
protobuf_VERSION_STRING
}
"
)
# Package version
set
(
protobuf_VERSION
"
${
protobuf_VERSION_MAJOR
}
.
${
protobuf_VERSION_MINOR
}
.
${
protobuf_VERSION_PATCH
}
"
)
if
(
protobuf_VERSION_PRERELEASE
)
set
(
protobuf_VERSION
"
${
protobuf_VERSION
}
-
${
protobuf_VERSION_PRERELEASE
}
"
)
endif
()
if
(
protobuf_VERBOSE
)
message
(
STATUS
"Configuration script parsing status ["
)
message
(
STATUS
" Description :
${
protobuf_DESCRIPTION
}
"
)
...
...
cmake/protobuf-config-version.cmake.in
View file @
6aa981f9
# This is a basic version file for the Config-mode of find_package().
# It is derived from the format suggested in the CMake module
# CMakePackageConfigHelpers. introduced in CMake 2.8.8.
# If the cmake_minimum_required version is ever bumped to 2.8.8 or
# above, this file may be deleted and replaced with a call to
# write_basic_package_version_file(...)
set(PACKAGE_VERSION "@protobuf_VERSION@")
set(PACKAGE_VERSION @protobuf_VERSION@)
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE) #Assume true until shown otherwise
if(PACKAGE_FIND_VERSION_MAJOR STREQUAL @protobuf_VERSION_MAJOR@)
set(PACKAGE_VERSION_COMPATIBLE TRUE)
else()
# Handle prerelease versions
set(PACKAGE_FIND_VERSION_PRERELEASE "${${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE}")
if(NOT "@protobuf_VERSION_PRERELEASE@" STREQUAL "")
if(NOT ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
message(AUTHOR_WARNING "To use this prerelease version of ${PACKAGE_FIND_NAME}, set ${PACKAGE_FIND_NAME}_FIND_VERSION_PRERELEASE to '@protobuf_VERSION_PRERELEASE@'.")
endif()
if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
if(NOT "${PACKAGE_FIND_VERSION}-${PACKAGE_FIND_VERSION_PRERELEASE}" STREQUAL "${PACKAGE_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_EXACT TRUE)
endif()
else()
if(NOT PACKAGE_FIND_VERSION_MAJOR EQUAL "@protobuf_VERSION_MAJOR@")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
elseif(PACKAGE_FIND_VERSION VERSION_GREATER PACKAGE_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
endif()
endif()
# if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it:
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "@CMAKE_SIZEOF_VOID_P@" STREQUAL "")
return()
...
...
@@ -34,3 +38,5 @@ if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@")
set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)")
set(PACKAGE_VERSION_UNSUITABLE TRUE)
endif()
set(${PACKAGE_FIND_NAME}_VERSION_PRERELEASE "@protobuf_VERSION_PRERELEASE@" PARENT_SCOPE)
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