mirror of
https://github.com/Skycoder42/QHotkey.git
synced 2026-11-19 12:49:58 +03:00
Add compatibility with QT_NO_KEYWORDS macro (#104)
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
This commit is contained in:
@@ -41,6 +41,8 @@ add_library(qhotkey QHotkey/qhotkey.cpp)
|
||||
add_library(QHotkey::QHotkey ALIAS qhotkey)
|
||||
target_link_libraries(qhotkey PUBLIC Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Gui)
|
||||
|
||||
target_compile_definitions(qhotkey PRIVATE QT_NO_SIGNALS_SLOTS_KEYWORDS)
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(qhotkey PRIVATE QHOTKEY_LIBRARY)
|
||||
target_compile_definitions(qhotkey PUBLIC QHOTKEY_SHARED)
|
||||
|
||||
Reference in New Issue
Block a user