Only add existing targets to the Qt4 target depends properties.

Qt can be configured in ways which disable certain modules. Make
sure we don't fail on that.
This commit is contained in:
Stephen Kelly 2013-02-26 22:03:04 +01:00
parent 793bf3fdac
commit 4d5230d1d8
1 changed files with 10 additions and 6 deletions

View File

@ -965,13 +965,17 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY) macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY)
if (TARGET Qt4::${_QT_MODULE}) if (TARGET Qt4::${_QT_MODULE})
foreach(_DEPEND ${ARGN}) foreach(_DEPEND ${ARGN})
if (NOT TARGET Qt4::Qt${_DEPEND}) set(_VALID_DEPENDS)
message(FATAL_ERROR "_qt4_add_target_depends invoked with invalid arguments") if (TARGET Qt4::Qt${_DEPEND})
list(APPEND _VALID_DEPENDS Qt4::Qt${_DEPEND})
endif() endif()
if (_VALID_DEPENDS)
set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
${_PROPERTY} ${_PROPERTY}
"Qt4::Qt${_DEPEND}" "${_VALID_DEPENDS}"
) )
endif()
set(_VALID_DEPENDS)
endforeach() endforeach()
endif() endif()
endmacro() endmacro()