From 4c6cc675201c1a17d674b7910233a1d8eb474077 Mon Sep 17 00:00:00 2001
From: lat9nq <22451773+lat9nq@users.noreply.github.com>
Date: Thu, 15 Jul 2021 05:25:00 -0400
Subject: [PATCH] cmake: Only search for Qt when we need to

When YUZU_USE_BUNDLED_QT was specified on a system with a compliant Qt
version installed, CMake configuration would cause an error due to
mixing YUZU_USE_BUNDLED_QT with the system Qt.

Solution is to only search for Qt when YUZU_USE_BUNDLED_QT is disabled.
---
 CMakeLists.txt | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bf6ba58ba4..de93ca2c2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -254,7 +254,9 @@ if(ENABLE_QT)
 
     # Check for system Qt on Linux, fallback to bundled Qt
     if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-        find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets)
+        if (NOT YUZU_USE_BUNDLED_QT)
+            find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets)
+        endif()
         if (NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT)
             # Check for dependencies, then enable bundled Qt download