Skip to content

Commit

Permalink
CMake: Allow building qmake docs in a documentation-only build
Browse files Browse the repository at this point in the history
We never added the qmake subdirectory if we didn't build tools. Thus
we never created a doc target to build qmake's documentation.

Make sure we add the qmake subdirectory regardless of whether we build
tools or not. qt_internal_add_tool can then make sure to skip building
the tool if necessary.

If the tool is not created though, create a fake qmake INTERFACE
library target, so that qt_internal_add_docs has a target to work
with.

Amends 5c352f4

Pick-to: 6.8
Fixes: QTBUG-127334
Change-Id: I41cc96fb6ad21e32e17d312ea474835dfa38528e
Reviewed-by:  Alexey Edelev <[email protected]>
Reviewed-by: Joerg Bornemann <[email protected]>
  • Loading branch information
alcroito committed Jul 19, 2024
1 parent 7c34417 commit aea0f89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmake/QtBaseHelpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ macro(qt_internal_qtbase_build_repo)
endif()

if(NOT QT_INTERNAL_BUILD_STANDALONE_PARTS)
if(QT_WILL_BUILD_TOOLS AND QT_FEATURE_settings)
if(QT_FEATURE_settings)
add_subdirectory(qmake)
endif()

Expand Down
16 changes: 13 additions & 3 deletions qmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ qt_internal_add_tool(${target_name}
generators/win32/msvc_objectmodel.cpp # xml symbols clash with generators/win32/msbuild_objectmodel.cpp
library/qmakeparser.cpp # struct statics clashes with qmakeevaluator_p.h
)

# When we don't build tools, we still want to be able to build the documentation.
# Add a fake interface library to make sure the documentation target is created.
# We use the direct name rather than ${target_name} to ensure the doc target keeps
# the original name even when cross-building.
if(NOT TARGET qmake)
add_library(qmake INTERFACE)
endif()

qt_internal_add_docs(qmake
doc/qmake.qdocconf
)

qt_internal_return_unless_building_tools()

# Add QMAKE_VERSION_STR only if qmake is part of the build.
Expand Down Expand Up @@ -137,6 +150,3 @@ set_target_properties(${target_name} PROPERTIES
qt_internal_apply_gc_binaries(${target_name} PRIVATE)
qt_skip_warnings_are_errors(${target_name})

qt_internal_add_docs(${target_name}
doc/qmake.qdocconf
)

0 comments on commit aea0f89

Please sign in to comment.