doc/cmake: Allow passing additional defines to qt_internal_add_docs

Useful to base documentation on data known to the build system,
such as the macOS minimum deployment target.

Pick-to: 6.5
Change-Id: I280f3b34e935c878321c24936a52dce406fdf014
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit db9bd4ab3ba80d8bd31fcdb3fc6f93ed8332a9f9)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2024-10-31 15:45:03 +01:00 committed by Qt Cherry-pick Bot
parent 168f4aee26
commit 918cd43a84

View File

@ -43,7 +43,7 @@ function(qt_internal_add_docs)
if (${ARGC} GREATER 2)
# The INDEX_DIRECTORIES key should enable passing a list of index
# directories as extra command-line arguments to qdoc.
set(qdocExtraArgs INDEX_DIRECTORIES)
set(qdocExtraArgs "INDEX_DIRECTORIES;DEFINES")
cmake_parse_arguments(PARSE_ARGV 2 arg "" "" "${qdocExtraArgs}")
if(arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR ${error_msg})
@ -162,6 +162,11 @@ function(qt_internal_add_docs)
"QT_VERSION_TAG=${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}"
"BUILDDIR=${target_bin_dir}"
)
if(arg_DEFINES)
foreach(define ${arg_DEFINES})
list(APPEND qdoc_env_args "${define}")
endforeach()
endif()
add_custom_target(prepare_docs_${target}
COMMAND ${CMAKE_COMMAND} -E env ${qdoc_env_args}