Patchwork [1/5] cmake: Add ugly hack from meta-qt5 to prevent cmake trying to detect qt5

login
register
mail settings
Submitter Martin Jansa
Date April 2, 2014, 12:25 p.m.
Message ID <1396441537-2911-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/70003/
State Accepted
Commit 71bed6516ac23a7dd3e1b9af0b308ee539dc0d6f
Headers show

Comments

Martin Jansa - April 2, 2014, 12:25 p.m.
* 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)

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
 meta/recipes-devtools/cmake/cmake.inc | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

Patch

diff --git a/meta/recipes-devtools/cmake/cmake.inc b/meta/recipes-devtools/cmake/cmake.inc
index 1d5303f..a0fcf49 100644
--- a/meta/recipes-devtools/cmake/cmake.inc
+++ b/meta/recipes-devtools/cmake/cmake.inc
@@ -21,6 +21,28 @@  SRC_URI = "http://www.cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz
 
 inherit autotools-brokensep
 
+# Ugly hack to work around undefined OE_QMAKE_PATH_EXTERNAL_HOST_BINS variable
+# and possibly missing qmake binary (qtbase-native can be removed from sysroot
+# e.g. in order to upgrade it, even when there is target qtbase)
+
+# Fixes errors like this in cmake(-native).do_configure:
+#| -- Performing Test run_pic_test - Success
+#| CMake Error at tmp-eglibc/sysroots/qemuarm/usr/lib/cmake/Qt5Core/Qt5CoreConfig.cmake:27 (message):
+#|   The imported target "Qt5::Core" references the file
+#|
+#|      "/qmake"
+#|
+#|   but this file does not exist.  Possible reasons include:
+
+do_configure_prepend() {
+	sed -i 's/^find_package(Qt5Core QUIET)$/#find_package(Qt5Core QUIET)/g' ${S}/Tests/RunCMake/CMakeLists.txt
+	sed -i 's/^find_package(Qt5Core REQUIRED)/#find_package(Qt5Core REQUIRED)/g' ${S}/Tests/RunCMake/IncompatibleQt/IncompatibleQt.cmake
+	sed -i 's/^  find_package(Qt5Widgets REQUIRED)/#  find_package(Qt5Widgets REQUIRED)/g' ${S}/Tests/QtAutomoc/CMakeLists.txt
+	sed -i 's/^find_package(Qt5Core REQUIRED)/#find_package(Qt5Core REQUIRED)/g' ${S}/Tests/Qt4And5Automoc/CMakeLists.txt
+	sed -i 's/^  find_package(Qt5Widgets QUIET NO_MODULE)/#  find_package(Qt5Widgets QUIET NO_MODULE)/g' ${S}/Tests/CMakeLists.txt
+	sed -i 's/^find_package(Qt5Widgets QUIET)/#find_package(Qt5Widgets QUIET)/g' ${S}/Source/QtDialog/CMakeLists.txt
+}
+
 do_configure () {
 	./configure --prefix=${prefix}
 }