Merge topic 'windows-export-bigobj'

08ca4fbc7a WINDOWS_EXPORT_ALL_SYMBOLS: Distinguish bigobj from cl -GL objects

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10382
diff --git a/.gitlab/ci/configure_fedora41_asan.cmake b/.gitlab/ci/configure_fedora41_asan.cmake
index df9f46d..4441792 100644
--- a/.gitlab/ci/configure_fedora41_asan.cmake
+++ b/.gitlab/ci/configure_fedora41_asan.cmake
@@ -1,4 +1,5 @@
 set(CMAKE_C_FLAGS "-fsanitize=address" CACHE STRING "")
 set(CMAKE_CXX_FLAGS "-fsanitize=address" CACHE STRING "")
+set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
 
 include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora41_common.cmake")
diff --git a/.gitlab/ci/configure_fedora41_clang_analyzer.cmake b/.gitlab/ci/configure_fedora41_clang_analyzer.cmake
index cdeaab4..4a518d0 100644
--- a/.gitlab/ci/configure_fedora41_clang_analyzer.cmake
+++ b/.gitlab/ci/configure_fedora41_clang_analyzer.cmake
@@ -1,3 +1,4 @@
 set(configure_no_sccache 1)
+set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
 
 include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora41_common.cmake")
diff --git a/.gitlab/ci/configure_fedora41_common.cmake b/.gitlab/ci/configure_fedora41_common.cmake
index 4484e26..dee78ab 100644
--- a/.gitlab/ci/configure_fedora41_common.cmake
+++ b/.gitlab/ci/configure_fedora41_common.cmake
@@ -1,6 +1,5 @@
 set(BUILD_CursesDialog ON CACHE BOOL "")
 set(BUILD_QtDialog ON CACHE BOOL "")
-set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
 set(CMake_TEST_JQ "/usr/bin/jq" CACHE PATH "")
 set(CMake_TEST_JSON_SCHEMA ON CACHE BOOL "")
 
diff --git a/.gitlab/ci/configure_fedora41_makefiles_symlinked.cmake b/.gitlab/ci/configure_fedora41_makefiles_symlinked.cmake
index e4434c1..317de3a 100644
--- a/.gitlab/ci/configure_fedora41_makefiles_symlinked.cmake
+++ b/.gitlab/ci/configure_fedora41_makefiles_symlinked.cmake
@@ -1,2 +1,5 @@
+set(CMake_QT_MAJOR_VERSION "6" CACHE STRING "")
+set(CMake_TEST_GUI "ON" CACHE BOOL "")
+
 include("${CMAKE_CURRENT_LIST_DIR}/configure_symlinked_common.cmake")
 include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora41_common.cmake")
diff --git a/.gitlab/ci/configure_fedora41_ninja.cmake b/.gitlab/ci/configure_fedora41_ninja.cmake
index 217d24a..9bef7e8 100644
--- a/.gitlab/ci/configure_fedora41_ninja.cmake
+++ b/.gitlab/ci/configure_fedora41_ninja.cmake
@@ -14,5 +14,7 @@
 
 # Cover compilation with C++11 only and not higher standards.
 set(CMAKE_CXX_STANDARD "11" CACHE STRING "")
+# Qt 6 requires C++17, so use Qt 5.
+set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
 
 include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora41_common.cmake")
diff --git a/.gitlab/ci/configure_fedora41_tidy.cmake b/.gitlab/ci/configure_fedora41_tidy.cmake
index 40bde10..664b4f1 100644
--- a/.gitlab/ci/configure_fedora41_tidy.cmake
+++ b/.gitlab/ci/configure_fedora41_tidy.cmake
@@ -2,5 +2,6 @@
 set(CMake_USE_CLANG_TIDY_MODULE ON CACHE BOOL "")
 set(CMake_CLANG_TIDY_MODULE "$ENV{CI_PROJECT_DIR}/Utilities/ClangTidyModule/build/libcmake-clang-tidy-module.so" CACHE FILEPATH "")
 set(CMake_CLANG_TIDY_EXPORT_FIXES_DIR "$ENV{CI_PROJECT_DIR}/.gitlab/clang-tidy-fixes" CACHE PATH "")
+set(CMake_QT_MAJOR_VERSION "5" CACHE STRING "")
 
 include("${CMAKE_CURRENT_LIST_DIR}/configure_fedora41_common.cmake")
