summaryrefslogtreecommitdiffstats
path: root/tests/auto/qdoc/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qdoc/CMakeLists.txt')
-rw-r--r--tests/auto/qdoc/CMakeLists.txt53
1 files changed, 40 insertions, 13 deletions
diff --git a/tests/auto/qdoc/CMakeLists.txt b/tests/auto/qdoc/CMakeLists.txt
index b3894fb3d..994306723 100644
--- a/tests/auto/qdoc/CMakeLists.txt
+++ b/tests/auto/qdoc/CMakeLists.txt
@@ -1,20 +1,47 @@
-# Generated from qdoc.pro.
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
-# special case begin
if(CMAKE_VERSION VERSION_LESS "3.19" AND MSVC AND QT_FEATURE_debug_and_release)
message(WARNING "qdoc tests will not be built in this configuration.")
return()
endif()
-# special case end
-add_subdirectory(config)
-# special case begin
-# CMake builds currently don't build qdoc, presumably because the llvm
-# version update hasn't been finished yet. This causes the test to fail.
-# Include it conditionally.
-if(TARGET Qt::qdoc)
- add_subdirectory(generatedoutput)
+set(QDOC_PROJECT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../src/qdoc/)
+set(QDOC_SOURCE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../src/qdoc/qdoc/src/qdoc)
+set(QDOC_INCLUDE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../../src/qdoc/qdoc/src/)
+
+# Mirrors the definition for test targets from the source directory to the
+# "tests" directory.
+# The CI for the Qt project is set up so that, when tests are run in CI, only
+# the "tests" directory under the root of a repo is configured and test targets
+# are later run over an already built Qt (with everything exported from the
+# various src directories).
+# This means that any target that is defined outside the "tests" directory in
+# the root of the repo will not be picked up for testing by CI.
+#
+# As QDoc is currently organizing so that its part of the "src" directory
+# contains everything related to its of its subprojects, tests included, our
+# tests targets will not be checked by CI.
+#
+# To avoid this issue, each test target is defined in its own self-contained
+# "CMakeLists.txt" file under its correct place in the "src" directory and is
+# later included here to ensure that it is picked up when Ci run the tests for
+# the qttools repository.
+#
+# Outside of CI, both the "src" and "tests" directory will be configured and we
+# need to avoid repeating the targets definition.
+#
+# When CI is running its tests, it will set `QT_BUILD_STANDALONE_TESTS`, which
+# we can depend on to filter the inclusions.
+if(QT_BUILD_STANDALONE_TESTS)
+ include(${QDOC_PROJECT_DIRECTORY}/catch_generators/tests/CMakeLists.txt)
+
+ # Add all tests in src/qdoc/qdoc/tests:
+ file(GLOB qdoc_tests_dir_content LIST_DIRECTORIES true "${QDOC_PROJECT_DIRECTORY}/qdoc/tests/*")
+ foreach(path IN LISTS qdoc_tests_dir_content)
+ if(EXISTS "${path}/CMakeLists.txt")
+ get_filename_component(test_directory "${path}" NAME)
+ add_subdirectory("${path}" "${test_directory}")
+ endif()
+ endforeach()
endif()
-# special case end
-add_subdirectory(qdoccommandlineparser)
-add_subdirectory(utilities)