From 8c0fc9264f2aeff045286436cd288c44dae4b2e0 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Thu, 26 Mar 2020 14:19:21 +0100 Subject: [PATCH] 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 --- cmake/QtBuild.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake index dcb1a05634..6c5abb6bc4 100644 --- a/cmake/QtBuild.cmake +++ b/cmake/QtBuild.cmake @@ -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")