CMake: Don't generate docs for targets that don't exist

Such a case can happen when cross-compiling. Tools currently are not
built when cross-compiling, so if the desktop tool was not built,
accessing properties on that target would fail when trying to set up
the documentation building.

Change-Id: I2ffcbb9623df3e4daacdf4be3f48c4b2dd13851b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-03-26 14:19:21 +01:00
parent 089a602a76
commit 8c0fc9264f

View File

@ -3579,6 +3579,12 @@ function(qt_add_docs)
set(target ${ARGV0})
set(doc_project ${ARGV1})
# If a target is not built (which can happen for tools when crosscompiling, we shouldn't try
# to generate docs.
if(NOT TARGET "${target}")
return()
endif()
if (NOT QT_SUPERBUILD OR QT_WILL_INSTALL)
set(qdoc_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qdoc")
set(qtattributionsscanner_bin "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}/qtattributionsscanner")