diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2020-01-13 15:18:22 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2020-01-13 15:18:22 +0100 |
commit | 1af0452702082722d769a3c37d6415752065e7be (patch) | |
tree | 521b14c5c047999b70a66897b47a07c6285a467e | |
parent | 50f23dc21fce9d382893ad77dc29fd343ee2134c (diff) |
cmake: reduce qt component list
PR: #1006
-rw-r--r-- | cmake/opentrack-qt.cmake | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 650db4fc..41bd6291 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -2,12 +2,25 @@ include_guard(GLOBAL) if(WIN32) find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) endif() -find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui DBus QUIET) -find_package(Qt5 COMPONENTS SerialPort Multimedia QUIET) +set(qt-required-components Core Network Widgets LinguistTools Gui) +set(qt-optional-components SerialPort) +set(qt-imported-targets Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets) +if(APPLE) + list(APPEND qt-required-components "DBus") + list(APPEND qt-optional-components "Multimedia") + list(APPEND qt-imported-targets Qt5::DBus Qt5::Multimedia) +endif() + +find_package(Qt5 REQUIRED COMPONENTS ${qt-required-components} QUIET) +find_package(Qt5 COMPONENTS ${qt-optional-components} QUIET) + +set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES}) +if(APPLE) + list(APPEND MY_QT_LIBS ${Qt5Multimedia_LIBRARIES} ${Qt5DBus_LIBRARIES}) +endif() -set(MY_QT_LIBS ${Qt5Core_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Widgets_LIBRARIES} ${Qt5Network_LIBRARIES} ${Qt5Multimedia_LIBRARIES}) function(otr_install_qt_libs) - foreach(i Qt5::Core Qt5::Gui Qt5::DBus Qt5::Network Qt5::SerialPort Qt5::Widgets Qt5::Multimedia) + foreach(i ${qt-imported-targets}) if(NOT TARGET "${i}") continue() endif() |