From 2eb9e12b5dcbec83966e0bc81af95f38f131f992 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Tue, 24 Mar 2020 14:44:28 +0100 Subject: [PATCH] CMake: Use Qt5::DesignerComponents QTBUG-75867 about missing Qt5::DesignerComponents support has been fixed, so use that over our own hand-rolled version. Change-Id: I6d8bb7f7d5359050f20a095adb4a074f143e8d49 Reviewed-by: Eike Ziller --- CMakeLists.txt | 3 +- cmake/FindDesignerComponents.cmake | 69 ----------------------------- src/plugins/designer/CMakeLists.txt | 3 -- 3 files changed, 2 insertions(+), 73 deletions(-) delete mode 100644 cmake/FindDesignerComponents.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 76773e3e5d2..b6e0396a97b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,7 +48,8 @@ find_package(Qt5 COMPONENTS LinguistTools) find_package(Threads) -find_package(Qt5 COMPONENTS Designer Help Script SerialPort Svg QUIET) +find_package(Qt5 COMPONENTS Designer DesignerComponents Help Script SerialPort Svg QUIET) + function (set_if_target var target) if (TARGET "${target}") set(_result ON) diff --git a/cmake/FindDesignerComponents.cmake b/cmake/FindDesignerComponents.cmake deleted file mode 100644 index 50073b8d6cf..00000000000 --- a/cmake/FindDesignerComponents.cmake +++ /dev/null @@ -1,69 +0,0 @@ -#.rst: -# FindDesignerComponents -# --------- -# -# Try to locate the DesignerComponents library. -# If found, this will define the following variables: -# -# ``DesignerComponents_FOUND`` -# True if the DesignerComponents library is available -# ``DesignerComponents_INCLUDE_DIRS`` -# The DesignerComponents include directories -# ``DesignerComponents_LIBRARIES`` -# The DesignerComponentscore library for linking -# ``DesignerComponents_INSTALL_DIR`` -# Top level DesignerComponents installation directory -# -# If ``DesignerComponents_FOUND`` is TRUE, it will also define the following -# imported target: -# -# ``Qt5::DesignerComponents`` -# The DesignerComponents library - -find_package(Qt5Designer QUIET) -if (NOT Qt5Designer_FOUND) - set(DesignerComponents_FOUND OFF) - return() -endif() - -get_target_property(_designer_location Qt5::Designer IMPORTED_LOCATION_DEBUG) -if (NOT _designer_location) - get_target_property(_designer_location Qt5::Designer IMPORTED_LOCATION_RELEASE) -endif() -if (NOT _designer_location) - get_target_property(_designer_location Qt5::Designer IMPORTED_LOCATION) -endif() -get_target_property(_designer_is_framework Qt5::Designer FRAMEWORK) -find_library(DesignerComponents_LIBRARIES NAMES Qt5DesignerComponents QtDesignerComponents Qt5DesignerComponentsd QtDesignerComponentsd - HINTS "${_designer_location}/.." "${_designer_location}/../..") - -if (_designer_is_framework) - if (DesignerComponents_LIBRARIES) - set(DesignerComponents_LIBRARIES "${DesignerComponents_LIBRARIES}/QtDesignerComponents") - endif() -else() - find_path(DesignerComponents_INCLUDE_DIRS NAMES qtdesignercomponentsversion.h PATH_SUFFIXES QtDesignerComponents HINTS ${Qt5Designer_INCLUDE_DIRS}) - set(_required_vars Qt5Designer_INCLUDE_DIRS) -endif() - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DesignerComponents DEFAULT_MSG - DesignerComponents_LIBRARIES ${_required_vars}) - -if(DesignerComponents_FOUND AND NOT TARGET DesignerComponents::DesignerComponents) - add_library(Qt5::DesignerComponents UNKNOWN IMPORTED) - set_target_properties(Qt5::DesignerComponents PROPERTIES - IMPORTED_LOCATION "${DesignerComponents_LIBRARIES}") - if (NOT _designer_is_framework) - set_target_properties(Qt5::DesignerComponents PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${DesignerComponents_INCLUDE_DIRS}") - endif() -endif() - -mark_as_advanced(DesignerComponents_INCLUDE_DIRS DesignerComponents_LIBRARIES) - -include(FeatureSummary) -set_package_properties(DesignerComponents PROPERTIES - URL "https://qt.io/" - DESCRIPTION "Qt5 (Widget) DesignerComponents library") - diff --git a/src/plugins/designer/CMakeLists.txt b/src/plugins/designer/CMakeLists.txt index 71a999dd8b4..cb7016d0eee 100644 --- a/src/plugins/designer/CMakeLists.txt +++ b/src/plugins/designer/CMakeLists.txt @@ -1,6 +1,3 @@ -# Qt5::DesignerComponents doesn't have a target, so we need to define our own:-/ -find_package(DesignerComponents) - if (WITH_TESTS) set(TST_COMPONENT CppEditor) endif()