Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | From 4ea11e0d7c0575316a6ccc07a931164ca29c3d2f Mon Sep 17 00:00:00 2001 |
| 2 | From: Corentin Le Molgat <corentinl@google.com> |
| 3 | Date: Mon, 29 Jan 2018 14:59:08 +0100 |
| 4 | Subject: [PATCH] Rework CMake glog VERSION management. |
| 5 | |
| 6 | - Use of Project version properties instead of custom variables |
| 7 | - fix missmatch between VERSION (build version) and SOVERSION (API version) |
| 8 | src: https://cmake.org/cmake/help/latest/prop_tgt/VERSION.html#prop_tgt:VERSION |
| 9 | |
| 10 | Upstream-Status: Backport [https://github.com/google/glog/commit/6b6e38a7d53fe01f42ce34384cf4ba4c50e8cb65] |
| 11 | Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> |
| 12 | --- |
| 13 | CMakeLists.txt | 23 ++++++++--------------- |
| 14 | 1 file changed, 8 insertions(+), 15 deletions(-) |
| 15 | |
| 16 | diff --git a/CMakeLists.txt b/CMakeLists.txt |
| 17 | index 7415eab..fb4e408 100644 |
| 18 | --- a/CMakeLists.txt |
| 19 | +++ b/CMakeLists.txt |
| 20 | @@ -8,23 +8,16 @@ if (POLICY CMP0063) |
| 21 | cmake_policy (SET CMP0063 NEW) |
| 22 | endif (POLICY CMP0063) |
| 23 | |
| 24 | -project (google-glog) |
| 25 | +project(glog VERSION 0.3.5 LANGUAGES C CXX) |
| 26 | |
| 27 | enable_testing () |
| 28 | |
| 29 | -set (GLOG_MAJOR_VERSION 0) |
| 30 | -set (GLOG_MINOR_VERSION 3) |
| 31 | -set (GLOG_PATCH_VERSION 5) |
| 32 | - |
| 33 | -set (GLOG_VERSION |
| 34 | - ${GLOG_MAJOR_VERSION}.${GLOG_MINOR_VERSION}.${GLOG_PATCH_VERSION}) |
| 35 | - |
| 36 | set (CPACK_PACKAGE_NAME glog) |
| 37 | set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "") |
| 38 | -set (CPACK_PACKAGE_VERSION_MAJOR ${GLOG_MAJOR_VERSION}) |
| 39 | -set (CPACK_PACKAGE_VERSION_MINOR ${GLOG_MINOR_VERSION}) |
| 40 | -set (CPACK_PACKAGE_VERSION_PATCH ${GLOG_PATCH_VERSION}) |
| 41 | -set (CPACK_PACKAGE_VERSION ${GLOG_VERSION}) |
| 42 | +set (CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) |
| 43 | +set (CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) |
| 44 | +set (CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) |
| 45 | +set (CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
| 46 | |
| 47 | option (WITH_GFLAGS "Use gflags" ON) |
| 48 | option (WITH_THREADS "Enable multithreading support" ON) |
| 49 | @@ -406,8 +399,8 @@ if (gflags_FOUND) |
| 50 | endif (NOT BUILD_SHARED_LIBS) |
| 51 | endif (gflags_FOUND) |
| 52 | |
| 53 | -set_target_properties (glog PROPERTIES VERSION ${GLOG_MAJOR_VERSION}) |
| 54 | -set_target_properties (glog PROPERTIES SOVERSION ${GLOG_VERSION}) |
| 55 | +set_target_properties (glog PROPERTIES VERSION ${PROJECT_VERSION}) |
| 56 | +set_target_properties (glog PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}) |
| 57 | |
| 58 | if (WIN32) |
| 59 | target_compile_definitions (glog PUBLIC GLOG_NO_ABBREVIATED_SEVERITIES) |
| 60 | @@ -570,7 +563,7 @@ configure_package_config_file (glog-config.cmake.in |
| 61 | NO_CHECK_REQUIRED_COMPONENTS_MACRO) |
| 62 | |
| 63 | write_basic_package_version_file (glog-config-version.cmake VERSION |
| 64 | - ${GLOG_VERSION} COMPATIBILITY SameMajorVersion) |
| 65 | + ${PROJECT_VERSION} COMPATIBILITY SameMajorVersion) |
| 66 | |
| 67 | export (TARGETS glog NAMESPACE glog:: FILE glog-targets.cmake) |
| 68 | export (PACKAGE glog) |
| 69 | -- |
| 70 | 2.17.1 |
| 71 | |