diff --git a/Help/manual/cmake-instrumentation.7.rst b/Help/manual/cmake-instrumentation.7.rst
index d36bf62..2a16a55 100644
--- a/Help/manual/cmake-instrumentation.7.rst
+++ b/Help/manual/cmake-instrumentation.7.rst
@@ -369,7 +369,7 @@
 
   {
     "version": 1,
-    "command" : "/usr/bin/c++ -MD -MT CMakeFiles/main.dir/main.cxx.o -MF CMakeFiles/main.dir/main.cxx.o.d -o CMakeFiles/main.dir/main.cxx.o -c <src>/main.cxx",
+    "command" : "\"/usr/bin/c++\" \"-MD\" \"-MT\" \"CMakeFiles/main.dir/main.cxx.o\" \"-MF\" \"CMakeFiles/main.dir/main.cxx.o.d\" \"-o\" \"CMakeFiles/main.dir/main.cxx.o\" \"-c\" \"<src>/main.cxx\"",
     "role" : "compile",
     "return" : 1,
     "target": "main",
diff --git a/Help/release/3.30.rst b/Help/release/3.30.rst
index ad21c46..bcd4ac1 100644
--- a/Help/release/3.30.rst
+++ b/Help/release/3.30.rst
@@ -302,8 +302,8 @@
   directories that call :command:`project` with the same project name,
   and it addresses the bug in the implementation introduced in 3.30.4.
 
-3.30.6, 3.30.7
---------------
+3.30.6, 3.30.7, 3.30.8
+----------------------
 
 * These versions made no changes to documented features or interfaces.
   Some implementation updates were made to support ecosystem changes
diff --git a/Help/release/3.31.rst b/Help/release/3.31.rst
index 32040da..4790415 100644
--- a/Help/release/3.31.rst
+++ b/Help/release/3.31.rst
@@ -263,8 +263,8 @@
 
 Changes made since CMake 3.31.0 include the following.
 
-3.31.1, 3.31.2, 3.31.3, 3.31.4, 3.31.5
---------------------------------------
+3.31.1, 3.31.2, 3.31.3, 3.31.4, 3.31.5, 3.31.6
+----------------------------------------------
 
 * These versions made no changes to documented features or interfaces.
   Some implementation updates were made to support ecosystem changes
diff --git a/Help/variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION.rst b/Help/variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION.rst
index 98c2a8f..92758fd 100644
--- a/Help/variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION.rst
+++ b/Help/variable/CMAKE_FIND_PACKAGE_SORT_DIRECTION.rst
@@ -6,13 +6,13 @@
 The sorting direction used by :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER`.
 It can assume one of the following values:
 
-``DEC``
-  Default.  Ordering is done in descending mode.
-  The highest folder found will be tested first.
-
 ``ASC``
-  Ordering is done in ascending mode.
+  Default.  Ordering is done in ascending mode.
   The lowest folder found will be tested first.
 
+``DEC``
+  Ordering is done in descending mode.
+  The highest folder found will be tested first.
+
 If :variable:`CMAKE_FIND_PACKAGE_SORT_ORDER` is not set or is set to ``NONE``
 this variable has no effect.
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 0003b49..da1b0d6 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 4)
 set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 20250222)
+set(CMake_VERSION_PATCH 20250225)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
diff --git a/Source/CTest/cmProcess.cxx b/Source/CTest/cmProcess.cxx
index 3e1beb9..acaead7 100644
--- a/Source/CTest/cmProcess.cxx
+++ b/Source/CTest/cmProcess.cxx
@@ -57,6 +57,7 @@
     return false;
   }
   this->StartTime = std::chrono::steady_clock::now();
+  this->SystemStartTime = std::chrono::system_clock::now();
   this->ProcessArgs.clear();
   // put the command as arg0
   this->ProcessArgs.push_back(this->Command.c_str());
diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt
index 55f40bf..7f851bd 100644
--- a/Source/QtDialog/CMakeLists.txt
+++ b/Source/QtDialog/CMakeLists.txt
@@ -13,25 +13,26 @@
   STRING "Expected Qt major version. Valid values are A (auto-select), 5, 6.")
 set(SUPPORTED_QT_VERSIONS "A" 5 6)
 set_property(CACHE CMake_QT_MAJOR_VERSION PROPERTY STRINGS ${SUPPORTED_QT_VERSIONS})
+# Select a Qt version and store it in a normal variable of the same name.
 if(NOT CMake_QT_MAJOR_VERSION STREQUAL "A")
   if(NOT CMake_QT_MAJOR_VERSION IN_LIST SUPPORTED_QT_VERSIONS)
     message(FATAL_ERROR "Supported Qt versions are \"${SUPPORTED_QT_VERSIONS}\"."
             " But CMake_QT_MAJOR_VERSION is set to ${CMake_QT_MAJOR_VERSION}.")
   endif()
-  set(INSTALLED_QT_VERSION ${CMake_QT_MAJOR_VERSION})
+  set(CMake_QT_MAJOR_VERSION "${CMake_QT_MAJOR_VERSION}")
 else()
   find_package(Qt6Widgets QUIET)
-  set(INSTALLED_QT_VERSION 6)
+  set(CMake_QT_MAJOR_VERSION 6)
   if(NOT Qt6Widgets_FOUND)
     find_package(Qt5Widgets QUIET)
     if(NOT Qt5Widgets_FOUND)
       message(FATAL_ERROR "Could not find a valid Qt installation.")
     endif()
-    set(INSTALLED_QT_VERSION 5)
+    set(CMake_QT_MAJOR_VERSION 5)
   endif()
 endif()
 
-find_package(Qt${INSTALLED_QT_VERSION}
+find_package(Qt${CMake_QT_MAJOR_VERSION}
     COMPONENTS ${QT_COMPONENTS}
     REQUIRED QUIET
 )
@@ -40,10 +41,10 @@
 
 # Try to find the package WinExtras for the task bar progress
 if(WIN32)
-  find_package(Qt${INSTALLED_QT_VERSION}WinExtras QUIET)
-  if(Qt${INSTALLED_QT_VERSION}WinExtras_FOUND)
+  find_package(Qt${CMake_QT_MAJOR_VERSION}WinExtras QUIET)
+  if(Qt${CMake_QT_MAJOR_VERSION}WinExtras_FOUND)
     add_compile_definitions(QT_WINEXTRAS)
-    list(APPEND CMake_QT_EXTRA_LIBRARIES Qt${INSTALLED_QT_VERSION}::WinExtras)
+    list(APPEND CMake_QT_EXTRA_LIBRARIES Qt${CMake_QT_MAJOR_VERSION}::WinExtras)
     list(APPEND QT_COMPONENTS WinExtras)
   endif()
 endif()
@@ -53,7 +54,7 @@
   add_compile_definitions(_SILENCE_STDEXT_ARR_ITERS_DEPRECATION_WARNING)
 endif()
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${INSTALLED_QT_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt${CMake_QT_MAJOR_VERSION}Widgets_EXECUTABLE_COMPILE_FLAGS}")
 
 if(CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES)
   list(APPEND CMake_QT_EXTRA_LIBRARIES ${CMake_QT_STATIC_QXcbIntegrationPlugin_LIBRARIES})
@@ -70,7 +71,7 @@
 # We need to install platform plugin and add qt.conf for Qt5 on Mac and Windows.
 if(CMake_INSTALL_DEPENDENCIES AND (APPLE OR WIN32))
   function(_qt_get_plugin_name_with_version target out_var)
-      string(REGEX REPLACE "^Qt::(.+)" "Qt${INSTALLED_QT_VERSION}::\\1"
+      string(REGEX REPLACE "^Qt::(.+)" "Qt${CMake_QT_MAJOR_VERSION}::\\1"
              qt_plugin_with_version "${target}")
       if(TARGET "${qt_plugin_with_version}")
           set("${out_var}" "${qt_plugin_with_version}" PARENT_SCOPE)
@@ -106,23 +107,23 @@
   endmacro()
   macro(install_qt_plugins _comps _plugins_var)
     foreach(_qt_comp IN LISTS ${_comps})
-      if(INSTALLED_QT_VERSION VERSION_LESS 6)
-        set(_qt_module_plugins ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_PLUGINS})
+      if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
+        set(_qt_module_plugins ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_PLUGINS})
       else()
-        get_target_property(_qt_module_plugins Qt${INSTALLED_QT_VERSION}::${_qt_comp} QT_PLUGINS)
+        get_target_property(_qt_module_plugins Qt${CMake_QT_MAJOR_VERSION}::${_qt_comp} QT_PLUGINS)
       endif()
       foreach(_qt_plugin IN LISTS _qt_module_plugins)
-        if(INSTALLED_QT_VERSION VERSION_GREATER_EQUAL 6)
+        if(CMake_QT_MAJOR_VERSION VERSION_GREATER_EQUAL 6)
           # Qt6 provides the plugins as individual packages that need to be found.
-          find_package(Qt${INSTALLED_QT_VERSION}${_qt_plugin} QUIET
-            PATHS ${Qt${INSTALLED_QT_VERSION}${_qt_comp}_DIR})
+          find_package(Qt${CMake_QT_MAJOR_VERSION}${_qt_plugin} QUIET
+            PATHS ${Qt${CMake_QT_MAJOR_VERSION}${_qt_comp}_DIR})
         endif()
         install_qt_plugin("${_qt_plugin}" "${_plugins_var}")
       endforeach()
     endforeach()
   endmacro()
   if(APPLE)
-    if(INSTALLED_QT_VERSION VERSION_EQUAL 5)
+    if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
       install_qt_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
       if(TARGET Qt5::QMacStylePlugin)
         install_qt_plugin("Qt5::QMacStylePlugin" QT_PLUGINS)
@@ -137,7 +138,7 @@
       DESTINATION "${CMAKE_INSTALL_PREFIX}/Resources"
       ${COMPONENT})
   elseif(WIN32 AND NOT CMake_QT_STATIC_QWindowsIntegrationPlugin_LIBRARIES)
-    if(INSTALLED_QT_VERSION VERSION_EQUAL 5)
+    if(CMake_QT_MAJOR_VERSION VERSION_EQUAL 5)
       install_qt_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS)
     else()
       # FIXME: Minimize plugins for Qt6.
@@ -151,7 +152,7 @@
   endif()
 endif()
 
-get_property(_Qt_Core_LOCATION TARGET Qt${INSTALLED_QT_VERSION}::Core PROPERTY LOCATION)
+get_property(_Qt_Core_LOCATION TARGET Qt${CMake_QT_MAJOR_VERSION}::Core PROPERTY LOCATION)
 get_filename_component(Qt_BIN_DIR "${_Qt_Core_LOCATION}" PATH)
 if(APPLE)
   get_filename_component(Qt_BIN_DIR "${Qt_BIN_DIR}" PATH)
@@ -194,8 +195,8 @@
   PUBLIC
     CMakeLib
     ${CMake_QT_EXTRA_LIBRARIES}
-    Qt${INSTALLED_QT_VERSION}::Core
-    Qt${INSTALLED_QT_VERSION}::Widgets
+    Qt${CMake_QT_MAJOR_VERSION}::Core
+    Qt${CMake_QT_MAJOR_VERSION}::Widgets
   )
 
 set(UI_SRCS
@@ -223,7 +224,7 @@
   )
 set(QRC_SRCS CMakeSetup.qrc)
 
-if(INSTALLED_QT_VERSION VERSION_LESS 6)
+if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
   qt5_wrap_ui(UI_BUILT_SRCS ${UI_SRCS})
   qt5_wrap_cpp(MOC_BUILT_SRCS ${MOC_SRCS})
   qt5_add_resources(QRC_BUILT_SRCS ${QRC_SRCS})
@@ -263,13 +264,14 @@
   )
 
 add_executable(cmake-gui WIN32 MACOSX_BUNDLE CMakeGUIExec.cxx)
+set_property(TARGET cmake-gui PROPERTY CMake_QT_MAJOR_VERSION "${CMake_QT_MAJOR_VERSION}")
 target_link_libraries(cmake-gui
   PRIVATE
     CMakeGUIMainLib
     CMakeGUIQRCLib
     $<TARGET_NAME_IF_EXISTS:CMakeVersion>
     ManifestLib
-    Qt${INSTALLED_QT_VERSION}::Core
+    Qt${CMake_QT_MAJOR_VERSION}::Core
   )
 
 if(WIN32)
diff --git a/Source/QtDialog/QCMakeCacheView.cxx b/Source/QtDialog/QCMakeCacheView.cxx
index 90f5ac2..8c7801b 100644
--- a/Source/QtDialog/QCMakeCacheView.cxx
+++ b/Source/QtDialog/QCMakeCacheView.cxx
@@ -187,7 +187,7 @@
 
 QCMakeCacheModel::~QCMakeCacheModel() = default;
 
-static uint qHash(QCMakeProperty const& p)
+static size_t qHash(QCMakeProperty const& p)
 {
   return qHash(p.Key);
 }
@@ -349,7 +349,7 @@
 
   QCMakePropertyList props = this->properties();
   QCMakePropertyList oldProps;
-  int numNew = this->NewPropertyCount;
+  cm_qsizetype numNew = this->NewPropertyCount;
   cm_qsizetype numTotal = props.count();
   for (cm_qsizetype i = numNew; i < numTotal; i++) {
     oldProps.append(props[i]);
@@ -530,7 +530,7 @@
   return this->EditEnabled;
 }
 
-int QCMakeCacheModel::newPropertyCount() const
+cm_qsizetype QCMakeCacheModel::newPropertyCount() const
 {
   return this->NewPropertyCount;
 }
diff --git a/Source/QtDialog/QCMakeCacheView.h b/Source/QtDialog/QCMakeCacheView.h
index 4df17f7..879caf5 100644
--- a/Source/QtDialog/QCMakeCacheView.h
+++ b/Source/QtDialog/QCMakeCacheView.h
@@ -3,6 +3,7 @@
 #pragma once
 
 #include "QCMake.h"
+#include "QCMakeSizeType.h"
 #include <QItemDelegate>
 #include <QSet>
 #include <QStandardItemModel>
@@ -99,7 +100,7 @@
   bool editEnabled() const;
 
   // returns how many new properties there are
-  int newPropertyCount() const;
+  cm_qsizetype newPropertyCount() const;
 
   // return flags (overloaded to modify flag based on EditEnabled flag)
   Qt::ItemFlags flags(QModelIndex const& index) const;
@@ -114,7 +115,7 @@
 
 protected:
   bool EditEnabled;
-  int NewPropertyCount;
+  cm_qsizetype NewPropertyCount;
   bool ShowNewProperties;
   ViewType View;
 
diff --git a/Source/QtDialog/QCMakePresetItemModel.cxx b/Source/QtDialog/QCMakePresetItemModel.cxx
index ac071f2..4df9b1c 100644
--- a/Source/QtDialog/QCMakePresetItemModel.cxx
+++ b/Source/QtDialog/QCMakePresetItemModel.cxx
@@ -83,7 +83,8 @@
   if (this->m_presets.empty()) {
     return 1;
   }
-  return this->m_presets.size() + 2;
+  // NOLINTNEXTLINE(readability-redundant-casting)
+  return static_cast<int>(this->m_presets.size() + 2);
 }
 
 int QCMakePresetItemModel::columnCount(QModelIndex const& parent) const
@@ -144,5 +145,6 @@
     index++;
   }
 
-  return this->m_presets.size() + 1;
+  // NOLINTNEXTLINE(readability-redundant-casting)
+  return static_cast<int>(this->m_presets.size() + 1);
 }
diff --git a/Source/QtDialog/WarningMessagesDialog.cxx b/Source/QtDialog/WarningMessagesDialog.cxx
index 1fcf2b1..e409768 100644
--- a/Source/QtDialog/WarningMessagesDialog.cxx
+++ b/Source/QtDialog/WarningMessagesDialog.cxx
@@ -26,21 +26,23 @@
 
 void WarningMessagesDialog::setupSignals()
 {
+#if (QT_VERSION >= QT_VERSION_CHECK(6, 7, 0))
+  static auto const checkStateChanged = &QCheckBox::checkStateChanged;
+#else
+  static auto const checkStateChanged = &QCheckBox::stateChanged;
+#endif
   QObject::connect(this->buttonBox, &QDialogButtonBox::accepted, this,
                    &WarningMessagesDialog::doAccept);
-
-  QObject::connect(this->suppressDeveloperWarnings, &QCheckBox::stateChanged,
-                   this,
+  QObject::connect(this->suppressDeveloperWarnings, checkStateChanged, this,
                    &WarningMessagesDialog::doSuppressDeveloperWarningsChanged);
   QObject::connect(
-    this->suppressDeprecatedWarnings, &QCheckBox::stateChanged, this,
+    this->suppressDeprecatedWarnings, checkStateChanged, this,
     &WarningMessagesDialog::doSuppressDeprecatedWarningsChanged);
 
-  QObject::connect(this->developerWarningsAsErrors, &QCheckBox::stateChanged,
-                   this,
+  QObject::connect(this->developerWarningsAsErrors, checkStateChanged, this,
                    &WarningMessagesDialog::doDeveloperWarningsAsErrorsChanged);
   QObject::connect(
-    this->deprecatedWarningsAsErrors, &QCheckBox::stateChanged, this,
+    this->deprecatedWarningsAsErrors, checkStateChanged, this,
     &WarningMessagesDialog::doDeprecatedWarningsAsErrorsChanged);
 }
 
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 9421ab2..2b93daa 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -500,9 +500,10 @@
   std::string propName = lang + "_LINKER_LAUNCHER";
   cmValue launcherProp = this->GeneratorTarget->GetProperty(propName);
   if (cmNonempty(launcherProp)) {
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this->GeneratorTarget, propName, nullptr, nullptr,
-      this->LocalCommonGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this->GeneratorTarget,      propName, nullptr, nullptr,
+      this->LocalCommonGenerator, config,
+    };
     std::string evaluatedLinklauncher = cmGeneratorExpression::Evaluate(
       *launcherProp, this->LocalCommonGenerator, config, this->GeneratorTarget,
       &dagChecker, this->GeneratorTarget, lang);
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index f29697e..9840e8e 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -626,18 +626,18 @@
         if (cmValue feature = this->Target->GetProperty(key)) {
           if (!feature->empty() && key.length() > lloPrefix.length()) {
             auto item = key.substr(lloPrefix.length());
-            cmGeneratorExpressionDAGChecker dag{
-              this->Target->GetBacktrace(),
+            cmGeneratorExpressionDAGChecker dagChecker{
               this->Target,
               "LINK_LIBRARY_OVERRIDE",
               nullptr,
               nullptr,
               this->Target->GetLocalGenerator(),
-              config
+              config,
+              this->Target->GetBacktrace(),
             };
             auto overrideFeature = cmGeneratorExpression::Evaluate(
               *feature, this->Target->GetLocalGenerator(), config,
-              this->Target, &dag, this->Target, linkLanguage);
+              this->Target, &dagChecker, this->Target, linkLanguage);
             this->LinkLibraryOverride.emplace(item, overrideFeature);
           }
         }
@@ -646,16 +646,18 @@
   // global override property
   if (cmValue linkLibraryOverride =
         this->Target->GetProperty("LINK_LIBRARY_OVERRIDE")) {
-    cmGeneratorExpressionDAGChecker dag{ target->GetBacktrace(),
-                                         target,
-                                         "LINK_LIBRARY_OVERRIDE",
-                                         nullptr,
-                                         nullptr,
-                                         target->GetLocalGenerator(),
-                                         config };
+    cmGeneratorExpressionDAGChecker dagChecker{
+      target,
+      "LINK_LIBRARY_OVERRIDE",
+      nullptr,
+      nullptr,
+      target->GetLocalGenerator(),
+      config,
+      target->GetBacktrace(),
+    };
     auto overrideValue = cmGeneratorExpression::Evaluate(
-      *linkLibraryOverride, target->GetLocalGenerator(), config, target, &dag,
-      target, linkLanguage);
+      *linkLibraryOverride, target->GetLocalGenerator(), config, target,
+      &dagChecker, target, linkLanguage);
 
     std::vector<std::string> overrideList =
       cmTokenize(overrideValue, ',', cmTokenizerMode::New);
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index 021e071..ea55f47 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -86,9 +86,14 @@
       tgt, "LINK_OPTIONS", nullptr, nullptr, tgt->GetLocalGenerator(),
       this->Config);
   }
-  cmGeneratorExpressionDAGChecker dagChecker(
-    tgt, propName, nullptr, parentDagChecker.get(), tgt->GetLocalGenerator(),
-    this->Config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    tgt,
+    propName,
+    nullptr,
+    parentDagChecker.get(),
+    tgt->GetLocalGenerator(),
+    this->Config,
+  };
 
   std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
 
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 2c51cf0..07060d6 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -678,7 +678,7 @@
   }
   if (cmValue const sd =
         this->Makefile->GetDefinition("CMAKE_FIND_PACKAGE_SORT_DIRECTION")) {
-    this->SortDirection = (*sd == "ASC") ? Asc : Dec;
+    this->SortDirection = (*sd == "DEC") ? Dec : Asc;
   }
 
   // Find what search path locations have been enabled/disable.
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index 23b0a47..8c52d2b 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -425,10 +425,14 @@
     this->GeneratorExpression.Parse(std::move(expression));
 
   // Specify COMPILE_OPTIONS to DAGchecker, same semantic as COMPILE_FLAGS
-  cmGeneratorExpressionDAGChecker dagChecker(
+  cmGeneratorExpressionDAGChecker dagChecker{
     this->HeadTarget,
-    property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property, nullptr,
-    nullptr, this->LocalGenerator, this->Config);
+    property == "COMPILE_FLAGS" ? "COMPILE_OPTIONS" : property,
+    nullptr,
+    nullptr,
+    this->LocalGenerator,
+    this->Config,
+  };
 
   return this->CompiledGeneratorExpression->Evaluate(
     this->LocalGenerator, this->Config, this->HeadTarget, &dagChecker, nullptr,
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index 8f88901..6457dc2 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -21,32 +21,22 @@
   cmGeneratorTarget const* target, std::string property,
   GeneratorExpressionContent const* content,
   cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
-  std::string const& contextConfig)
-  : cmGeneratorExpressionDAGChecker(cmListFileBacktrace(), target,
-                                    std::move(property), content, parent,
-                                    contextLG, contextConfig)
-{
-}
-
-cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
-  cmListFileBacktrace backtrace, cmGeneratorTarget const* target,
-  std::string property, GeneratorExpressionContent const* content,
-  cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
-  std::string const& contextConfig)
+  std::string const& contextConfig, cmListFileBacktrace backtrace,
+  ComputingLinkLibraries computingLinkLibraries)
   : Parent(parent)
   , Top(parent ? parent->Top : this)
   , Target(target)
   , Property(std::move(property))
   , Content(content)
   , Backtrace(std::move(backtrace))
+  , ComputingLinkLibraries_(computingLinkLibraries)
 {
   if (parent) {
     this->TopIsTransitiveProperty = parent->TopIsTransitiveProperty;
   } else {
     this->TopIsTransitiveProperty =
       this->Target
-        ->IsTransitiveProperty(this->Property, contextLG, contextConfig,
-                               this->EvaluatingLinkLibraries())
+        ->IsTransitiveProperty(this->Property, contextLG, contextConfig, this)
         .has_value();
   }
 
@@ -204,6 +194,11 @@
     "_LINKER_LAUNCHER"_s;
 }
 
+bool cmGeneratorExpressionDAGChecker::IsComputingLinkLibraries() const
+{
+  return this->Top->ComputingLinkLibraries_ == ComputingLinkLibraries::Yes;
+}
+
 bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(
   cmGeneratorTarget const* tgt, ForGenex genex) const
 {
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index a07169d..7b2d411 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -17,19 +17,19 @@
 
 struct cmGeneratorExpressionDAGChecker
 {
-  cmGeneratorExpressionDAGChecker(cmListFileBacktrace backtrace,
-                                  cmGeneratorTarget const* target,
-                                  std::string property,
-                                  GeneratorExpressionContent const* content,
-                                  cmGeneratorExpressionDAGChecker* parent,
-                                  cmLocalGenerator const* contextLG,
-                                  std::string const& contextConfig);
-  cmGeneratorExpressionDAGChecker(cmGeneratorTarget const* target,
-                                  std::string property,
-                                  GeneratorExpressionContent const* content,
-                                  cmGeneratorExpressionDAGChecker* parent,
-                                  cmLocalGenerator const* contextLG,
-                                  std::string const& contextConfig);
+  enum class ComputingLinkLibraries
+  {
+    No,
+    Yes,
+  };
+  cmGeneratorExpressionDAGChecker(
+    cmGeneratorTarget const* target, std::string property,
+    GeneratorExpressionContent const* content,
+    cmGeneratorExpressionDAGChecker* parent, cmLocalGenerator const* contextLG,
+    std::string const& contextConfig,
+    cmListFileBacktrace backtrace = cmListFileBacktrace(),
+    ComputingLinkLibraries computingLinkLibraries =
+      ComputingLinkLibraries::No);
 
   enum Result
   {
@@ -52,6 +52,11 @@
   bool EvaluatingLinkOptionsExpression() const;
   bool EvaluatingLinkerLauncher() const;
 
+  /** Returns true only when computing the actual link dependency
+      graph for cmGeneratorTarget::GetLinkImplementationLibraries
+      or cmGeneratorTarget::GetLinkInterfaceLibraries.  */
+  bool IsComputingLinkLibraries() const;
+
   enum class ForGenex
   {
     ANY,
@@ -85,4 +90,6 @@
   bool TransitivePropertiesOnly = false;
   bool CMP0131 = false;
   bool TopIsTransitiveProperty = false;
+  ComputingLinkLibraries const ComputingLinkLibraries_ =
+    ComputingLinkLibraries::No;
 };
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index c67ce01..5a4a291 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -483,10 +483,15 @@
     cmGeneratorExpressionDAGChecker* dagCheckerParent) const
   {
     if (context->HeadTarget) {
-      cmGeneratorExpressionDAGChecker dagChecker(
-        context->Backtrace, context->HeadTarget,
-        genexOperator + ":" + expression, content, dagCheckerParent,
-        context->LG, context->Config);
+      cmGeneratorExpressionDAGChecker dagChecker{
+        context->HeadTarget,
+        genexOperator + ":" + expression,
+        content,
+        dagCheckerParent,
+        context->LG,
+        context->Config,
+        context->Backtrace,
+      };
       switch (dagChecker.Check()) {
         case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
         case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE: {
@@ -2957,8 +2962,7 @@
 
     if (cm::optional<cmGeneratorTarget::TransitiveProperty> transitiveProp =
           target->IsTransitiveProperty(propertyName, context->LG,
-                                       context->Config,
-                                       evaluatingLinkLibraries)) {
+                                       context->Config, dagCheckerParent)) {
       interfacePropertyName = std::string(transitiveProp->InterfaceName);
       isInterfaceProperty = transitiveProp->InterfaceName == propertyName;
       usage = transitiveProp->Usage;
@@ -2992,9 +2996,15 @@
                                           dagCheckerParent, usage));
     }
 
-    cmGeneratorExpressionDAGChecker dagChecker(
-      context->Backtrace, target, propertyName, content, dagCheckerParent,
-      context->LG, context->Config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      target,
+      propertyName,
+      content,
+      dagCheckerParent,
+      context->LG,
+      context->Config,
+      context->Backtrace,
+    };
 
     switch (dagChecker.Check()) {
       case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 40a73b1..25ce031 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -737,8 +737,9 @@
   std::string propName{ "LINKER_TYPE" };
   auto linkerType = this->GetProperty(propName);
   if (!linkerType.IsEmpty()) {
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this, propName, nullptr, nullptr, this->LocalGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this, propName, nullptr, nullptr, this->LocalGenerator, config,
+    };
     auto ltype =
       cmGeneratorExpression::Evaluate(*linkerType, this->GetLocalGenerator(),
                                       config, this, &dagChecker, this, lang);
@@ -1198,9 +1199,10 @@
   std::string const& key, std::string const& config,
   std::string const& language) const
 {
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "SYSTEM_INCLUDE_DIRECTORIES", nullptr, nullptr, this->LocalGenerator,
-    config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "SYSTEM_INCLUDE_DIRECTORIES", nullptr,
+    nullptr, this->LocalGenerator,         config,
+  };
 
   bool excludeImported = this->GetPropertyAsBool("NO_SYSTEM_FROM_IMPORTED");
 
@@ -1969,8 +1971,9 @@
     return;
   }
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "AUTOUIC_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "AUTOUIC_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
   cmExpandList(cmGeneratorExpression::Evaluate(prop, this->LocalGenerator,
                                                config, this, &dagChecker),
                result);
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 931e1a1..93dc0a8 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -1006,7 +1006,8 @@
 
   cm::optional<TransitiveProperty> IsTransitiveProperty(
     cm::string_view prop, cmLocalGenerator const* lg,
-    std::string const& config, bool evaluatingLinkLibraries) const;
+    std::string const& config,
+    cmGeneratorExpressionDAGChecker const* dagChecker) const;
 
   bool HaveInstallTreeRPATH(std::string const& config) const;
 
diff --git a/Source/cmGeneratorTarget_IncludeDirectories.cxx b/Source/cmGeneratorTarget_IncludeDirectories.cxx
index 1317f27..9ca5ed0 100644
--- a/Source/cmGeneratorTarget_IncludeDirectories.cxx
+++ b/Source/cmGeneratorTarget_IncludeDirectories.cxx
@@ -46,13 +46,18 @@
   std::string const& propertyName, IncludeDirectoryFallBack mode,
   cmGeneratorExpressionDAGChecker* context)
 {
-  cmGeneratorExpressionDAGChecker dag{
-    target->GetBacktrace(),      target, propertyName, nullptr, context,
-    target->GetLocalGenerator(), config
+  cmGeneratorExpressionDAGChecker dagChecker{
+    target,
+    propertyName,
+    nullptr,
+    context,
+    target->GetLocalGenerator(),
+    config,
+    target->GetBacktrace(),
   };
-  switch (dag.Check()) {
+  switch (dagChecker.Check()) {
     case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
-      dag.ReportError(
+      dagChecker.ReportError(
         nullptr, "$<TARGET_PROPERTY:" + target->GetName() + ",propertyName");
       CM_FALLTHROUGH;
     case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
@@ -99,9 +104,14 @@
 {
   if (auto const* libraries =
         target->GetLinkImplementationLibraries(config, UseTo::Compile)) {
-    cmGeneratorExpressionDAGChecker dag{
-      target->GetBacktrace(),      target, propertyName, nullptr, nullptr,
-      target->GetLocalGenerator(), config
+    cmGeneratorExpressionDAGChecker dagChecker{
+      target,
+      propertyName,
+      nullptr,
+      nullptr,
+      target->GetLocalGenerator(),
+      config,
+      target->GetBacktrace(),
     };
 
     for (cmLinkImplItem const& library : libraries->Libraries) {
@@ -127,10 +137,10 @@
             }
           }
 
-          cmExpandList(
-            AddLangSpecificInterfaceIncludeDirectories(
-              target, dependency, lang, config, propertyName, mode, &dag),
-            entry.Values);
+          cmExpandList(AddLangSpecificInterfaceIncludeDirectories(
+                         target, dependency, lang, config, propertyName, mode,
+                         &dagChecker),
+                       entry.Values);
           entries.Entries.emplace_back(std::move(entry));
         }
       }
@@ -222,9 +232,10 @@
   std::vector<BT<std::string>> includes;
   std::unordered_set<std::string> uniqueIncludes;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "INCLUDE_DIRECTORIES",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "INCLUDE_DIRECTORIES", nullptr,
+    nullptr, this->LocalGenerator,  config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
diff --git a/Source/cmGeneratorTarget_Link.cxx b/Source/cmGeneratorTarget_Link.cxx
index ffeecc1..1111393 100644
--- a/Source/cmGeneratorTarget_Link.cxx
+++ b/Source/cmGeneratorTarget_Link.cxx
@@ -542,8 +542,16 @@
     return;
   }
   // Keep this logic in sync with ComputeLinkImplementationLibraries.
-  cmGeneratorExpressionDAGChecker dagChecker(this, prop, nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,
+    prop,
+    nullptr,
+    nullptr,
+    this->LocalGenerator,
+    config,
+    cmListFileBacktrace(),
+    cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
+  };
   // The $<LINK_ONLY> expression may be in a link interface to specify
   // private link dependencies that are otherwise excluded from usage
   // requirements.
@@ -1133,8 +1141,16 @@
   // Collect libraries directly linked in this configuration.
   for (auto const& entry : entryRange) {
     // Keep this logic in sync with ExpandLinkItems.
-    cmGeneratorExpressionDAGChecker dagChecker(
-      this, "LINK_LIBRARIES", nullptr, nullptr, this->LocalGenerator, config);
+    cmGeneratorExpressionDAGChecker dagChecker{
+      this,
+      "LINK_LIBRARIES",
+      nullptr,
+      nullptr,
+      this->LocalGenerator,
+      config,
+      cmListFileBacktrace(),
+      cmGeneratorExpressionDAGChecker::ComputingLinkLibraries::Yes,
+    };
     // The $<LINK_ONLY> expression may be used to specify link dependencies
     // that are otherwise excluded from usage requirements.
     if (usage == UseTo::Compile) {
diff --git a/Source/cmGeneratorTarget_LinkDirectories.cxx b/Source/cmGeneratorTarget_LinkDirectories.cxx
index f7c2108..90c8d7e 100644
--- a/Source/cmGeneratorTarget_LinkDirectories.cxx
+++ b/Source/cmGeneratorTarget_LinkDirectories.cxx
@@ -122,8 +122,9 @@
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueDirectories;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_DIRECTORIES", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_DIRECTORIES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
diff --git a/Source/cmGeneratorTarget_Options.cxx b/Source/cmGeneratorTarget_Options.cxx
index 13b284c..5bd4902 100644
--- a/Source/cmGeneratorTarget_Options.cxx
+++ b/Source/cmGeneratorTarget_Options.cxx
@@ -230,8 +230,9 @@
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "COMPILE_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "COMPILE_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -269,8 +270,9 @@
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueFeatures;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "COMPILE_FEATURES", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "COMPILE_FEATURES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -317,9 +319,10 @@
   std::vector<BT<std::string>> list;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "COMPILE_DEFINITIONS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "COMPILE_DEFINITIONS", nullptr,
+    nullptr, this->LocalGenerator,  config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -353,9 +356,9 @@
   }
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "PRECOMPILE_HEADERS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "PRECOMPILE_HEADERS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -410,8 +413,9 @@
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_OPTIONS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_OPTIONS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   cmList debugProperties{ this->Makefile->GetDefinition(
     "CMAKE_DEBUG_TARGET_PROPERTIES") };
@@ -591,9 +595,10 @@
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "STATIC_LIBRARY_OPTIONS",
-                                             nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,    "STATIC_LIBRARY_OPTIONS", nullptr,
+    nullptr, this->LocalGenerator,     config,
+  };
 
   EvaluatedTargetPropertyEntries entries;
   if (cmValue linkOptions = this->GetProperty("STATIC_LIBRARY_OPTIONS")) {
@@ -635,8 +640,9 @@
 {
   std::vector<BT<std::string>> result;
   std::unordered_set<std::string> uniqueOptions;
-  cmGeneratorExpressionDAGChecker dagChecker(
-    this, "LINK_DEPENDS", nullptr, nullptr, this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "LINK_DEPENDS", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   EvaluatedTargetPropertyEntries entries;
   if (cmValue linkDepends = this->GetProperty("LINK_DEPENDS")) {
diff --git a/Source/cmGeneratorTarget_Sources.cxx b/Source/cmGeneratorTarget_Sources.cxx
index 742d0d9..b699761 100644
--- a/Source/cmGeneratorTarget_Sources.cxx
+++ b/Source/cmGeneratorTarget_Sources.cxx
@@ -240,8 +240,9 @@
 
   this->DebugSourcesDone = true;
 
-  cmGeneratorExpressionDAGChecker dagChecker(this, "SOURCES", nullptr, nullptr,
-                                             this->LocalGenerator, config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this, "SOURCES", nullptr, nullptr, this->LocalGenerator, config,
+  };
 
   EvaluatedTargetPropertyEntries entries = EvaluateTargetPropertyEntries(
     this, config, std::string(), &dagChecker, this->SourceEntries);
diff --git a/Source/cmGeneratorTarget_TransitiveProperty.cxx b/Source/cmGeneratorTarget_TransitiveProperty.cxx
index fadd801..855ddea 100644
--- a/Source/cmGeneratorTarget_TransitiveProperty.cxx
+++ b/Source/cmGeneratorTarget_TransitiveProperty.cxx
@@ -109,9 +109,15 @@
   // Evaluate $<TARGET_PROPERTY:this,prop> as if it were compiled.  This is
   // a subset of TargetPropertyNode::Evaluate without stringify/parse steps
   // but sufficient for transitive interface properties.
-  cmGeneratorExpressionDAGChecker dagChecker(
-    context->Backtrace, this, prop, nullptr, dagCheckerParent,
-    this->LocalGenerator, context->Config);
+  cmGeneratorExpressionDAGChecker dagChecker{
+    this,
+    prop,
+    nullptr,
+    dagCheckerParent,
+    context->LG,
+    context->Config,
+    context->Backtrace,
+  };
   switch (dagChecker.Check()) {
     case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
       dagChecker.ReportError(
@@ -177,10 +183,9 @@
 }
 
 cm::optional<cmGeneratorTarget::TransitiveProperty>
-cmGeneratorTarget::IsTransitiveProperty(cm::string_view prop,
-                                        cmLocalGenerator const* lg,
-                                        std::string const& config,
-                                        bool evaluatingLinkLibraries) const
+cmGeneratorTarget::IsTransitiveProperty(
+  cm::string_view prop, cmLocalGenerator const* lg, std::string const& config,
+  cmGeneratorExpressionDAGChecker const* dagChecker) const
 {
   cm::optional<TransitiveProperty> result;
   static cm::string_view const kINTERFACE_ = "INTERFACE_"_s;
@@ -202,7 +207,7 @@
         result->Usage = cmGeneratorTarget::UseTo::Compile;
       }
     }
-  } else if (!evaluatingLinkLibraries) {
+  } else if (!dagChecker || !dagChecker->IsComputingLinkLibraries()) {
     // Honor TRANSITIVE_COMPILE_PROPERTIES and TRANSITIVE_LINK_PROPERTIES
     // from the link closure when we are not evaluating the closure itself.
     CustomTransitiveProperties const& ctp =
diff --git a/Source/cmInstrumentation.cxx b/Source/cmInstrumentation.cxx
index 2c4414f..dff389d 100644
--- a/Source/cmInstrumentation.cxx
+++ b/Source/cmInstrumentation.cxx
@@ -538,7 +538,7 @@
 {
   std::string command_str;
   for (size_t i = 0; i < args.size(); ++i) {
-    command_str = cmStrCat(command_str, args[i]);
+    command_str = cmStrCat(command_str, '"', args[i], '"');
     if (i < args.size() - 1) {
       command_str = cmStrCat(command_str, ' ');
     }
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 152a68b..9ec29ff 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1920,9 +1920,10 @@
     if (this->MultiConfig) {
       for (auto const& cfg : this->ConfigsList) {
         if (!cfg.empty()) {
-          cmGeneratorExpressionDAGChecker dagChecker(
-            this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr,
-            this->LocalGen, cfg);
+          cmGeneratorExpressionDAGChecker dagChecker{
+            this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
+            nullptr,         this->LocalGen,        cfg,
+          };
           AddInterfaceEntries(this->GenTarget, cfg,
                               "INTERFACE_AUTOMOC_MACRO_NAMES", "CXX",
                               &dagChecker, InterfaceAutoMocMacroNamesEntries,
@@ -1930,9 +1931,10 @@
         }
       }
     } else {
-      cmGeneratorExpressionDAGChecker dagChecker(
-        this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr, nullptr,
-        this->LocalGen, this->ConfigDefault);
+      cmGeneratorExpressionDAGChecker dagChecker{
+        this->GenTarget, "AUTOMOC_MACRO_NAMES", nullptr,
+        nullptr,         this->LocalGen,        this->ConfigDefault,
+      };
       AddInterfaceEntries(this->GenTarget, this->ConfigDefault,
                           "INTERFACE_AUTOMOC_MACRO_NAMES", "CXX", &dagChecker,
                           InterfaceAutoMocMacroNamesEntries,
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index 3bb2fd6..0ccecfd 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -97,7 +97,7 @@
 
   /* If no test name was given */
   /* process command line with user function.  */
-  if (ac < 2) {
+  if (ac > 0 && ac < 2) {
     /* Ask for a test.  */
     printf("Available tests:\n");
     for (i = 0; i < NumTests; ++i) {
diff --git a/Tests/CMakeGUI/CMakeGUITest.cxx b/Tests/CMakeGUI/CMakeGUITest.cxx
index a3414fd..c6b6f63 100644
--- a/Tests/CMakeGUI/CMakeGUITest.cxx
+++ b/Tests/CMakeGUI/CMakeGUITest.cxx
@@ -75,7 +75,8 @@
     Qt::QueuedConnection);
   QVERIFY(configureDoneSpy.wait(timeout));
 
-  QCOMPARE(configureDoneSpy, { { expectedResult } });
+  QList<QVariant> configureDoneSignalArguments = configureDoneSpy.takeFirst();
+  QCOMPARE(configureDoneSignalArguments.at(0).toInt(), expectedResult);
 }
 
 void CMakeGUITest::sourceBinaryArgs()
diff --git a/Tests/CMakeGUI/CMakeLists.txt b/Tests/CMakeGUI/CMakeLists.txt
index c9f44e9..d4c9bf8 100644
--- a/Tests/CMakeGUI/CMakeLists.txt
+++ b/Tests/CMakeGUI/CMakeLists.txt
@@ -1,6 +1,8 @@
 include(CMakeParseArguments)
 
-find_package(Qt5Test REQUIRED)
+get_property(CMake_QT_MAJOR_VERSION TARGET cmake-gui PROPERTY CMake_QT_MAJOR_VERSION)
+
+find_package(Qt${CMake_QT_MAJOR_VERSION}Test REQUIRED)
 
 if(MSVC)
   # QTBUG-118993: Qt uses deprecated stdext::checked_array_iterator
@@ -14,21 +16,40 @@
   )
 
 set(MOC_SRCS)
-qt5_wrap_cpp(MOC_SRCS
-  CatchShow.h
-  )
+if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
+  qt5_wrap_cpp(MOC_SRCS
+    CatchShow.h
+    )
+else()
+  qt_wrap_cpp(MOC_SRCS
+    CatchShow.h
+    )
+endif()
 add_library(CMakeGUITestLib STATIC ${MOC_SRCS}
   CatchShow.cxx
   CatchShow.h
   )
-target_link_libraries(CMakeGUITestLib Qt5::Core Qt5::Gui Qt5::Widgets)
+target_link_libraries(CMakeGUITestLib
+  Qt${CMake_QT_MAJOR_VERSION}::Core
+  Qt${CMake_QT_MAJOR_VERSION}::Gui
+  Qt${CMake_QT_MAJOR_VERSION}::Widgets)
 
 set(MOC_SRCS)
-qt5_wrap_cpp(MOC_SRCS
-  CMakeGUITest.h
-  )
+if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
+  qt5_wrap_cpp(MOC_SRCS
+    CMakeGUITest.h
+    )
+else()
+  qt_wrap_cpp(MOC_SRCS
+    CMakeGUITest.h
+    )
+endif()
 add_executable(CMakeGUITest CMakeGUITest.cxx ${MOC_SRCS})
-target_link_libraries(CMakeGUITest CMakeGUIMainLib CMakeGUITestLib Qt5::Core Qt5::Test Qt5::Widgets)
+target_link_libraries(CMakeGUITest CMakeGUIMainLib CMakeGUITestLib
+  Qt${CMake_QT_MAJOR_VERSION}::Core
+  Qt${CMake_QT_MAJOR_VERSION}::Test
+  Qt${CMake_QT_MAJOR_VERSION}::Widgets
+)
 target_compile_definitions(CMakeGUITest PRIVATE
   "CMakeGUITest_SOURCE_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\""
   "CMakeGUITest_BINARY_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\""
@@ -47,11 +68,20 @@
   cmake_parse_arguments(_t "" "" "SOURCES;MOC_SOURCES" ${ARGN})
 
   set(MOC_SRCS)
-  qt5_wrap_cpp(MOC_SRCS
-    ${_t_MOC_SOURCES}
-    )
+  if(CMake_QT_MAJOR_VERSION VERSION_LESS 6)
+    qt5_wrap_cpp(MOC_SRCS
+      ${_t_MOC_SOURCES}
+      )
+  else()
+    qt_wrap_cpp(MOC_SRCS
+      ${_t_MOC_SOURCES}
+      )
+  endif()
   add_executable(${name} ${_t_SOURCES} ${MOC_SRCS})
-  target_link_libraries(${name} CMakeGUILib CMakeGUITestLib Qt5::Core Qt5::Test Qt5::Widgets)
+  target_link_libraries(${name} CMakeGUILib CMakeGUITestLib
+    Qt${CMake_QT_MAJOR_VERSION}::Core
+    Qt${CMake_QT_MAJOR_VERSION}::Test
+    Qt${CMake_QT_MAJOR_VERSION}::Widgets)
 
   add_test(NAME "CMakeGUILib.${name}" COMMAND ${name})
 endfunction()
diff --git a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
index 97dbb30..a2320b3 100644
--- a/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
+++ b/Tests/CMakeGUI/QCMakePresetItemModelTest.cxx
@@ -17,7 +17,9 @@
 
 void QCMakePresetItemModelTest::initTestCase()
 {
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
   QMetaType::registerComparators<QCMakePreset>();
+#endif
 }
 
 void QCMakePresetItemModelTest::initTestCase_data()
diff --git a/Tests/CustomTransitiveProperties/CMakeLists.txt b/Tests/CustomTransitiveProperties/CMakeLists.txt
index 83ceff5..a9ac2b8 100644
--- a/Tests/CustomTransitiveProperties/CMakeLists.txt
+++ b/Tests/CustomTransitiveProperties/CMakeLists.txt
@@ -90,9 +90,22 @@
   $<TARGET_PROPERTY:CUSTOM_W>
   )
 
+# Test TRANSITIVE_LINK_PROPERTIES containing LINK_LIBRARIES itself.
+add_library(iface10 INTERFACE)
+set_property(TARGET iface10 PROPERTY TRANSITIVE_LINK_PROPERTIES "LINK_LIBRARIES")
+add_library(iface11 INTERFACE)
+target_link_libraries(iface11 INTERFACE iface10)
+add_library(static10 STATIC static10.c)
+target_link_libraries(static10 PRIVATE iface11)
+add_library(static11 STATIC static11.c)
+target_link_libraries(static11 PRIVATE static10 iface11)
+add_executable(main10 main10.c)
+target_link_libraries(main10 PRIVATE static11 static10)
+
 # Test TRANSITIVE_*_PROPERTY evaluation outside of usage requirements.
+add_executable(check-args check-args.c)
 set(out "${CMAKE_CURRENT_BINARY_DIR}/out-$<CONFIG>.txt")
-file(GENERATE OUTPUT "${out}" CONTENT "# file(GENERATE) produced:
+set(in_CUSTOM [====[
 iface1 CUSTOM_A: '$<TARGET_PROPERTY:iface1,CUSTOM_A>'
 iface1 INTERFACE_CUSTOM_A: '$<TARGET_PROPERTY:iface1,INTERFACE_CUSTOM_A>'
 iface2 CUSTOM_A: '$<TARGET_PROPERTY:iface2,CUSTOM_A>'
@@ -125,10 +138,35 @@
 main INTERFACE_CUSTOM_V: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_V>'
 main CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>'
 main INTERFACE_CUSTOM_W: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_CUSTOM_W>'
+]====])
+set(in_LINK_LIBRARIES [====[
+iface1 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface1,LINK_LIBRARIES>'
+iface1 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface1,INTERFACE_LINK_LIBRARIES>'
+iface2 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface2,LINK_LIBRARIES>'
+iface2 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface2,INTERFACE_LINK_LIBRARIES>'
+static1 LINK_LIBRARIES: '$<TARGET_PROPERTY:static1,LINK_LIBRARIES>'
+static1 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static1,INTERFACE_LINK_LIBRARIES>'
+main LINK_LIBRARIES: '$<TARGET_PROPERTY:CustomTransitiveProperties,LINK_LIBRARIES>'
+main INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_LINK_LIBRARIES>'
+iface10 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface10,LINK_LIBRARIES>'
+iface10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface10,INTERFACE_LINK_LIBRARIES>'
+iface11 LINK_LIBRARIES: '$<TARGET_PROPERTY:iface11,LINK_LIBRARIES>'
+iface11 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:iface11,INTERFACE_LINK_LIBRARIES>'
+static10 LINK_LIBRARIES: '$<TARGET_PROPERTY:static10,LINK_LIBRARIES>'
+static10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static10,INTERFACE_LINK_LIBRARIES>'
+static11 LINK_LIBRARIES: '$<TARGET_PROPERTY:static11,LINK_LIBRARIES>'
+static11 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:static11,INTERFACE_LINK_LIBRARIES>'
+main10 LINK_LIBRARIES: '$<TARGET_PROPERTY:main10,LINK_LIBRARIES>'
+main10 INTERFACE_LINK_LIBRARIES: '$<TARGET_PROPERTY:main10,INTERFACE_LINK_LIBRARIES>'
+]====])
+file(GENERATE OUTPUT "${out}" CONTENT "# file(GENERATE) produced:
+${in_CUSTOM}
+${in_LINK_LIBRARIES}
 ")
 add_custom_target(check ALL VERBATIM
   COMMAND ${CMAKE_COMMAND} -Dconfig=$<CONFIG> -Dout=${out} -P${CMAKE_CURRENT_SOURCE_DIR}/check.cmake
   COMMAND CustomTransitiveProperties
+  COMMAND check-args
   "$<TARGET_PROPERTY:static1,CUSTOM_A>" "CUSTOM_A_STATIC1;CUSTOM_A_IFACE2;CUSTOM_A_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_A_IFACE1;CUSTOM_A_TARGET_NAME_STATIC1"
   "$<TARGET_PROPERTY:static1,CUSTOM_B>" "CUSTOM_B_STATIC1;CUSTOM_B_IFACE1"
   "$<TARGET_PROPERTY:static1,CUSTOM_U>" "CUSTOM_U_STATIC1;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_STATIC_LIBRARY;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_STATIC1"
@@ -143,4 +181,33 @@
   "$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_U>" "CUSTOM_U_MAIN;CUSTOM_U_STATIC1_IFACE;CUSTOM_U_IFACE2;CUSTOM_U_TARGET_TYPE_EXECUTABLE;CUSTOM_U_IFACE1;CUSTOM_U_TARGET_NAME_CUSTOMTRANSITIVEPROPERTIES;CUSTOM_U_OBJECT1_IFACE"
   "$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_V>" "CUSTOM_V_MAIN;CUSTOM_V_STATIC1_IFACE;CUSTOM_V_IFACE1"
   "$<TARGET_PROPERTY:CustomTransitiveProperties,CUSTOM_W>" "CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE"
+  COMMAND check-args
+  "$<TARGET_PROPERTY:iface1,LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface1,INTERFACE_LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface2,LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface2,INTERFACE_LINK_LIBRARIES>" "iface1"
+  "$<TARGET_PROPERTY:static1,LINK_LIBRARIES>" "iface2"
+  "$<TARGET_PROPERTY:static1,INTERFACE_LINK_LIBRARIES>" "$<LINK_ONLY:iface2$<ANGLE-R>"
+  "$<TARGET_PROPERTY:CustomTransitiveProperties,LINK_LIBRARIES>" "static1;object1"
+  "$<TARGET_PROPERTY:CustomTransitiveProperties,INTERFACE_LINK_LIBRARIES>" ""
+  COMMAND check-args
+  "$<TARGET_PROPERTY:iface10,LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface10,INTERFACE_LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface11,LINK_LIBRARIES>" ""
+  "$<TARGET_PROPERTY:iface11,INTERFACE_LINK_LIBRARIES>" "iface10"
+  "$<TARGET_PROPERTY:static10,LINK_LIBRARIES>" "iface11;iface10"
+  #                                              _/         \__
+  #                                             /              \
+  #                               "static10[iface11];iface11[iface10]"
+  "$<TARGET_PROPERTY:static10,INTERFACE_LINK_LIBRARIES>" "iface11;iface10"
+  "$<TARGET_PROPERTY:static11,LINK_LIBRARIES>" "static10;iface11;iface11;iface10"
+  #                                             __/      __/         \__     \__________
+  #                                            /        /               \               \
+  #                              "static11[static10;iface11];static10[iface11;iface11[iface10]]"
+  "$<TARGET_PROPERTY:static11,INTERFACE_LINK_LIBRARIES>" "static10;iface11;iface11;iface10"
+  "$<TARGET_PROPERTY:main10,LINK_LIBRARIES>" "static11;static10;static10;iface11;iface11;iface10"
+  #                                      _______/ _______/         |        |        \______ \______________
+  #                                     /        /                 |        |               \               \
+  #                         "main10[static11;static10];static11[static10;iface11;static10[iface11;iface11[iface10]]]"
+  "$<TARGET_PROPERTY:main10,INTERFACE_LINK_LIBRARIES>" ""
   )
diff --git a/Tests/CustomTransitiveProperties/check-args.c b/Tests/CustomTransitiveProperties/check-args.c
new file mode 100644
index 0000000..da97f8a
--- /dev/null
+++ b/Tests/CustomTransitiveProperties/check-args.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <string.h>
+
+int main(int argc, char** argv)
+{
+  int result = 0;
+  int i;
+  for (i = 2; i < argc; i += 2) {
+    if (strcmp(argv[i - 1], argv[i]) != 0) {
+      fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i, argv[i],
+              argv[i - 1]);
+      result = 1;
+    }
+  }
+  return result;
+}
diff --git a/Tests/CustomTransitiveProperties/check.cmake b/Tests/CustomTransitiveProperties/check.cmake
index d7130c8..0798542 100644
--- a/Tests/CustomTransitiveProperties/check.cmake
+++ b/Tests/CustomTransitiveProperties/check.cmake
@@ -32,6 +32,25 @@
 main INTERFACE_CUSTOM_V: ''
 main CUSTOM_W: 'CUSTOM_W_MAIN;CUSTOM_W_IFACE1;CUSTOM_W_OBJECT1_IFACE'
 main INTERFACE_CUSTOM_W: ''
+
+iface1 LINK_LIBRARIES: ''
+iface1 INTERFACE_LINK_LIBRARIES: ''
+iface2 LINK_LIBRARIES: ''
+iface2 INTERFACE_LINK_LIBRARIES: 'iface1'
+static1 LINK_LIBRARIES: 'iface2'
+static1 INTERFACE_LINK_LIBRARIES: '\$<LINK_ONLY:iface2>'
+main LINK_LIBRARIES: 'static1;object1'
+main INTERFACE_LINK_LIBRARIES: ''
+iface10 LINK_LIBRARIES: ''
+iface10 INTERFACE_LINK_LIBRARIES: ''
+iface11 LINK_LIBRARIES: ''
+iface11 INTERFACE_LINK_LIBRARIES: 'iface10'
+static10 LINK_LIBRARIES: 'iface11;iface10'
+static10 INTERFACE_LINK_LIBRARIES: 'iface11;iface10'
+static11 LINK_LIBRARIES: 'static10;iface11;iface11;iface10'
+static11 INTERFACE_LINK_LIBRARIES: 'static10;iface11;iface11;iface10'
+main10 LINK_LIBRARIES: 'static11;static10;static10;iface11;iface11;iface10'
+main10 INTERFACE_LINK_LIBRARIES: ''
 ]])
 string(REGEX REPLACE "\r\n" "\n" expect "${expect}")
 string(REGEX REPLACE "\n+$" "" expect "${expect}")
diff --git a/Tests/CustomTransitiveProperties/main.c b/Tests/CustomTransitiveProperties/main.c
index ab70eb0..03325a0 100644
--- a/Tests/CustomTransitiveProperties/main.c
+++ b/Tests/CustomTransitiveProperties/main.c
@@ -1,6 +1,3 @@
-#include <stdio.h>
-#include <string.h>
-
 #ifdef CUSTOM_A_IFACE1
 #  error "CUSTOM_A_IFACE1 incorrectly defined"
 #endif
@@ -117,21 +114,7 @@
 extern int static1(void);
 extern int object1(void);
 
-int check_args(int argc, char** argv)
+int main(void)
 {
-  int result = 0;
-  int i;
-  for (i = 2; i < argc; i += 2) {
-    if (strcmp(argv[i - 1], argv[i]) != 0) {
-      fprintf(stderr, "Argument %d expected '%s' but got '%s'.\n", i, argv[i],
-              argv[i - 1]);
-      result = 1;
-    }
-  }
-  return result;
-}
-
-int main(int argc, char** argv)
-{
-  return static1() + object1() + check_args(argc, argv);
+  return static1() + object1();
 }
diff --git a/Tests/CustomTransitiveProperties/main10.c b/Tests/CustomTransitiveProperties/main10.c
new file mode 100644
index 0000000..369683c
--- /dev/null
+++ b/Tests/CustomTransitiveProperties/main10.c
@@ -0,0 +1,7 @@
+extern int static10(void);
+extern int static11(void);
+
+int main(void)
+{
+  return static10() + static11();
+}
diff --git a/Tests/CustomTransitiveProperties/static10.c b/Tests/CustomTransitiveProperties/static10.c
new file mode 100644
index 0000000..6359f22
--- /dev/null
+++ b/Tests/CustomTransitiveProperties/static10.c
@@ -0,0 +1,4 @@
+int static10(void)
+{
+  return 0;
+}
diff --git a/Tests/CustomTransitiveProperties/static11.c b/Tests/CustomTransitiveProperties/static11.c
new file mode 100644
index 0000000..0ba822d
--- /dev/null
+++ b/Tests/CustomTransitiveProperties/static11.c
@@ -0,0 +1,4 @@
+int static11(void)
+{
+  return 0;
+}
diff --git a/Tests/FindPackageCMakeTest/CMakeLists.txt b/Tests/FindPackageCMakeTest/CMakeLists.txt
index 3e01029..bd1887a 100644
--- a/Tests/FindPackageCMakeTest/CMakeLists.txt
+++ b/Tests/FindPackageCMakeTest/CMakeLists.txt
@@ -554,14 +554,15 @@
 ##Test FIND_PACKAGE using sorting
 set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
 
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
-SET(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
-FIND_PACKAGE(SortLib CONFIG)
-IF (NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
-  message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
-endif()
-unset(SortLib_VERSION)
+foreach(CMAKE_FIND_PACKAGE_SORT_DIRECTION IN ITEMS "" ASC Bogus)
+  set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+  SET(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+  FIND_PACKAGE(SortLib CONFIG)
+  IF (NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
+    message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
+  endif()
+  unset(SortLib_VERSION)
+endforeach()
 
 
 set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
diff --git a/Tests/FindPackageCpsTest/CMakeLists.txt b/Tests/FindPackageCpsTest/CMakeLists.txt
index 561d401..8f076ae 100644
--- a/Tests/FindPackageCpsTest/CMakeLists.txt
+++ b/Tests/FindPackageCpsTest/CMakeLists.txt
@@ -80,14 +80,15 @@
 ###############################################################################
 # Test glob sorting.
 
-set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
-set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
-set(CMAKE_FIND_PACKAGE_SORT_DIRECTION ASC)
-find_package(SortLib CONFIG)
-if(NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
-  message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
-endif()
-unset(SortLib_VERSION)
+foreach(CMAKE_FIND_PACKAGE_SORT_DIRECTION IN ITEMS "" ASC Bogus)
+  set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
+  set(CMAKE_FIND_PACKAGE_SORT_ORDER NAME)
+  find_package(SortLib CONFIG)
+  if(NOT "${SortLib_VERSION}" STREQUAL "3.1.1")
+    message(SEND_ERROR "FIND_PACKAGE_SORT_ORDER Name Asc! ${SortLib_VERSION}")
+  endif()
+  unset(SortLib_VERSION)
+endforeach()
 
 set(SortLib_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
 set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
diff --git a/Tests/RunCMake/Instrumentation/check-data-dir.cmake b/Tests/RunCMake/Instrumentation/check-data-dir.cmake
index a20d2cd..e21eb66 100644
--- a/Tests/RunCMake/Instrumentation/check-data-dir.cmake
+++ b/Tests/RunCMake/Instrumentation/check-data-dir.cmake
@@ -111,7 +111,7 @@
   # Verify command args were passed
   if (filename MATCHES "^cmakeBuild|^ctest")
     string(JSON command GET "${contents}" command)
-    if (NOT command MATCHES "-.* Debug")
+    if (NOT command MATCHES "Debug")
       snippet_error(${snippet} "Command value missing passed arguments")
     endif()
   endif()
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake
index 807d991..9e88561 100644
--- a/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command-make-program.cmake
@@ -3,5 +3,5 @@
   API_VERSION 1
   DATA_VERSION 1
   HOOKS preBuild postBuild
-  CALLBACK "\"${CMAKE_COMMAND}\" -P \"${hook_path}\" 0"
+  CALLBACK ${CMAKE_COMMAND} -P ${hook_path} 0
 )
diff --git a/Tests/RunCMake/Instrumentation/query/cmake-command.cmake b/Tests/RunCMake/Instrumentation/query/cmake-command.cmake
index 3f66de5..72e9b41 100644
--- a/Tests/RunCMake/Instrumentation/query/cmake-command.cmake
+++ b/Tests/RunCMake/Instrumentation/query/cmake-command.cmake
@@ -8,7 +8,7 @@
     API_VERSION 1
     DATA_VERSION 1
     HOOKS postGenerate
-    CALLBACK \"${CMAKE_COMMAND}\" -E echo callback1
+    CALLBACK ${CMAKE_COMMAND} -E echo callback1
   )
   # Query 2
   cmake_instrumentation(
@@ -16,6 +16,6 @@
     DATA_VERSION 1
     HOOKS postCMakeBuild
     QUERIES staticSystemInformation dynamicSystemInformation
-    CALLBACK \"${CMAKE_COMMAND}\" -E echo callback2
-    CALLBACK \"${CMAKE_COMMAND}\" -E echo callback3
+    CALLBACK ${CMAKE_COMMAND} -E echo callback2
+    CALLBACK ${CMAKE_COMMAND} -E echo callback3
   )
diff --git a/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in b/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in
index 996a91b..e5e6c35 100644
--- a/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in
+++ b/Tests/RunCMake/Instrumentation/query/generated/query-1.json.in
@@ -1,7 +1,7 @@
 {
   "callbacks" :
   [
-    "\"@CMAKE_COMMAND@\" -E echo callback1"
+    "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback1\""
   ],
   "hooks" :
   [
diff --git a/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in b/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in
index 3591633..58db59f 100644
--- a/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in
+++ b/Tests/RunCMake/Instrumentation/query/generated/query-2.json.in
@@ -1,8 +1,8 @@
 {
   "callbacks" :
   [
-    "\"@CMAKE_COMMAND@\" -E echo callback2",
-    "\"@CMAKE_COMMAND@\" -E echo callback3"
+    "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback2\"",
+    "\"@CMAKE_COMMAND@\" \"-E\" \"echo\" \"callback3\""
   ],
   "hooks" :
   [
diff --git a/Utilities/Sphinx/conf.py.in b/Utilities/Sphinx/conf.py.in
index d6df5a1..e71f850 100644
--- a/Utilities/Sphinx/conf.py.in
+++ b/Utilities/Sphinx/conf.py.in
@@ -100,6 +100,7 @@
     r'https://cdash\.org': r'https://www\.cdash\.org/',
     r'https://cmake.org/get-involved/': r'https://cmake.org/documentation/',
     r'https://docs\.nvidia\.com/cuda/': r'https://docs\.nvidia\.com/cuda/index\.html',
+    r'https://learn\.microsoft\.com/en-us/cpp/build/reference/export-exports-a-function': r'https://learn\.microsoft\.com/en-us/cpp/build/reference/export-exports-a-function\?.*',
     r'https://learn\.microsoft\.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support': r'https://learn\.microsoft\.com/en-us/cpp/build/reference/openmp-enable-openmp-2-0-support\?.*',
     r'https://learn\.microsoft\.com/en-us/cpp/c-language/parsing-c-command-line-arguments': r'https://learn\.microsoft\.com/en-us/cpp/c-language/parsing-c-command-line-arguments\?.*',
     r'https://openjdk\.java\.net/jeps/313': r'https://openjdk\.org:443/jeps/313',
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
index 8773e56..69e31e9 100644
--- a/Utilities/cmlibuv/CMakeLists.txt
+++ b/Utilities/cmlibuv/CMakeLists.txt
@@ -219,7 +219,6 @@
 
 if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
   list(APPEND uv_libraries
-    kvm
     )
   list(APPEND uv_headers
     include/uv/bsd.h
@@ -236,7 +235,6 @@
 if(CMAKE_SYSTEM_NAME STREQUAL "kFreeBSD")
   list(APPEND uv_libraries
     freebsd-glue
-    kvm
     )
   list(APPEND uv_headers
     include/uv/bsd.h
@@ -268,7 +266,6 @@
 
 if(CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
   list(APPEND uv_libraries
-    kvm
     )
   list(APPEND uv_headers
     include/uv/bsd.h
diff --git a/bootstrap b/bootstrap
index a1ab850..644260b 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1783,10 +1783,12 @@
       libs="${libs} -ldl -lrt"
       ;;
     *kFreeBSD*)
-      libs="${libs} -lkvm -lfreebsd-glue"
+      libs="${libs} -lfreebsd-glue"
+      ;;
+    *NetBSD*)
+      libs="${libs} -lkvm"
       ;;
     *BSD*)
-      libs="${libs} -lkvm"
       ;;
     *SunOS*)
       uv_c_flags="${uv_c_flags} -D__EXTENSIONS__ -D_XOPEN_SOURCE=600"