Skip to content

Commit

Permalink
doc/cmake: Allow passing additional defines to qt_internal_add_docs
Browse files Browse the repository at this point in the history
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 db9bd4a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
  • Loading branch information
torarnv authored and Qt Cherry-pick Bot committed Nov 2, 2024
1 parent 168f4ae commit 918cd43
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/QtDocsHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 918cd43

Please sign in to comment.