Files
qt-creator/doc/CMakeLists.txt
Eike Ziller 9954a285f2 Doc: Fix insource build
When implementing acknowledgments via the generated attributions file,
the complete `<qtc_build>/doc/` directory was added as a source
directory for qdoc. For insource builds the build directory is the same
as the source directory, so qdoc would suddenly include all
documentation from `<qtc_source>/doc/`, which mixes Design Studio and Qt
Creator documentation.

Move the generated attributions file into a subdirectory, and only add
that subdirectory. Also fix that attributions were not generated at all
anymore after trying to fix issues when qdoc is missing.

Amends 2ce9f9d97d and
13b48144a6

Change-Id: I689827dabca37c81d4351dec04f23f46503429f6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-01-08 11:18:53 +00:00

67 lines
2.4 KiB
CMake

# Generate documentation
option(BUILD_DEVELOPER_DOCS "Include developer documentation" OFF)
add_feature_info("Include developer documentation" BUILD_DEVELOPER_DOCS "")
function(_find_all_includes _ret_includes _ret_framework_paths)
set(_all_includes "${PROJECT_SOURCE_DIR}/src/plugins;${PROJECT_SOURCE_DIR}/src/libs")
foreach(_target ${__QTC_PLUGINS} ${__QTC_LIBRARIES})
if (NOT TARGET ${_target})
continue()
endif()
get_target_property(_includes ${_target} INCLUDE_DIRECTORIES)
foreach(_include ${_includes})
string(FIND "${_include}" "/src/plugins/" _in_plugins)
string(FIND "${_include}" "/src/libs/" _in_libs)
string(FIND "${_include}" "${CMAKE_BINARY_DIR}" _in_build)
if(_in_plugins LESS 0 AND _in_libs LESS 0 AND _in_build LESS 0)
list(APPEND _all_includes ${_include})
endif()
endforeach()
endforeach()
list(APPEND _all_includes ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})
list(REMOVE_DUPLICATES _all_includes)
set("${_ret_includes}" "${_all_includes}" PARENT_SCOPE)
# framework path
if (APPLE)
# version-less target Qt::Core is an interface library that links to QtX::Core
get_target_property(_qt_core Qt::Core INTERFACE_LINK_LIBRARIES)
get_target_property(_qt_target ${_qt_core} LOCATION) # <fw_path>/QtCore.framework/QtCore
get_filename_component(_qt_loc "${_qt_target}" DIRECTORY)
set("${_ret_framework_paths}" "${_qt_loc}/.." PARENT_SCOPE)
endif()
endfunction()
function(_add_doc _doc_file _dev_doc_file)
set(GENERATED_ATTRIBUTIONS_DIR ${CMAKE_CURRENT_BINARY_DIR}/generated_attributions)
add_qtc_documentation(${_doc_file}
ENVIRONMENT_EXPORTS GENERATED_ATTRIBUTIONS_DIR
)
add_qtc_doc_attribution(doc_attributions
"${CMAKE_CURRENT_SOURCE_DIR}/../qt_attributions.json"
"${GENERATED_ATTRIBUTIONS_DIR}/creator-attributions.qdoc"
${_doc_file}
)
if (BUILD_DEVELOPER_DOCS)
_find_all_includes(_all_includes _framework_paths)
add_qtc_documentation(${_dev_doc_file}
INCLUDE_DIRECTORIES ${_all_includes}
FRAMEWORK_PATHS ${_framework_paths}
)
endif()
endfunction()
if (WITH_DOCS)
_add_doc(${IDE_DOC_FILE} "qtcreatordev/qtcreator-dev.qdocconf")
endif()
if(WITH_ONLINE_DOCS)
_add_doc(${IDE_DOC_FILE_ONLINE} "qtcreatordev/qtcreator-dev-online.qdocconf")
endif()
install(DIRECTORY config
DESTINATION ${IDE_HEADER_INSTALL_PATH}/doc
COMPONENT Devel
EXCLUDE_FROM_ALL
)