Skycoder42 / QHotkey

A global shortcut/hotkey for Desktop Qt-Applications
BSD 3-Clause "New" or "Revised" License
548 stars 161 forks source link

CMake: add package version config file #57

Closed dbermond closed 2 years ago

dbermond commented 2 years ago

The CMake invocation fails when calling find_package() on a client application if the call specifies of the minimum desired version.

For example, find_package(QHotkey 1.4.2 REQUIRED) gives the following output:

CMake Error at CMakeLists.txt:141 (find_package):
  Could not find a configuration file for package "QHotkey" that is
  compatible with requested version "1.4.2".

  The following configuration files were considered but not accepted:

    /usr/lib/qhotkey-qt6/cmake/QHotkey/QHotkeyConfig.cmake, version: unknown
    /usr/lib64/cmake/QHotkey/QHotkeyConfig.cmake, version: unknown
    /usr/lib/cmake/QHotkey/QHotkeyConfig.cmake, version: unknown
    /lib64/cmake/QHotkey/QHotkeyConfig.cmake, version: unknown
    /lib/cmake/QHotkey/QHotkeyConfig.cmake, version: unknown

That's because the CMake package is lacking a version config file. By adding this file, client applications can have proper version checking support.

This commit also updates the CMake project version to the current 1.4.2, as it was 1.2.2.

Tested on Arch Linux x86_64 with Qt 6.2.0 and Qt 5.15.2+kde+r228.

dbermond commented 2 years ago

Done.