The Qt documentation recommends[1] not using Qt keywords in the
public API of Qt libraries, specially the 'signals' and 'slots'
Qt keywords.
Without this, client applications that are compiled with the
'QT_NO_KEYWORDS'[2] macro (or that are compiled in conjunction
with other libraries that also defines the same Qt keywords)
will fail to build.
The 'QT_NO_SIGNALS_SLOTS_KEYWORDS'[1] macro assures that
the library is not using 'signals' and 'slots' Qt keywords,
since it will fail to build when they are used. Useful for
code sanity and for avoiding future pull requests that may
try to use these Qt keywords.
[1] https://doc.qt.io/qt-6/signalsandslots.html#signals-and-slots-in-qt-based-libraries
[2] https://doc.qt.io/qt-6/qtglobal.html#QT_NO_KEYWORDS
Starting at CMake 4.0, the minimum required policy version is
3.5.0[1], either specified by 'cmake_minimum_required()' or by
'cmake_policy()'. This also applies to individual policies when
they are set, which must match 3.5.0 or later policies.
[1] https://cmake.org/cmake/help/v4.0/command/cmake_minimum_required.html
Link type can be changed to PRIVATE. Only Qt Core will remain
as PUBLIC linking.
It looks like that Qt Widgets is not needed and can be removed.
On Qt6, Qt6::Gui is strictly needed.
Remove the hardcode to the 'include' directory in the CMake
exported target.
This will let the user correctly access the headers when
building a client application with a QHotkey package that
is installed with a CMAKE_INSTALL_INCLUDEDIR different
than 'include'.
CMake:
The 'QT_MAJOR' CMake variable controls which major version
of Qt is used for building. Defaults to '5', so nothing
changes when using the default 'cmake' invocation, as it
will default to search/build for Qt5.
qmake:
Just build in the usual way with 'qmake6 && make' or
'qmake-qt5 && make'.
When building with Qt6 on GNU/Linux and similar UNIXes,
the minimium required Qt version is 6.2.0, as Qt 6.1
and 6.0 lacks support for getting the X11 display.
The include path is not set correctly when QHotkey is build as a
subproject. To fix that CMAKE_CURRENT_SOURCE_DIR should be used instead
of CMAKE_SOURCE_DIR in target_include_directories.