Skip to content

Commit

Permalink
CMake: Use cmake project version variables
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed May 18, 2020
1 parent 2ba4d79 commit 79e4046
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
cmake_minimum_required(VERSION 3.3)
project(qxmpp)
project(qxmpp VERSION 1.4.0)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 4)
set(VERSION_PATCH 0)
set(SO_VERSION 3)
set(VERSION_STRING ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH VERSION_STRING)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules")
Expand Down Expand Up @@ -49,7 +44,7 @@ configure_package_config_file(

write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/QXmppConfigVersion.cmake
VERSION ${VERSION_STRING}
VERSION ${PROJECT_VERSION}
COMPATIBILITY SameMajorVersion
)

Expand Down
2 changes: 1 addition & 1 deletion doc/Doxyfile.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PROJECT_NAME = "QXmpp"
PROJECT_NUMBER = Version:@VERSION_STRING@
PROJECT_NUMBER = "Version: @PROJECT_VERSION@"
INPUT = @PROJECT_SOURCE_DIR@/doc/index.doc \
@PROJECT_SOURCE_DIR@/doc/using.doc \
@PROJECT_SOURCE_DIR@/doc/xep.doc \
Expand Down
4 changes: 2 additions & 2 deletions qxmpp.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/qxmpp


Name: Qxmpp
Description: Qxmpp Library
Version: @VERSION_STRING@
Description: QXmpp Library
Version: @PROJECT_VERSION@
Libs: -lqxmpp
Libs.private: -lQt5Network -lQt5Xml -lQt5Core
Cflags: -I${includedir}
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ else()
endif()

set_target_properties(qxmpp PROPERTIES
VERSION ${VERSION_STRING}
VERSION ${PROJECT_VERSION}
SOVERSION ${SO_VERSION}
EXPORT_NAME QXmpp
)
Expand Down
6 changes: 3 additions & 3 deletions src/base/QXmppGlobal.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,17 @@
/// available.
///

#define QXMPP_VERSION QT_VERSION_CHECK(@VERSION_MAJOR@, @VERSION_MINOR@, @VERSION_PATCH@)
#define QXMPP_VERSION QT_VERSION_CHECK(@PROJECT_VERSION_MAJOR@, @PROJECT_VERSION_MINOR@, @PROJECT_VERSION_PATCH@)

inline QLatin1String QXmppVersion()
{
return QLatin1String("@VERSION_STRING@");
return QLatin1String("@PROJECT_VERSION@");
}

// This sets which deprecated functions should still be usable
// It works exactly like QT_DISABLE_DEPRECATED_BEFORE
#ifndef QXMPP_DISABLE_DEPRECATED_BEFORE
# define QXMPP_DISABLE_DEPRECATED_BEFORE 0x@VERSION_MAJOR@ << 16
# define QXMPP_DISABLE_DEPRECATED_BEFORE 0x0
#endif

// This works exactly like QT_DEPRECATED_SINCE, but checks QXMPP_DISABLE_DEPRECATED_BEFORE instead.
Expand Down

0 comments on commit 79e4046

Please sign in to comment.