Skip to content

Commit 1d49a63

Browse files
authored
CMake: add package version config file (#57)
By adding this file, client applications can have proper version checking support when calling 'find_package()'.
1 parent 7f5840f commit 1d49a63

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ on:
66
- "releases/**"
77
paths-ignore:
88
- "**.md"
9+
pull_request:
10+
paths-ignore:
11+
- "**.md"
912

1013
jobs:
1114
build:

CMakeLists.txt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.1)
22

3-
project(qhotkey VERSION 1.2.2 LANGUAGES CXX)
3+
project(qhotkey VERSION 1.4.2 LANGUAGES CXX)
44

55
option(QHOTKEY_EXAMPLES "Build examples" OFF)
66
option(QHOTKEY_INSTALL "Enable install rule" ON)
@@ -52,9 +52,18 @@ target_include_directories(qhotkey
5252
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/QHotkey>
5353
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
5454

55+
include(CMakePackageConfigHelpers)
56+
5557
set_target_properties(qhotkey PROPERTIES
5658
SOVERSION ${PROJECT_VERSION_MAJOR}
57-
VERSION ${PROJECT_VERSION})
59+
VERSION ${PROJECT_VERSION}
60+
INTERFACE_QHotkey_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}
61+
COMPATIBLE_INTERFACE_STRING QHotkey_MAJOR_VERSION)
62+
63+
write_basic_package_version_file(
64+
${CMAKE_CURRENT_BINARY_DIR}/QHotkeyConfigVersion.cmake
65+
VERSION "${PROJECT_VERSION}"
66+
COMPATIBILITY AnyNewerVersion)
5867

5968
if(QHOTKEY_EXAMPLES)
6069
add_subdirectory(HotkeyTest)
@@ -72,6 +81,9 @@ if(QHOTKEY_INSTALL)
7281
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/qhotkey.h
7382
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/QHotkey
7483
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
84+
install(FILES
85+
${CMAKE_CURRENT_BINARY_DIR}/QHotkeyConfigVersion.cmake
86+
DESTINATION ${INSTALL_CONFIGDIR})
7587
install(EXPORT QHotkeyConfig DESTINATION ${INSTALL_CONFIGDIR})
7688

7789
export(TARGETS qhotkey FILE QHotkeyConfig.cmake)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy