Skip to content

Commit 53a8e6a

Browse files
timblechmannfrankosterfeld
authored andcommitted
CMake: link with Qt6 cmake targets
Using Qt6::DBus / Qt6::Core is more robust than relying on the Qt6Core_LIBRARIES / Qt6DBus_LIBRARIES libraries. It seems that not every Qt installation provides these variables. This most notably fixes compilation against conan-provided Qt
1 parent 2b5a3f4 commit 53a8e6a

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,7 @@ else()
105105

106106
if(UNIX AND NOT APPLE AND NOT ANDROID AND NOT HAIKU AND NOT EMSCRIPTEN)
107107
find_package(Qt6 COMPONENTS DBus REQUIRED)
108-
include_directories(${Qt6DBus_INCLUDE_DIRS})
109-
set(QTDBUS_LIBRARIES ${Qt6DBus_LIBRARIES})
108+
set(QTDBUS_LIBRARIES Qt6::DBus)
110109
macro(qt_add_dbus_interface)
111110
qt6_add_dbus_interface(${ARGN})
112111
endmacro()
@@ -126,7 +125,7 @@ else()
126125
qt6_wrap_cpp(${ARGN})
127126
endmacro()
128127

129-
set(QTCORE_LIBRARIES ${Qt6Core_LIBRARIES})
128+
set(QTCORE_LIBRARIES Qt6::Core)
130129
endif()
131130

132131
set(QTKEYCHAIN_TARGET_NAME qt${QTKEYCHAIN_VERSION_INFIX}keychain)

0 commit comments

Comments
 (0)