CMake: Add global / top-level docs targets

Previously you could use either module-specific or
repo-specific 'docs' targets.
For example 'ninja html_docs_qtbase' or 'ninja html_docs_Core'.

Now there's a global / top-level target called
'docs', so 'ninja docs' works.

For super builds it will build the documentation of all
configured repositories.

For a single repo build, it's equivalent to calling
'ninja docs_repo_name'.

Also for consistency, add the "docs_Core" target, which was missing
before. So now a 'docs' target exsits for repo names AND targets.

New global target names are
- docs
- prepare_docs
- generate_docs
- html_docs
- qch_docs
- install_html_docs_docs
- install_qch_docs_docs
- install_docs_docs

Amends 0095ff4e0659906595d281b37c3b7f89e37250af

Change-Id: I686be1e0962e40cbce860e8ac2cabb056b360ac2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Alexandru Croitor 2020-03-18 16:07:44 +01:00
parent dc4872be38
commit edf5fe49b3
2 changed files with 26 additions and 1 deletions

View File

@ -3739,10 +3739,15 @@ function(qt_add_docs)
add_custom_target(install_docs_${target})
add_dependencies(install_docs_${target} install_html_docs_${target} install_qch_docs_${target})
add_custom_target(docs_${target})
add_dependencies(docs_${target} html_docs_${target})
add_dependencies(docs_${target} qch_docs_${target})
add_dependencies(${qt_docs_prepare_target_name} prepare_docs_${target})
add_dependencies(${qt_docs_generate_target_name} generate_docs_${target})
add_dependencies(${qt_docs_html_target_name} html_docs_${target})
add_dependencies(${qt_docs_qch_target_name} qch_docs_${target})
add_dependencies(${qt_docs_target_name} docs_${target})
add_dependencies(${qt_docs_install_html_target_name} install_html_docs_${target})
add_dependencies(${qt_docs_install_qch_target_name} install_qch_docs_${target})
add_dependencies(${qt_docs_install_target_name} install_docs_${target})

View File

@ -64,6 +64,17 @@ macro(qt_build_repo_begin)
# Decide whether tools will be built.
qt_check_if_tools_will_be_built()
# Add global docs targets that will work both for per-repo builds, and super builds.
if(NOT TARGET docs)
add_custom_target(docs)
add_custom_target(prepare_docs)
add_custom_target(generate_docs)
add_custom_target(html_docs)
add_custom_target(qch_docs)
add_custom_target(install_html_docs_docs)
add_custom_target(install_qch_docs_docs)
add_custom_target(install_docs_docs)
endif()
string(TOLOWER ${PROJECT_NAME} project_name_lower)
@ -87,10 +98,19 @@ macro(qt_build_repo_begin)
add_dependencies(${qt_docs_generate_target_name} ${qt_docs_prepare_target_name})
add_dependencies(${qt_docs_html_target_name} ${qt_docs_generate_target_name})
add_dependencies(${qt_docs_target_name} ${qt_docs_html_target_name} ${qt_docs_qch_target_name})
add_dependencies(${qt_docs_install_html_target_name} ${qt_docs_html_target_name})
add_dependencies(${qt_docs_install_qch_target_name} ${qt_docs_qch_target_name})
add_dependencies(${qt_docs_install_target_name} ${qt_docs_install_html_target_name} ${qt_docs_install_qch_target_name})
# Make global doc targets depend on the module ones.
add_dependencies(docs ${qt_docs_target_name})
add_dependencies(prepare_docs ${qt_docs_prepare_target_name})
add_dependencies(generate_docs ${qt_docs_generate_target_name})
add_dependencies(html_docs ${qt_docs_qch_target_name})
add_dependencies(qch_docs ${qt_docs_html_target_name})
add_dependencies(install_html_docs_docs ${qt_docs_install_html_target_name})
add_dependencies(install_qch_docs_docs ${qt_docs_install_qch_target_name})
add_dependencies(install_docs_docs ${qt_docs_install_target_name})
endmacro()
macro(qt_build_repo_end)