CMake: Fix doc building when current prefix is different from original

When qtbase + qtools is built with -DCMAKE_INSTALL_PREFIX=/opt/foo
and then qtsvg is built with -DCMAKE_INSTALL_PREFIX=/
building docs will fail to find the installed .qdocconf files with an
error like:

 qtsvg/src/svg/doc/qtsvg.qdocconf:1: (qdoc) error: Cannot open file
 '//doc/global/qt-module-defaults.qdocconf': No such file or directory

That's because we pass QT_INSTALL_DOCS=/ (pointing to the new prefix)
as an env var to qdoc and it uses that to try and include various
qdocconf files.

Instead of passing the currently specified CMAKE_INSTALL_PREFIX, use
QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX which points to where
qtbase was installed (and thus all previous .qdocconf files).

This was already in the code but we preferred CMAKE_INSTALL_PREFIX
when it was set, so just remove it.

Pick-to: 6.6
Change-Id: Ibe326132b9504341fa998d9e772ea2bea79727c0
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2023-11-24 13:03:15 +01:00
parent 9f3ae15933
commit 72be53ca28

View File

@ -119,8 +119,6 @@ function(qt_internal_add_docs)
if(QT_SUPERBUILD)
set(qt_install_docs_env "${QtBase_BINARY_DIR}/${INSTALL_DOCDIR}")
elseif(QT_WILL_INSTALL)
set(qt_install_docs_env "${CMAKE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
else()
set(qt_install_docs_env "${QT_BUILD_INTERNALS_RELOCATABLE_INSTALL_PREFIX}/${INSTALL_DOCDIR}")
endif()