Skip to content

Commit ce40c39

Browse files
committed
Use the libtool versioning scheme for libWPEBackend
This is needed in preparation for the 1.0.0 release. VersioningUtils.cmake is imported from the WebKit source tree: https://trac.webkit.org/browser/webkit/trunk/Source/cmake/VersioningUtils.cmake Fixes #21
1 parent 6955316 commit ce40c39

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
cmake_minimum_required(VERSION 3.0)
22
cmake_policy(VERSION 3.0)
33

4-
project(wpebackend VERSION 0.2.0)
4+
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
5+
include(VersioningUtils)
56

7+
SET_PROJECT_VERSION(1 0 0)
68
set(WPE_API_VERSION "0.1")
79

8-
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
10+
# Before making a release, the LT_VERSION string should be modified.
11+
# The string is of the form C:R:A.
12+
# - If interfaces have been changed or added, but binary compatibility has
13+
# been preserved, change to C+1:0:A+1
14+
# - If binary compatibility has been broken (eg removed or changed interfaces)
15+
# change to C+1:0:0
16+
# - If the interface is the same as the previous version, change to C:R+1:A
17+
CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE(LIBWPEBACKEND 1 0 0)
18+
19+
project(wpebackend VERSION "${PROJECT_VERSION}")
20+
921
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -D_POSIX_SOURCE")
1022
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
1123

@@ -69,8 +81,8 @@ target_link_libraries(WPEBackend ${WPE_LIBRARIES})
6981

7082
set_target_properties(WPEBackend PROPERTIES
7183
OUTPUT_NAME WPEBackend-${WPE_API_VERSION}
72-
VERSION ${PROJECT_VERSION}
73-
SOVERSION ${PROJECT_VERSION_MAJOR}
84+
VERSION ${LIBWPEBACKEND_VERSION}
85+
SOVERSION ${LIBWPEBACKEND_VERSION_MAJOR}
7486
)
7587

7688
install(TARGETS WPEBackend

cmake/VersioningUtils.cmake

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
macro(SET_PROJECT_VERSION major minor micro)
2+
set(PROJECT_VERSION_MAJOR "${major}")
3+
set(PROJECT_VERSION_MINOR "${minor}")
4+
set(PROJECT_VERSION_MICRO "${micro}")
5+
set(PROJECT_VERSION "${major}.${minor}.${micro}")
6+
endmacro()
7+
8+
# Libtool library version, not to be confused with API version.
9+
# See http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
10+
macro(CALCULATE_LIBRARY_VERSIONS_FROM_LIBTOOL_TRIPLE library_name current revision age)
11+
math(EXPR ${library_name}_VERSION_MAJOR "${current} - ${age}")
12+
set(${library_name}_VERSION_MINOR ${age})
13+
set(${library_name}_VERSION_MICRO ${revision})
14+
set(${library_name}_VERSION ${${library_name}_VERSION_MAJOR}.${age}.${revision})
15+
endmacro()

0 commit comments

Comments
 (0)