From c1939a36dd45b33808f4c7d8013560a49ebe8c5a Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sat, 8 Jun 2019 22:03:10 +0200 Subject: [PATCH] Change CMakeLists.txt to use list APPEND for Qt5 --- CMakeLists.txt | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eaf04dbbd..3ea41d98d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -122,34 +122,37 @@ endif(WIN32) # QT set(QT_MIN_VERSION 5.5) -find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS Core Concurrent Widgets Network Sql) +set(QT_COMPONENTS Core Concurrent Widgets Network Sql) + if(X11_FOUND) - find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS X11Extras) + list(APPEND QT_COMPONENTS X11Extras) endif() if(DBUS_FOUND) - find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus) + list(APPEND QT_COMPONENTS DBus) +endif() +if(APPLE) + list(APPEND QT_COMPONENTS MacExtras) +endif() +if(WIN32) + list(APPEND QT_COMPONENTS WinExtras) +endif() + +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS}) + +set(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Concurrent_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Sql_LIBRARIES}) + +if(Qt5DBus_FOUND) + list(APPEND QT_LIBRARIES ${Qt5DBus_LIBRARIES}) get_target_property(QT_DBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp LOCATION) endif() -if(APPLE) - find_package(Qt5 REQUIRED COMPONENTS MacExtras) +if(Qt5X11Extras_FOUND) + list(APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES}) endif() -if(WIN32) - find_package(Qt5 REQUIRED COMPONENTS WinExtras) +if(Qt5MacExtras_FOUND) + list(APPEND QT_LIBRARIES ${Qt5MacExtras_LIBRARIES}) endif() - -set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network Qt5::Sql) - -if(DBUS_FOUND) - set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::DBus) -endif() -if(X11_FOUND) - set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::X11Extras) -endif() -if(APPLE) - set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::MacExtras) -endif() -if(WIN32) - set(QT_LIBRARIES ${QT_LIBRARIES} Qt5::WinExtras) +if(Qt5WinExtras_FOUND) + list(APPEND QT_LIBRARIES ${Qt5WinExtras_LIBRARIES}) endif() find_package(Qt5LinguistTools CONFIG)