blob: 80fc277fa26c4582da6c5824e1a3903687c31d07 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Fail silently if system Qt installation is broken
2
3Fixes a regression in behaviour from 2.8.10 to 2.8.11 resulting in the
4following error if the system Qt installation is broken:
5
6CMake Error at Modules/FindQt4.cmake:1028 (set_property):
7 set_property could not find TARGET Qt4::QtCore. Perhaps it has not yet
8 been created.
9Call Stack (most recent call first):
10 Tests/RunCMake/CMakeLists.txt:79 (find_package)
11
12Upstream-Status: Pending
13
14Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
15
16The patch was slightly adapted in order to match cmake 3.2.2:
17Another set_property was introduced which had to be included
18within the if(QT_QTCORE_FOUND) statement.
19
20Signed-off-by: Moritz Blume <moritz.blume@bmw-carit.de>
21---
22 Modules/FindQt4.cmake | 39 ++++++++++++++++++++-------------------
23 1 file changed, 20 insertions(+), 19 deletions(-)
24
25diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
26index 6704769..9048e35 100644
27--- a/Modules/FindQt4.cmake
28+++ b/Modules/FindQt4.cmake
29@@ -1000,25 +1000,26 @@ if (QT_QMAKE_EXECUTABLE AND
30 endif()
31 endmacro()
32
33-
34- # Set QT_xyz_LIBRARY variable and add
35- # library include path to QT_INCLUDES
36- _QT4_ADJUST_LIB_VARS(QtCore)
37- set_property(TARGET Qt4::QtCore APPEND PROPERTY
38- INTERFACE_INCLUDE_DIRECTORIES
39- "${QT_MKSPECS_DIR}/default"
40- ${QT_INCLUDE_DIR}
41- )
42- set_property(TARGET Qt4::QtCore APPEND PROPERTY
43- INTERFACE_COMPILE_DEFINITIONS
44- $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>
45- )
46- set_property(TARGET Qt4::QtCore PROPERTY
47- INTERFACE_QT_MAJOR_VERSION 4
48- )
49- set_property(TARGET Qt4::QtCore APPEND PROPERTY
50- COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION
51- )
52+ if(QT_QTCORE_FOUND)
53+ # Set QT_xyz_LIBRARY variable and add
54+ # library include path to QT_INCLUDES
55+ _QT4_ADJUST_LIB_VARS(QtCore)
56+ set_property(TARGET Qt4::QtCore APPEND PROPERTY
57+ INTERFACE_INCLUDE_DIRECTORIES
58+ "${QT_MKSPECS_DIR}/default"
59+ ${QT_INCLUDE_DIR}
60+ )
61+ set_property(TARGET Qt4::QtCore APPEND PROPERTY
62+ INTERFACE_COMPILE_DEFINITIONS
63+ $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>
64+ )
65+ set_property(TARGET Qt4::QtCore PROPERTY
66+ INTERFACE_QT_MAJOR_VERSION 4
67+ )
68+ set_property(TARGET Qt4::QtCore APPEND PROPERTY
69+ COMPATIBLE_INTERFACE_STRING QT_MAJOR_VERSION
70+ )
71+ endif()
72
73 foreach(QT_MODULE ${QT_MODULES})
74 _QT4_ADJUST_LIB_VARS(${QT_MODULE})
75--
761.9.1
77