From 5a86c7fa987bd407f228176df2abeffd015be9ea Mon Sep 17 00:00:00 2001
From: Otavio Salvador <otavio@ossystems.com.br>
Date: Wed, 17 Jan 2018 10:02:14 -0200
Subject: [PATCH] cmake: Prevent the detection of Qt5

Organization: O.S. Systems Software LTDA.

CMake doesn't have dependency on qt4/qt5, so these tests usually fail
but still can cause undeterministic results or build failures (when
OE_QMAKE_PATH_EXTERNAL_HOST_BINS is undefined or native qmake removed
while running the test in cmake)

Upstream-Status: Inappropriate [configuration]

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>

---
 Source/QtDialog/CMakeLists.txt                     | 2 +-
 Tests/CMakeLists.txt                               | 2 +-
 Tests/Qt4And5Automoc/CMakeLists.txt                | 4 ++--
 Tests/QtAutogen/AutogenGuiTest.cmake               | 3 +--
 Tests/QtAutogen/MacOsFW/CMakeLists.txt             | 2 +-
 Tests/RunCMake/CMakeLists.txt                      | 2 +-
 Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake | 2 +-
 7 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index cb89d19..9e68981 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -3,7 +3,7 @@
 
 project(QtDialog)
 CMake_OPTIONAL_COMPONENT(cmake-gui)
-find_package(Qt5Widgets QUIET)
+#find_package(Qt5Widgets QUIET)
 if (Qt5Widgets_FOUND)
   include_directories(${Qt5Widgets_INCLUDE_DIRS})
   add_definitions(${Qt5Widgets_DEFINITONS})
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 57fa7fc..d50c146 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -1329,7 +1329,7 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
     set(CMake_TEST_Qt5 1)
   endif()
   if(CMake_TEST_Qt5)
-    find_package(Qt5Widgets QUIET NO_MODULE)
+    #find_package(Qt5Widgets QUIET NO_MODULE)
   endif()
   if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
     add_subdirectory(Qt5Autogen)
diff --git a/Tests/Qt4And5Automoc/CMakeLists.txt b/Tests/Qt4And5Automoc/CMakeLists.txt
index ad74961..a9dd74b 100644
--- a/Tests/Qt4And5Automoc/CMakeLists.txt
+++ b/Tests/Qt4And5Automoc/CMakeLists.txt
@@ -3,11 +3,11 @@ cmake_minimum_required(VERSION 2.8.12)
 project(Qt4And5Automoc)
 
 if (QT_REVERSE_FIND_ORDER)
-  find_package(Qt5Core REQUIRED)
+  #find_package(Qt5Core REQUIRED)
   find_package(Qt4 REQUIRED)
 else()
   find_package(Qt4 REQUIRED)
-  find_package(Qt5Core REQUIRED)
+  #find_package(Qt5Core REQUIRED)
 endif()
 
 set(CMAKE_AUTOMOC ON)
diff --git a/Tests/QtAutogen/AutogenGuiTest.cmake b/Tests/QtAutogen/AutogenGuiTest.cmake
index b76d341..a6e0acb 100644
--- a/Tests/QtAutogen/AutogenGuiTest.cmake
+++ b/Tests/QtAutogen/AutogenGuiTest.cmake
@@ -22,8 +22,7 @@ if (QT_TEST_VERSION EQUAL 4)
   endmacro()
 
 elseif(QT_TEST_VERSION EQUAL 5)
-
-  find_package(Qt5Widgets REQUIRED)
+  #find_package(Qt5Widgets REQUIRED)
 
   set(QT_QTCORE_TARGET Qt5::Core)
   set(QT_LIBRARIES Qt5::Widgets)
diff --git a/Tests/QtAutogen/MacOsFW/CMakeLists.txt b/Tests/QtAutogen/MacOsFW/CMakeLists.txt
index c08efc4..87e25d9 100644
--- a/Tests/QtAutogen/MacOsFW/CMakeLists.txt
+++ b/Tests/QtAutogen/MacOsFW/CMakeLists.txt
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
 project(MacOsFW)
 include("../AutogenGuiTest.cmake")
 
-find_package(Qt5Test REQUIRED)
+#find_package(Qt5Test REQUIRED)
 
 set(CMAKE_CXX_STANDARD 11)
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/output/bin)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 6b2f117..1002005 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -376,7 +376,7 @@ else()
 endif()
 
 find_package(Qt4 QUIET)
-find_package(Qt5Core QUIET)
+#find_package(Qt5Core QUIET)
 if (QT4_FOUND AND Qt5Core_FOUND AND NOT Qt5Core_VERSION VERSION_LESS 5.1.0)
   add_RunCMake_test(IncompatibleQt)
 endif()
diff --git a/Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake b/Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake
index 4fccdc4..b76e1e5 100644
--- a/Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake
+++ b/Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake
@@ -1,6 +1,6 @@
 
 find_package(Qt4 REQUIRED)
-find_package(Qt5Core REQUIRED)
+#find_package(Qt5Core REQUIRED)
 
 add_executable(mainexe main.cpp)
 target_link_libraries(mainexe Qt4::QtCore Qt5::Core)
