Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QHotkey as CMAKE external project #101

Open
raffmont opened this issue Jan 10, 2025 · 1 comment
Open

QHotkey as CMAKE external project #101

raffmont opened this issue Jan 10, 2025 · 1 comment

Comments

@raffmont
Copy link

Dears,

I want to use QHotkey as a cmake external project within https://github.com/openfairwind/fairwindsk, in my main CMakeLists.txt I added:

ExternalProject_Add(qhotkey
GIT_REPOSITORY https://github.com/Skycoder42/QHotkey.git
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DQT_DEFAULT_MAJOR_VERSION=6
TIMEOUT 360
)
set(LIBQHOTKEY ${EXTERNAL_INSTALL_LOCATION}/lib/libqhotkey.a)

...

add_dependencies(${PROJECT_NAME} qhotkey)

...

target_link_libraries(${PROJECT_NAME}
Qt::Core
Qt::Gui
Qt::Widgets
Qt::Network
Qt::WebSockets
Qt::Xml
Qt::Positioning
Qt::WebEngineWidgets
Qt::VirtualKeyboard
...
${LIBQHOTKEY}
)

I'm using an arm64 platform (MacOS 15.2; the QHotkeyTest is compiled correctly and works flawlessly).

But, when I build my project, I receive this message:

Undefined symbols for architecture arm64:
"_GetApplicationEventTarget", referenced from:
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
"_GetEventClass", referenced from:
QHotkeyPrivateMac::hotkeyPressEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
QHotkeyPrivateMac::hotkeyReleaseEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
"_GetEventKind", referenced from:
QHotkeyPrivateMac::hotkeyPressEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
QHotkeyPrivateMac::hotkeyReleaseEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
"_GetEventParameter", referenced from:
QHotkeyPrivateMac::hotkeyPressEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
QHotkeyPrivateMac::hotkeyReleaseEventHandler(OpaqueEventHandlerCallRef*, OpaqueEventRef*, void*) in libqhotkey.a4
"_InstallEventHandler", referenced from:
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
"_RegisterEventHotKey", referenced from:
QHotkeyPrivateMac::registerShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
"_TISCopyCurrentASCIICapableKeyboardLayoutInputSource", referenced from:
QHotkeyPrivateMac::nativeKeycode(Qt::Key, bool&) in libqhotkey.a4
"_TISGetInputSourceProperty", referenced from:
QHotkeyPrivateMac::nativeKeycode(Qt::Key, bool&) in libqhotkey.a4
"_UnregisterEventHotKey", referenced from:
QHotkeyPrivateMac::unregisterShortcut(QHotkey::NativeShortcut) in libqhotkey.a4
"_kTISPropertyUnicodeKeyLayoutData", referenced from:
QHotkeyPrivateMac::nativeKeycode(Qt::Key, bool&) in libqhotkey.a4
ld: symbol(s) not found for architecture arm64
c++: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [FairWindSK] Error 1
make[1]: *** [CMakeFiles/FairWindSK.dir/all] Error 2
make: *** [all] Error 2

The symbols are present in libqhotkey.a

Any suggestions?
Best regards,
Raffaele

@raffmont
Copy link
Author

Solved,
Using -DBUILD_SHARED_LIBS=ON, the library is built as a dynamic library and works.
Best regards,
Raffaele

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant