diff options
Diffstat (limited to 'cmake/opentrack-qt.cmake')
-rw-r--r-- | cmake/opentrack-qt.cmake | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake index 8c92483c..1735e836 100644 --- a/cmake/opentrack-qt.cmake +++ b/cmake/opentrack-qt.cmake @@ -2,22 +2,38 @@ include_guard(GLOBAL) if(WIN32) find_package(Qt5Gui REQUIRED COMPONENTS QWindowsIntegrationPlugin) endif() -find_package(Qt5 REQUIRED COMPONENTS Core Network Widgets LinguistTools Gui QUIET) -find_package(Qt5 COMPONENTS SerialPort 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::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() function(otr_install_qt_libs) - foreach(i Qt5::Core Qt5::Gui Qt5::Network Qt5::SerialPort Qt5::Widgets) + foreach(i ${qt-imported-targets}) if(NOT TARGET "${i}") continue() endif() otr_install_lib(${i} ".") endforeach() + if(WIN32) otr_install_lib(Qt5::QWindowsIntegrationPlugin "./platforms") + endif() endfunction() -otr_install_qt_libs() +if(WIN32 OR APPLE) + otr_install_qt_libs() +endif() function(otr_qt n) if(".${${n}-cc}${${n}-cxx}${${n}-hh}" STREQUAL ".") @@ -35,7 +51,7 @@ function(otr_qt n) endfunction() function(otr_qt2 n) - target_include_directories("${n}" PRIVATE SYSTEM + target_include_directories("${n}" SYSTEM PRIVATE ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ) target_compile_definitions("${n}" PRIVATE |