From 19d03ef4acda8d8952fd441abc54b732035b9535 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 31 Mar 2021 11:30:45 -0700 Subject: [PATCH] CMake: Enable AUTO{MOC,UIC,RCC} according to our CMake version. As noted in be2b0fc810, we need to set CMAKE_AUTO* before searching for Qt packages when using 3.20.0 and later. However, this fails if we're using CMake 3.9.6 or earlier. Set CMAKE_AUTO* where needed depending on our CMake version. Ping #17314. (cherry picked from commit a80ea46ff7f19e4c7f9ade4970b0f2a2202f2ea2) Conflicts: ui/qt/CMakeLists.txt --- CMakeLists.txt | 8 +++++--- ui/qt/CMakeLists.txt | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3bc0f64a98..f481112c88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1115,9 +1115,11 @@ ws_find_package(Systemd BUILD_sdjournal HAVE_SYSTEMD) # Build the Qt GUI? if(BUILD_wireshark) - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTOUIC ON) - set(CMAKE_AUTORCC ON) + if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) + endif() # Untested, may not work if CMAKE_PREFIX_PATH gets overwritten # somewhere. The if WIN32 in this place is annoying as well. diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index cd36913f10..1bcbe318d9 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -631,6 +631,12 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR} ) +if(CMAKE_VERSION VERSION_LESS "3.10.0") + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTOUIC ON) + set(CMAKE_AUTORCC ON) +endif() + if(NOT Qt5Widgets_VERSION VERSION_LESS "5.9") # Drop the file modification time of source files from generated files # to help with reproducible builds. We do not use QFileInfo.lastModified