Skip to content

Commit ae7867f

Browse files
committedJan 7, 2016
cmake: Add release versioning variables
Also use shared library versioning .so.x.y.z To create a new release, edit the main CMakeLists.txt and change PROJECT_VER_PATCH, _MINOR, or _MAJOR. CMake's builtin PROJECT_VERSION_* variables are not backward compatible and not used here.
1 parent 5765716 commit ae7867f

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed
 

‎CMakeLists.txt

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1)
22

3+
SET(PROJECT_VER_MAJOR 0)
4+
SET(PROJECT_VER_MINOR 1)
5+
SET(PROJECT_VER_PATCH 0)
6+
SET(PROJECT_VER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}.${PROJECT_VER_PATCH}")
7+
SET(PROJECT_APIVER "${PROJECT_VER_MAJOR}.${PROJECT_VER_MINOR}")
8+
39
if(WIN32 AND NOT MINGW)
410
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
511
set(CMAKE_DEBUG_POSTFIX "d")
@@ -214,9 +220,9 @@ ENDIF(ENABLE_OPENCL)
214220
# Both command line -DCMAKE_INSTALL_RPATH=... and CMake GUI settings are accepted.
215221
#
216222
# Anyway if wrong versions of libusb is used, errors will be reported explicitly.
217-
IF(NOT DEFINED CMAKE_INSTALL_RPATH)
223+
IF(NOT DEFINED CMAKE_INSTALL_RPATH AND NOT ${LibUSB_LIBDIR} MATCHES "^/usr/lib")
218224
SET(CMAKE_INSTALL_RPATH ${LibUSB_LIBDIR} CACHE STRING "Set RPATH for a private libusb")
219-
ELSE()
225+
ELSEIF(DEFINED CMAKE_INSTALL_RPATH)
220226
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} CACHE STRING "Set RPATH for a private libusb")
221227
ENDIF()
222228
IF(DEFINED CMAKE_INSTALL_RPATH)
@@ -231,6 +237,8 @@ ADD_LIBRARY(freenect2 ${SOURCES})
231237
SET_TARGET_PROPERTIES(freenect2 PROPERTIES
232238
CXX_VISIBILITY_PRESET hidden
233239
VISIBILITY_INLINES_HIDDEN 1
240+
VERSION ${PROJECT_VER}
241+
SOVERSION ${PROJECT_APIVER}
234242
)
235243
INCLUDE(GenerateExportHeader)
236244
GENERATE_EXPORT_HEADER(freenect2

‎doc/Doxyfile.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
DOXYFILE_ENCODING = UTF-8
22
PROJECT_NAME = @PROJECT_NAME@
3-
PROJECT_NUMBER = @PROJECT_VERSION@
3+
PROJECT_NUMBER = @PROJECT_APIVER@
44
PROJECT_BRIEF =
55
PROJECT_LOGO =
66
OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@

‎freenect2.cmake.in

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ FIND_PATH(freenect2_INCLUDE_DIR @PROJECT_NAME@/libfreenect2.hpp
88
NO_DEFAULT_PATH
99
)
1010
SET(freenect2_INCLUDE_DIRS ${freenect2_INCLUDE_DIR})
11+
SET(freenect2_VERSION @PROJECT_VER@)

‎freenect2.pc.in

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ includedir=${prefix}/include
55

66
Name: freenect2
77
Description: Driver for the Kinect v2 (aka K4W)
8-
Version:
9-
Requires: @DEPS_PKGCONFIG@
8+
Version: @PROJECT_VER@
109
Libs: -L${libdir} -lfreenect2
1110
Cflags: -I${includedir}
1211

0 commit comments

Comments
 (0)
Please sign in to comment.