Merge topic 'curl-hsts'

1bc0252850 curl: Enable HTTP Strict-Transport-Security (HSTS) for build in CMake

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8801
diff --git a/Help/release/dev/mingw-search-prefixes.rst b/Help/release/dev/mingw-search-prefixes.rst
new file mode 100644
index 0000000..1b5c3c7
--- /dev/null
+++ b/Help/release/dev/mingw-search-prefixes.rst
@@ -0,0 +1,6 @@
+mingw-search-prefixes
+---------------------
+
+* When using MinGW tools in a ``MSYSTEM`` environment on Windows,
+  the ``$MSYSTEM_PREFIX/local`` and ``$MSYSTEM_PREFIX`` prefixes are
+  now added to :variable:`CMAKE_SYSTEM_PREFIX_PATH`.
diff --git a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
index c8b5815..8dfcdc5 100644
--- a/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
+++ b/Help/variable/CMAKE_SYSTEM_PREFIX_PATH.rst
@@ -38,6 +38,12 @@
 Unix:
   * ``ENV{CONDA_PREFIX}`` when using a conda compiler
 
+MSYSTEM environment with MinGW toolchain:
+  .. versionadded:: 3.28
+
+  * ``ENV{MSYSTEM_PREFIX}/local``
+  * ``ENV{MSYSTEM_PREFIX}``
+
 Windows:
   * ``ENV{ProgramW6432}``
   * ``ENV{ProgramFiles}``
diff --git a/Modules/Findosg.cmake b/Modules/Findosg.cmake
index c9daece..9e952c9 100644
--- a/Modules/Findosg.cmake
+++ b/Modules/Findosg.cmake
@@ -7,9 +7,10 @@
 
 
 
-NOTE: It is highly recommended that you use the new
-FindOpenSceneGraph.cmake introduced in CMake 2.6.3 and not use this
-Find module directly.
+.. note::
+  It is highly recommended that you use the new
+  :module:`FindOpenSceneGraph` introduced in CMake 2.6.3 and not use this
+  Find module directly.
 
 This is part of the ``Findosg*`` suite used to find OpenSceneGraph
 components.  Each component is separate and you must opt in to each
@@ -22,17 +23,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osg This module defines
+Locate osg This module defines:
 
-OSG_FOUND - Was the Osg found? OSG_INCLUDE_DIR - Where to find the
-headers OSG_LIBRARIES - The libraries to link against for the OSG (use
-this)
+``OSG_FOUND``
+  Was the Osg found?
+``OSG_INCLUDE_DIR``
+  Where to find theheaders
+``OSG_LIBRARIES``
+  The libraries to link against for the OSG (use this)
+``OSG_LIBRARY``
+  The OSG library
+``OSG_LIBRARY_DEBUG``
+  The OSG debug library
 
-OSG_LIBRARY - The OSG library OSG_LIBRARY_DEBUG - The OSG debug
-library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgAnimation.cmake b/Modules/FindosgAnimation.cmake
index 9fa4281..e31987e 100644
--- a/Modules/FindosgAnimation.cmake
+++ b/Modules/FindosgAnimation.cmake
@@ -18,18 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgAnimation This module defines
+Locate osgAnimation This module defines:
 
-OSGANIMATION_FOUND - Was osgAnimation found? OSGANIMATION_INCLUDE_DIR
-- Where to find the headers OSGANIMATION_LIBRARIES - The libraries to
-link against for the OSG (use this)
+``OSGANIMATION_FOUND``
+  Was osgAnimation found?
+``OSGANIMATION_INCLUDE_DIR``
+  Where to find the headers
+``OSGANIMATION_LIBRARIES``
+  The libraries to link against for the OSG (use this)
+``OSGANIMATION_LIBRARY``
+  The OSG library
+``OSGANIMATION_LIBRARY_DEBUG``
+  The OSG debug library
 
-OSGANIMATION_LIBRARY - The OSG library OSGANIMATION_LIBRARY_DEBUG -
-The OSG debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
 
+used in building osg.
 Created by Eric Wing.
 #]=======================================================================]
 
diff --git a/Modules/FindosgDB.cmake b/Modules/FindosgDB.cmake
index a28f650..9366d21 100644
--- a/Modules/FindosgDB.cmake
+++ b/Modules/FindosgDB.cmake
@@ -37,7 +37,9 @@
 
 ``$OSGDIR`` is an environment variable that would correspond to::
 
-  ./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 #]=======================================================================]
 
diff --git a/Modules/FindosgFX.cmake b/Modules/FindosgFX.cmake
index d9e223a..79362ef 100644
--- a/Modules/FindosgFX.cmake
+++ b/Modules/FindosgFX.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgFX This module defines
+Locate osgFX This module defines:
 
-OSGFX_FOUND - Was osgFX found? OSGFX_INCLUDE_DIR - Where to find the
-headers OSGFX_LIBRARIES - The libraries to link against for the osgFX
-(use this)
+``OSGFX_FOUND``
+  Was osgFX found?
+``OSGFX_INCLUDE_DIR``
+  Where to find the headers
+``OSGFX_LIBRARIES``
+  The libraries to link against for the osgFX (use this)
+``OSGFX_LIBRARY``
+  The osgFX library
+``OSGFX_LIBRARY_DEBUG``
+  The osgFX debug library
 
-OSGFX_LIBRARY - The osgFX library OSGFX_LIBRARY_DEBUG - The osgFX
-debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgGA.cmake b/Modules/FindosgGA.cmake
index 8a7c7ec..7ebcce8 100644
--- a/Modules/FindosgGA.cmake
+++ b/Modules/FindosgGA.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgGA This module defines
+Locate osgGA This module defines:
 
-OSGGA_FOUND - Was osgGA found? OSGGA_INCLUDE_DIR - Where to find the
-headers OSGGA_LIBRARIES - The libraries to link against for the osgGA
-(use this)
+``OSGGA_FOUND``
+  Was osgGA found?
+``OSGGA_INCLUDE_DIR``
+  Where to find the headers
+``OSGGA_LIBRARIES``
+  The libraries to link against for the osgGA (use this)
+``OSGGA_LIBRARY``
+  The osgGA library
+``OSGGA_LIBRARY_DEBUG``
+  The osgGA debug library
 
-OSGGA_LIBRARY - The osgGA library OSGGA_LIBRARY_DEBUG - The osgGA
-debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgIntrospection.cmake b/Modules/FindosgIntrospection.cmake
index e41c64f..c0c28f2 100644
--- a/Modules/FindosgIntrospection.cmake
+++ b/Modules/FindosgIntrospection.cmake
@@ -18,18 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgINTROSPECTION This module defines
+Locate osgINTROSPECTION This module defines:
 
-OSGINTROSPECTION_FOUND - Was osgIntrospection found?
-OSGINTROSPECTION_INCLUDE_DIR - Where to find the headers
-OSGINTROSPECTION_LIBRARIES - The libraries to link for
-osgIntrospection (use this)
+``OSGINTROSPECTION_FOUND``
+  Was osgIntrospection found?
+``OSGINTROSPECTION_INCLUDE_DIR``
+  Where to find the headers
+``OSGINTROSPECTION_LIBRARIES``
+  The libraries to link for osgIntrospection (use this)
+``OSGINTROSPECTION_LIBRARY``
+  The osgIntrospection library
+``OSGINTROSPECTION_LIBRARY_DEBUG``
+  The osgIntrospection debug library
 
-OSGINTROSPECTION_LIBRARY - The osgIntrospection library
-OSGINTROSPECTION_LIBRARY_DEBUG - The osgIntrospection debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgManipulator.cmake b/Modules/FindosgManipulator.cmake
index 1c0058f..47c74f6 100644
--- a/Modules/FindosgManipulator.cmake
+++ b/Modules/FindosgManipulator.cmake
@@ -18,18 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgManipulator This module defines
+Locate osgManipulator This module defines:
 
-OSGMANIPULATOR_FOUND - Was osgManipulator found?
-OSGMANIPULATOR_INCLUDE_DIR - Where to find the headers
-OSGMANIPULATOR_LIBRARIES - The libraries to link for osgManipulator
-(use this)
+``OSGMANIPULATOR_FOUND``
+  Was osgManipulator found?
+``OSGMANIPULATOR_INCLUDE_DIR``
+  Where to find the headers
+``OSGMANIPULATOR_LIBRARIES``
+  The libraries to link for osgManipulator (use this)
+``OSGMANIPULATOR_LIBRARY``
+  The osgManipulator library
+``OSGMANIPULATOR_LIBRARY_DEBUG``
+  The osgManipulator debug library
 
-OSGMANIPULATOR_LIBRARY - The osgManipulator library
-OSGMANIPULATOR_LIBRARY_DEBUG - The osgManipulator debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgParticle.cmake b/Modules/FindosgParticle.cmake
index 74ef254..cbe033d 100644
--- a/Modules/FindosgParticle.cmake
+++ b/Modules/FindosgParticle.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgParticle This module defines
+Locate osgParticle This module defines:
 
-OSGPARTICLE_FOUND - Was osgParticle found? OSGPARTICLE_INCLUDE_DIR -
-Where to find the headers OSGPARTICLE_LIBRARIES - The libraries to
-link for osgParticle (use this)
+``OSGPARTICLE_FOUND``
+  Was osgParticle found?
+``OSGPARTICLE_INCLUDE_DIR``
+  Where to find the headers
+``OSGPARTICLE_LIBRARIES``
+  The libraries to link for osgParticle (use this)
+``OSGPARTICLE_LIBRARY``
+  The osgParticle library
+``OSGPARTICLE_LIBRARY_DEBUG``
+  The osgParticle debug library
 
-OSGPARTICLE_LIBRARY - The osgParticle library
-OSGPARTICLE_LIBRARY_DEBUG - The osgParticle debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgPresentation.cmake b/Modules/FindosgPresentation.cmake
index 82d86cd..e8c8b4f 100644
--- a/Modules/FindosgPresentation.cmake
+++ b/Modules/FindosgPresentation.cmake
@@ -18,19 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgPresentation This module defines
+Locate osgPresentation This module defines:
 
-OSGPRESENTATION_FOUND - Was osgPresentation found?
-OSGPRESENTATION_INCLUDE_DIR - Where to find the headers
-OSGPRESENTATION_LIBRARIES - The libraries to link for osgPresentation
-(use this)
+``OSGPRESENTATION_FOUND``
+  Was osgPresentation found?
+``OSGPRESENTATION_INCLUDE_DIR``
+  Where to find the headers
+``OSGPRESENTATION_LIBRARIES``
+  The libraries to link for osgPresentation (use this)
+``OSGPRESENTATION_LIBRARY``
+  The osgPresentation library
+``OSGPRESENTATION_LIBRARY_DEBUG``
+  The osgPresentation debug library
 
-OSGPRESENTATION_LIBRARY - The osgPresentation library
-OSGPRESENTATION_LIBRARY_DEBUG - The osgPresentation debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
 
+used in building osg.
 Created by Eric Wing.  Modified to work with osgPresentation by Robert
 Osfield, January 2012.
 #]=======================================================================]
diff --git a/Modules/FindosgProducer.cmake b/Modules/FindosgProducer.cmake
index 43ccd78..92f0d20 100644
--- a/Modules/FindosgProducer.cmake
+++ b/Modules/FindosgProducer.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgProducer This module defines
+Locate osgProducer This module defines:
 
-OSGPRODUCER_FOUND - Was osgProducer found? OSGPRODUCER_INCLUDE_DIR -
-Where to find the headers OSGPRODUCER_LIBRARIES - The libraries to
-link for osgProducer (use this)
+``OSGPRODUCER_FOUND``
+  Was osgProducer found?
+``OSGPRODUCER_INCLUDE_DIR``
+  Where to find the headers
+``OSGPRODUCER_LIBRARIES``
+  The libraries to link for osgProducer (use this)
+``OSGPRODUCER_LIBRARY``
+  The osgProducer library
+``OSGPRODUCER_LIBRARY_DEBUG``
+  The osgProducer debug library
 
-OSGPRODUCER_LIBRARY - The osgProducer library
-OSGPRODUCER_LIBRARY_DEBUG - The osgProducer debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgQt.cmake b/Modules/FindosgQt.cmake
index e89add0..2ad7174 100644
--- a/Modules/FindosgQt.cmake
+++ b/Modules/FindosgQt.cmake
@@ -18,16 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgQt This module defines
+Locate osgQt This module defines:
 
-OSGQT_FOUND - Was osgQt found? OSGQT_INCLUDE_DIR - Where to find the
-headers OSGQT_LIBRARIES - The libraries to link for osgQt (use this)
+``OSGQT_FOUND``
+  Was osgQt found?
+``OSGQT_INCLUDE_DIR``
+  Where to find the headers
+``OSGQT_LIBRARIES``
+  The libraries to link for osgQt (use this)
+``OSGQT_LIBRARY``
+  The osgQt library
+``OSGQT_LIBRARY_DEBUG``
+  The osgQt debug library
 
-OSGQT_LIBRARY - The osgQt library OSGQT_LIBRARY_DEBUG - The osgQt
-debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.  Modified to work with osgQt by Robert Osfield,
 January 2012.
diff --git a/Modules/FindosgShadow.cmake b/Modules/FindosgShadow.cmake
index 90f477b..12eb9da 100644
--- a/Modules/FindosgShadow.cmake
+++ b/Modules/FindosgShadow.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgShadow This module defines
+Locate osgShadow This module defines:
 
-OSGSHADOW_FOUND - Was osgShadow found? OSGSHADOW_INCLUDE_DIR - Where
-to find the headers OSGSHADOW_LIBRARIES - The libraries to link for
-osgShadow (use this)
+``OSGSHADOW_FOUND``
+  Was osgShadow found?
+``OSGSHADOW_INCLUDE_DIR``
+  Where to find the headers
+``OSGSHADOW_LIBRARIES``
+  The libraries to link for osgShadow (use this)
+``OSGSHADOW_LIBRARY``
+  The osgShadow library
+``OSGSHADOW_LIBRARY_DEBUG``
+  The osgShadow debug library
 
-OSGSHADOW_LIBRARY - The osgShadow library OSGSHADOW_LIBRARY_DEBUG -
-The osgShadow debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgSim.cmake b/Modules/FindosgSim.cmake
index 66e461b..37ef03c 100644
--- a/Modules/FindosgSim.cmake
+++ b/Modules/FindosgSim.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgSim This module defines
+Locate osgSim This module defines:
 
-OSGSIM_FOUND - Was osgSim found? OSGSIM_INCLUDE_DIR - Where to find
-the headers OSGSIM_LIBRARIES - The libraries to link for osgSim (use
-this)
+``OSGSIM_FOUND``
+  Was osgSim found?
+``OSGSIM_INCLUDE_DIR``
+  Where to find the headers
+``OSGSIM_LIBRARIES``
+  The libraries to link for osgSim (use this)
+``OSGSIM_LIBRARY``
+  The osgSim library
+``OSGSIM_LIBRARY_DEBUG``
+  The osgSim debug library
 
-OSGSIM_LIBRARY - The osgSim library OSGSIM_LIBRARY_DEBUG - The osgSim
-debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgTerrain.cmake b/Modules/FindosgTerrain.cmake
index 07bdeb7..a2de4ea 100644
--- a/Modules/FindosgTerrain.cmake
+++ b/Modules/FindosgTerrain.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgTerrain This module defines
+Locate osgTerrain This module defines:
 
-OSGTERRAIN_FOUND - Was osgTerrain found? OSGTERRAIN_INCLUDE_DIR -
-Where to find the headers OSGTERRAIN_LIBRARIES - The libraries to link
-for osgTerrain (use this)
+``OSGTERRAIN_FOUND``
+  Was osgTerrain found?
+``OSGTERRAIN_INCLUDE_DIR``
+  Where to find the headers
+``OSGTERRAIN_LIBRARIES``
+  The libraries to link for osgTerrain (use this)
+``OSGTERRAIN_LIBRARY``
+  The osgTerrain library
+``OSGTERRAIN_LIBRARY_DEBUG``
+  The osgTerrain debug library
 
-OSGTERRAIN_LIBRARY - The osgTerrain library OSGTERRAIN_LIBRARY_DEBUG -
-The osgTerrain debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgText.cmake b/Modules/FindosgText.cmake
index 793709a..7646ad0 100644
--- a/Modules/FindosgText.cmake
+++ b/Modules/FindosgText.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgText This module defines
+Locate osgText This module defines:
 
-OSGTEXT_FOUND - Was osgText found? OSGTEXT_INCLUDE_DIR - Where to find
-the headers OSGTEXT_LIBRARIES - The libraries to link for osgText (use
-this)
+``OSGTEXT_FOUND``
+  Was osgText found?
+``OSGTEXT_INCLUDE_DIR``
+  Where to find the headers
+``OSGTEXT_LIBRARIES``
+  The libraries to link for osgText (use this)
+``OSGTEXT_LIBRARY``
+  The osgText library
+``OSGTEXT_LIBRARY_DEBUG``
+  The osgText debug library
 
-OSGTEXT_LIBRARY - The osgText library OSGTEXT_LIBRARY_DEBUG - The
-osgText debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgUtil.cmake b/Modules/FindosgUtil.cmake
index c0f633b..a34fea0 100644
--- a/Modules/FindosgUtil.cmake
+++ b/Modules/FindosgUtil.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgUtil This module defines
+Locate osgUtil This module defines:
 
-OSGUTIL_FOUND - Was osgUtil found? OSGUTIL_INCLUDE_DIR - Where to find
-the headers OSGUTIL_LIBRARIES - The libraries to link for osgUtil (use
-this)
+``OSGUTIL_FOUND``
+  Was osgUtil found?
+``OSGUTIL_INCLUDE_DIR``
+  Where to find the headers
+``OSGUTIL_LIBRARIES``
+  The libraries to link for osgUtil (use this)
+``OSGUTIL_LIBRARY``
+  The osgUtil library
+``OSGUTIL_LIBRARY_DEBUG``
+  The osgUtil debug library
 
-OSGUTIL_LIBRARY - The osgUtil library OSGUTIL_LIBRARY_DEBUG - The
-osgUtil debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgViewer.cmake b/Modules/FindosgViewer.cmake
index 824edbf..c3834e8 100644
--- a/Modules/FindosgViewer.cmake
+++ b/Modules/FindosgViewer.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgViewer This module defines
+Locate osgViewer This module defines:
 
-OSGVIEWER_FOUND - Was osgViewer found? OSGVIEWER_INCLUDE_DIR - Where
-to find the headers OSGVIEWER_LIBRARIES - The libraries to link for
-osgViewer (use this)
+``OSGVIEWER_FOUND``
+  Was osgViewer found?
+``OSGVIEWER_INCLUDE_DIR``
+  Where to find the headers
+``OSGVIEWER_LIBRARIES``
+  The libraries to link for osgViewer (use this)
+``OSGVIEWER_LIBRARY``
+  The osgViewer library
+``OSGVIEWER_LIBRARY_DEBUG``
+  The osgViewer debug library
 
-OSGVIEWER_LIBRARY - The osgViewer library OSGVIEWER_LIBRARY_DEBUG -
-The osgViewer debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgVolume.cmake b/Modules/FindosgVolume.cmake
index 8f3ef37..58d9f7a 100644
--- a/Modules/FindosgVolume.cmake
+++ b/Modules/FindosgVolume.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgVolume This module defines
+Locate osgVolume This module defines:
 
-OSGVOLUME_FOUND - Was osgVolume found? OSGVOLUME_INCLUDE_DIR - Where
-to find the headers OSGVOLUME_LIBRARIES - The libraries to link for
-osgVolume (use this)
+``OSGVOLUME_FOUND``
+  Was osgVolume found?
+``OSGVOLUME_INCLUDE_DIR``
+  Where to find the headers
+``OSGVOLUME_LIBRARIES``
+  The libraries to link for osgVolume (use this)
+``OSGVOLUME_LIBRARY``
+  The osgVolume library
+``OSGVOLUME_LIBRARY_DEBUG``
+  The osgVolume debug library
 
-OSGVOLUME_LIBRARY - The osgVolume library OSGVOLUME_LIBRARY_DEBUG -
-The osgVolume debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 Created by Eric Wing.
 #]=======================================================================]
diff --git a/Modules/FindosgWidget.cmake b/Modules/FindosgWidget.cmake
index eabf079..4049fad 100644
--- a/Modules/FindosgWidget.cmake
+++ b/Modules/FindosgWidget.cmake
@@ -18,17 +18,24 @@
 convenient module that includes everything, use the
 :module:`FindOpenSceneGraph` instead of the ``Findosg*.cmake`` modules.
 
-Locate osgWidget This module defines
+Locate osgWidget This module defines:
 
-OSGWIDGET_FOUND - Was osgWidget found? OSGWIDGET_INCLUDE_DIR - Where
-to find the headers OSGWIDGET_LIBRARIES - The libraries to link for
-osgWidget (use this)
+``OSGWIDGET_FOUND``
+  Was osgWidget found?
+``OSGWIDGET_INCLUDE_DIR``
+  Where to find the headers
+``OSGWIDGET_LIBRARIES``
+  The libraries to link for osgWidget (use this)
+``OSGWIDGET_LIBRARY``
+  The osgWidget library
+``OSGWIDGET_LIBRARY_DEBUG``
+  The osgWidget debug library
 
-OSGWIDGET_LIBRARY - The osgWidget library OSGWIDGET_LIBRARY_DEBUG -
-The osgWidget debug library
+``$OSGDIR`` is an environment variable that would correspond to::
 
-$OSGDIR is an environment variable that would correspond to the
-./configure --prefix=$OSGDIR used in building osg.
+  ./configure --prefix=$OSGDIR
+
+used in building osg.
 
 FindosgWidget.cmake tweaked from Findosg* suite as created by Eric
 Wing.
diff --git a/Modules/Findosg_functions.cmake b/Modules/Findosg_functions.cmake
index 563b6bd..5226102 100644
--- a/Modules/Findosg_functions.cmake
+++ b/Modules/Findosg_functions.cmake
@@ -10,7 +10,7 @@
 
 
 This CMake file contains two macros to assist with searching for OSG
-libraries and nodekits.  Please see FindOpenSceneGraph.cmake for full
+libraries and nodekits.  Please see :module:`FindOpenSceneGraph` for full
 documentation.
 #]=======================================================================]
 
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 088b238..412af6b 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -10,6 +10,25 @@
 
 set(MINGW 1)
 
+# On Windows hosts, in MSYSTEM environments, search standard prefixes.
+if(CMAKE_HOST_WIN32)
+  # Bootstrap CMake does not have cmake_host_system_information.
+  if(COMMAND cmake_host_system_information)
+    cmake_host_system_information(RESULT _MSYSTEM_PREFIX QUERY MSYSTEM_PREFIX)
+  elseif(IS_DIRECTORY "$ENV{MSYSTEM_PREFIX}")
+    set(_MSYSTEM_PREFIX "$ENV{MSYSTEM_PREFIX}")
+  endif()
+
+  # Search this MSYSTEM environment's equivalent to /usr/local and /usr.
+  if(_MSYSTEM_PREFIX)
+    list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${_MSYSTEM_PREFIX}")
+    if(IS_DIRECTORY "${_MSYSTEM_PREFIX}/local")
+      list(PREPEND CMAKE_SYSTEM_PREFIX_PATH "${_MSYSTEM_PREFIX}/local")
+    endif()
+  endif()
+  unset(_MSYSTEM_PREFIX)
+endif()
+
 set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
 set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
 set(CMAKE_SHARED_MODULE_PREFIX  "lib")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 10af687..395d321 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,7 +1,7 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 27)
-set(CMake_VERSION_PATCH 20230913)
+set(CMake_VERSION_PATCH 20230914)
 #set(CMake_VERSION_RC 0)
 set(CMake_VERSION_IS_DIRTY 0)
 
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index 1919b01..782d6c8 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -23,6 +23,7 @@
   SELECT(F, EvaluatingSystemIncludeDirectories, SYSTEM_INCLUDE_DIRECTORIES)   \
   SELECT(F, EvaluatingCompileDefinitions, COMPILE_DEFINITIONS)                \
   SELECT(F, EvaluatingCompileOptions, COMPILE_OPTIONS)                        \
+  SELECT(F, EvaluatingAutoMocMacroNames, AUTOMOC_MACRO_NAMES)                 \
   SELECT(F, EvaluatingAutoUicOptions, AUTOUIC_OPTIONS)                        \
   SELECT(F, EvaluatingSources, SOURCES)                                       \
   SELECT(F, EvaluatingCompileFeatures, COMPILE_FEATURES)                      \
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 09f8495..6187543 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -49,6 +49,8 @@
 #include "cmValue.h"
 #include "cmake.h"
 
+class cmCustomCommand;
+
 std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New(
   cmGeneratorTarget* target)
 {
@@ -972,16 +974,15 @@
     << cmState::GetTargetTypeName(this->GetGeneratorTarget()->GetType())
     << " target " << this->GetTargetName() << "\n\n";
 
+  std::vector<cmCustomCommand const*> customCommands;
   {
-    std::vector<cmSourceFile const*> customCommands;
-    this->GeneratorTarget->GetCustomCommands(customCommands, config);
-    for (cmSourceFile const* sf : customCommands) {
+    std::vector<cmSourceFile const*> customCommandSources;
+    this->GeneratorTarget->GetCustomCommands(customCommandSources, config);
+    for (cmSourceFile const* sf : customCommandSources) {
       cmCustomCommand const* cc = sf->GetCustomCommand();
       this->GetLocalGenerator()->AddCustomCommandTarget(
         cc, this->GetGeneratorTarget());
-      // Record the custom commands for this target. The container is used
-      // in WriteObjectBuildStatement when called in a loop below.
-      this->Configs[config].CustomCommands.push_back(cc);
+      customCommands.push_back(cc);
     }
   }
   {
@@ -1028,7 +1029,7 @@
     cm::append(orderOnlyDeps, this->Configs[config].ExtraFiles);
 
     // Add order-only dependencies on custom command outputs.
-    for (cmCustomCommand const* cc : this->Configs[config].CustomCommands) {
+    for (cmCustomCommand const* cc : customCommands) {
       cmCustomCommandGenerator ccg(*cc, config, this->GetLocalGenerator());
       const std::vector<std::string>& ccoutputs = ccg.GetOutputs();
       const std::vector<std::string>& ccbyproducts = ccg.GetByproducts();
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index 49e7018..d41d86e 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -19,7 +19,6 @@
 #include "cmNinjaTypes.h"
 #include "cmOSXBundleGenerator.h"
 
-class cmCustomCommand;
 class cmGeneratedFileStream;
 class cmGeneratorTarget;
 class cmLocalNinjaGenerator;
@@ -251,7 +250,6 @@
     mutable ImportedCxxModuleLookup ImportedCxxModules;
     // Swift Support
     Json::Value SwiftOutputMap;
-    std::vector<cmCustomCommand const*> CustomCommands;
     cmNinjaDeps ExtraFiles;
     std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
   };
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index c9f65f6..b1d90ee 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -1177,17 +1177,22 @@
   this->Makefile->AddCMakeOutputFile(this->AutogenTarget.InfoFile);
 
   // Determine whether to use a depfile for the AUTOGEN target.
-  const bool useNinjaDepfile = this->QtVersion >= IntegerVersion(5, 15) &&
-    this->GlobalGen->GetName().find("Ninja") != std::string::npos;
+  bool const useDepfile = [this]() -> bool {
+    auto const& gen = this->GlobalGen->GetName();
+    return this->QtVersion >= IntegerVersion(5, 15) &&
+      (gen.find("Ninja") != std::string::npos ||
+       gen.find("Make") != std::string::npos);
+  }();
 
   // Files provided by the autogen target
   std::vector<std::string> autogenByproducts;
   std::vector<std::string> timestampByproducts;
   if (this->Moc.Enabled) {
     this->AddGeneratedSource(this->Moc.CompilationFile, this->Moc, true);
-    if (useNinjaDepfile) {
+    if (useDepfile) {
       if (this->MultiConfig &&
-          !this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty()) {
+          !this->Makefile->GetSafeDefinition("CMAKE_CROSS_CONFIGS").empty() &&
+          this->GlobalGen->GetName().find("Ninja") != std::string::npos) {
         // Make all mocs_compilation_<CONFIG>.cpp files byproducts of the
         // ${target}_autogen/timestamp custom command.
         // We cannot just use Moc.CompilationFileGenex here, because that
@@ -1365,7 +1370,7 @@
       this->AutogenTarget.DependFiles.begin(),
       this->AutogenTarget.DependFiles.end());
 
-    if (useNinjaDepfile) {
+    if (useDepfile) {
       // Create a custom command that generates a timestamp file and
       // has a depfile assigned. The depfile is created by JobDepFilesMergeT.
       //
@@ -1472,7 +1477,7 @@
         autogenTarget->AddUtility(depName.Value.first, false, this->Makefile);
       }
     }
-    if (!useNinjaDepfile) {
+    if (!useDepfile) {
       // Add additional autogen target dependencies to autogen target
       for (cmTarget const* depTarget : this->AutogenTarget.DependTargets) {
         autogenTarget->AddUtility(depTarget->GetName(), false, this->Makefile);
diff --git a/Tests/RunCMake/Autogen/MyWindow.cpp b/Tests/RunCMake/Autogen/MyWindow.cpp
new file mode 100644
index 0000000..d87c2e9
--- /dev/null
+++ b/Tests/RunCMake/Autogen/MyWindow.cpp
@@ -0,0 +1,7 @@
+#include "MyWindow.h"
+
+MyWindow::MyWindow(QWidget* parent)
+  : QWidget(parent)
+{
+  this->m_ui.setupUi(this);
+}
diff --git a/Tests/RunCMake/Autogen/MyWindow.h b/Tests/RunCMake/Autogen/MyWindow.h
new file mode 100644
index 0000000..c267610
--- /dev/null
+++ b/Tests/RunCMake/Autogen/MyWindow.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <QWidget>
+
+#include "ui_MyWindow.h"
+
+class MyWindow : public QWidget
+{
+  Q_OBJECT
+
+public:
+  explicit MyWindow(QWidget* parent = nullptr);
+
+private:
+  Ui::MyWindow m_ui;
+};
diff --git a/Tests/RunCMake/Autogen/MyWindow.ui b/Tests/RunCMake/Autogen/MyWindow.ui
new file mode 100644
index 0000000..fbf294c
--- /dev/null
+++ b/Tests/RunCMake/Autogen/MyWindow.ui
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>MyWindow</class>
+ <widget class="QWidget" name="MyWindow"/>
+</ui>
diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt b/Tests/RunCMake/Autogen/QtAutoMocDeps-stderr.txt
similarity index 100%
rename from Tests/RunCMake/Ninja/QtAutoMocDeps-stderr.txt
rename to Tests/RunCMake/Autogen/QtAutoMocDeps-stderr.txt
diff --git a/Tests/RunCMake/Ninja/QtAutoMocDeps.cmake b/Tests/RunCMake/Autogen/QtAutoMocDeps.cmake
similarity index 63%
rename from Tests/RunCMake/Ninja/QtAutoMocDeps.cmake
rename to Tests/RunCMake/Autogen/QtAutoMocDeps.cmake
index c441169..fc3b2f2 100644
--- a/Tests/RunCMake/Ninja/QtAutoMocDeps.cmake
+++ b/Tests/RunCMake/Autogen/QtAutoMocDeps.cmake
@@ -1,27 +1,23 @@
 enable_language(CXX)
 
-set(QtX Qt${with_qt_version})
-
-find_package(${QtX} REQUIRED COMPONENTS Core)
+find_package(Qt${with_qt_version} REQUIRED COMPONENTS Core Widgets Gui)
 
 set(CMAKE_AUTOMOC ON)
 
 add_library(simple_lib SHARED simple_lib.cpp)
 add_executable(app_with_qt app.cpp app_qt.cpp)
-target_link_libraries(app_with_qt PRIVATE simple_lib ${QtX}::Core)
+target_link_libraries(app_with_qt PRIVATE simple_lib Qt${with_qt_version}::Core)
 
-if(${QtX}Widgets_DIR)
-  find_package(${QtX} REQUIRED COMPONENTS Widgets)
+if(${with_qt_version}Widgets_DIR)
   if(with_qt_version STREQUAL 5)
     qt5_wrap_ui(_headers MyWindow.ui)
   else()
     qt_wrap_ui(_headers MyWindow.ui)
   endif()
   add_executable(app_with_widget app.cpp MyWindow.cpp ${_headers})
-  target_link_libraries(app_with_widget PRIVATE ${QtX}::Widgets)
+  target_link_libraries(app_with_widget PRIVATE Qt${with_qt_version}::Widgets)
   target_include_directories(app_with_widget PRIVATE "${CMAKE_BINARY_DIR}")
 endif()
-
 add_subdirectory(QtSubDir1)
 add_subdirectory(QtSubDir2)
 add_subdirectory(QtSubDir3)
diff --git a/Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt
new file mode 100644
index 0000000..f215b9e
--- /dev/null
+++ b/Tests/RunCMake/Autogen/QtSubDir1/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0116 OLD)
+
+add_executable(sub_exe_1 ../app.cpp)
+target_link_libraries(sub_exe_1 PRIVATE Qt${with_qt_version}::Core)
diff --git a/Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt
new file mode 100644
index 0000000..cccb1e0
--- /dev/null
+++ b/Tests/RunCMake/Autogen/QtSubDir2/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_policy(SET CMP0116 NEW)
+
+add_executable(sub_exe_2 ../app.cpp)
+target_link_libraries(sub_exe_2 PRIVATE Qt${with_qt_version}::Core)
diff --git a/Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt
new file mode 100644
index 0000000..d268bfe
--- /dev/null
+++ b/Tests/RunCMake/Autogen/QtSubDir3/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(sub_exe_3 ../app.cpp)
+target_link_libraries(sub_exe_3 PRIVATE Qt${with_qt_version}::Core)
diff --git a/Tests/RunCMake/Autogen/RunCMakeTest.cmake b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
index 4fe9406..886065a 100644
--- a/Tests/RunCMake/Autogen/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Autogen/RunCMakeTest.cmake
@@ -122,4 +122,55 @@
       endblock()
     endif()
   endif()
+
+  if(RunCMake_GENERATOR MATCHES "Make|Ninja")
+    block()
+      if(QtCore_VERSION VERSION_GREATER_EQUAL 5.15.0)
+        set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps-build)
+        run_cmake(QtAutoMocDeps)
+        set(RunCMake_TEST_NO_CLEAN 1)
+        # Build the project.
+        run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+        # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
+        # for app_with_qt target.
+        file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp")
+        set(RunCMake_TEST_NOT_EXPECT_stdout "Automatic MOC for target app_with_qt|\
+Automatic MOC for target sub_exe_1|\
+Automatic MOC for target sub_exe_2")
+        set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't execute AUTOMOC for 'app_with_qt', 'sub_exe_1' and 'sub_exe_2'")
+        # Build and assert that AUTOMOC was not run for app_with_qt, sub_exe_1 and sub_exe_2.
+        run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+        unset(RunCMake_TEST_VARIANT_DESCRIPTION)
+        unset(RunCMake_TEST_NOT_EXPECT_stdout)
+
+        macro(check_file_exists file)
+          if (EXISTS "${file}")
+            set(check_result "PASSED")
+            set(message_type "STATUS")
+          else()
+            set(check_result "FAILED")
+            set(message_type "FATAL_ERROR")
+          endif()
+
+          message(${message_type} "QtAutoMocDeps-build-\"${file}\" was generated - ${check_result}")
+        endmacro()
+
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/deps")
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/deps")
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/deps")
+
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/app_with_qt_autogen/timestamp")
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir1/sub_exe_1_autogen/timestamp")
+        check_file_exists("${RunCMake_TEST_BINARY_DIR}/QtSubDir2/sub_exe_2_autogen/timestamp")
+
+        # Touch a header file to make sure an automoc dependency cycle is not introduced.
+        file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h")
+        set(RunCMake_TEST_VARIANT_DESCRIPTION "-First build after touch to detect dependency cycle")
+        run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+        # Need to run a second time to hit the dependency cycle.
+        set(RunCMake_TEST_VARIANT_DESCRIPTION "-Don't hit dependency cycle")
+        run_cmake_command(QtAutoMocDeps-build ${CMAKE_COMMAND} --build . --verbose)
+      endif()
+    endblock()
+  endif()
 endif ()
diff --git a/Tests/RunCMake/Autogen/app.cpp b/Tests/RunCMake/Autogen/app.cpp
new file mode 100644
index 0000000..57380e4
--- /dev/null
+++ b/Tests/RunCMake/Autogen/app.cpp
@@ -0,0 +1,6 @@
+int main(int argc, char* argv[])
+{
+  (void)argc;
+  (void)argv;
+  return 0;
+}
diff --git a/Tests/RunCMake/Autogen/app_qt.cpp b/Tests/RunCMake/Autogen/app_qt.cpp
new file mode 100644
index 0000000..302c672
--- /dev/null
+++ b/Tests/RunCMake/Autogen/app_qt.cpp
@@ -0,0 +1,11 @@
+#include <QObject>
+
+class Mango : public QObject
+{
+  Q_OBJECT
+public:
+Q_SIGNALS:
+  void eatFruit();
+};
+
+#include "app_qt.moc"
diff --git a/Tests/RunCMake/Autogen/simple_lib.cpp b/Tests/RunCMake/Autogen/simple_lib.cpp
new file mode 100644
index 0000000..cf8d689
--- /dev/null
+++ b/Tests/RunCMake/Autogen/simple_lib.cpp
@@ -0,0 +1,6 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+  void dummy_symbol()
+{
+}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 02efb25..9b9a53e 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -274,6 +274,7 @@
   cmake_path(GET base_dir PARENT_PATH base_dir)  # <base>
   add_RunCMake_test(AutogenQt6 TEST_DIR Autogen
     -Dwith_qt_version=6
+    -DQtCore_VERSION=${Qt6Core_VERSION}
     "-DQt6_DIR:PATH=${Qt6_DIR}"
     "-DCMAKE_PREFIX_PATH:STRING=${base_dir}"
     -DPSEUDO_TIDY=$<TARGET_FILE:pseudo_tidy>
@@ -286,6 +287,7 @@
 if(CMake_TEST_Qt5 AND Qt5Widgets_FOUND)
   add_RunCMake_test(AutogenQt5 TEST_DIR Autogen
     -Dwith_qt_version=5
+    -DQtCore_VERSION=${Qt5Core_VERSION}
     "-DQt5_DIR:PATH=${Qt5_DIR}"
   )
   set(want_NoQt_test FALSE)
@@ -518,10 +520,10 @@
 endforeach()
 add_RunCMake_test(file-DOWNLOAD)
 add_RunCMake_test(file-RPATH -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
-add_RunCMake_test(find_file)
-add_RunCMake_test(find_library -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
-add_RunCMake_test(find_package -DMSYS=${MSYS})
-add_RunCMake_test(find_path)
+add_RunCMake_test(find_file -DMINGW=${MINGW})
+add_RunCMake_test(find_library -DMINGW=${MINGW} -DCYGWIN=${CYGWIN} -DMSYS=${MSYS})
+add_RunCMake_test(find_package -DMINGW=${MINGW} -DMSYS=${MSYS})
+add_RunCMake_test(find_path -DMINGW=${MINGW})
 add_RunCMake_test(find_program -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
 add_RunCMake_test(foreach)
 add_RunCMake_test(function)
diff --git a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
deleted file mode 100644
index 3a12dcd..0000000
--- a/Tests/RunCMake/Ninja/QtSubDir1/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_policy(SET CMP0116 OLD)
-
-add_executable(sub_exe_1 ../app.cpp)
-target_link_libraries(sub_exe_1 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
deleted file mode 100644
index a2f77e4..0000000
--- a/Tests/RunCMake/Ninja/QtSubDir2/CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-cmake_policy(SET CMP0116 NEW)
-
-add_executable(sub_exe_2 ../app.cpp)
-target_link_libraries(sub_exe_2 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt b/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
deleted file mode 100644
index 70644fa..0000000
--- a/Tests/RunCMake/Ninja/QtSubDir3/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable(sub_exe_3 ../app.cpp)
-target_link_libraries(sub_exe_3 PRIVATE ${QtX}::Core)
diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
index 6eb0b1d..6cc6234 100644
--- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake
+++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake
@@ -380,45 +380,6 @@
 endfunction()
 run_ChangeBuildType()
 
-function(run_QtAutoMocDeps)
-  set(QtX Qt${CMake_TEST_Qt_version})
-  if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0)
-    set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/QtAutoMocDeps-build)
-    run_cmake_with_options(QtAutoMocDeps
-      "-Dwith_qt_version=${CMake_TEST_Qt_version}"
-      "-D${QtX}_DIR=${${QtX}_DIR}"
-      "-D${QtX}Core_DIR=${${QtX}Core_DIR}"
-      "-D${QtX}Widgets_DIR=${${QtX}Widgets_DIR}"
-      "-DCMAKE_PREFIX_PATH:STRING=${CMAKE_PREFIX_PATH}"
-    )
-    # Build the project.
-    run_ninja("${RunCMake_TEST_BINARY_DIR}")
-    # Touch just the library source file, which shouldn't cause a rerun of AUTOMOC
-    # for app_with_qt target.
-    file(TOUCH "${RunCMake_SOURCE_DIR}/simple_lib.cpp")
-    # Build and assert that AUTOMOC was not run for app_with_qt.
-    run_ninja("${RunCMake_TEST_BINARY_DIR}")
-    if(ninja_stdout MATCHES "Automatic MOC for target app_with_qt")
-      message(FATAL_ERROR
-        "AUTOMOC should not have executed for 'app_with_qt' target:\nstdout:\n${ninja_stdout}")
-    endif()
-    # Assert that the subdir executables were not rebuilt.
-    if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_1")
-      message(FATAL_ERROR
-        "AUTOMOC should not have executed for 'sub_exe_1' target:\nstdout:\n${ninja_stdout}")
-    endif()
-    if(ninja_stdout MATCHES "Automatic MOC for target sub_exe_2")
-      message(FATAL_ERROR
-        "AUTOMOC should not have executed for 'sub_exe_2' target:\nstdout:\n${ninja_stdout}")
-    endif()
-    # Touch a header file to make sure an automoc dependency cycle is not introduced.
-    file(TOUCH "${RunCMake_SOURCE_DIR}/MyWindow.h")
-    run_ninja("${RunCMake_TEST_BINARY_DIR}")
-    # Need to run a second time to hit the dependency cycle.
-    run_ninja("${RunCMake_TEST_BINARY_DIR}")
-  endif()
-endfunction()
-
 function(run_QtAutoMocSkipPch)
   set(QtX Qt${CMake_TEST_Qt_version})
   if(CMake_TEST_${QtX}Core_Version VERSION_GREATER_EQUAL 5.15.0)
@@ -433,7 +394,7 @@
     run_ninja("${RunCMake_TEST_BINARY_DIR}")
   endif()
 endfunction()
+
 if(CMake_TEST_Qt_version)
-  run_QtAutoMocDeps()
   run_QtAutoMocSkipPch()
 endif()
diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake
index 3e5ddc5..baeb9ca 100644
--- a/Tests/RunCMake/RunCMake.cmake
+++ b/Tests/RunCMake/RunCMake.cmake
@@ -53,6 +53,11 @@
       unset(expect_${o})
     endif()
   endforeach()
+  foreach(o IN ITEMS stdout stderr config)
+    if(DEFINED RunCMake_TEST_NOT_EXPECT_${o})
+      string(REGEX REPLACE "\n+$" "" not_expect_${o} "${RunCMake_TEST_NOT_EXPECT_${o}}")
+    endif()
+  endforeach()
   if (NOT expect_stderr)
     if (NOT RunCMake_DEFAULT_stderr)
       set(RunCMake_DEFAULT_stderr "^$")
@@ -228,6 +233,11 @@
         string(APPEND msg "${o} does not match that expected.\n")
       endif()
     endif()
+    if(DEFINED not_expect_${o})
+      if("${actual_${o}}" MATCHES "${not_expect_${o}}")
+        string(APPEND msg "${o} matches that not expected.\n")
+      endif()
+    endif()
   endforeach()
   unset(RunCMake_TEST_FAILED)
   if(RunCMake-check-file AND EXISTS ${top_src}/${RunCMake-check-file})
diff --git a/Tests/RunCMake/find_file/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/find_file/MSYSTEM_PREFIX-stdout.txt
new file mode 100644
index 0000000..ab9b9d5
--- /dev/null
+++ b/Tests/RunCMake/find_file/MSYSTEM_PREFIX-stdout.txt
@@ -0,0 +1 @@
+-- MSYSTEM_PREFIX_H='[^']*/Tests/RunCMake/find_file/MSYSTEM_PREFIX/include/msystem_prefix.h'
diff --git a/Tests/RunCMake/find_file/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/find_file/MSYSTEM_PREFIX.cmake
new file mode 100644
index 0000000..08e4127
--- /dev/null
+++ b/Tests/RunCMake/find_file/MSYSTEM_PREFIX.cmake
@@ -0,0 +1,5 @@
+set(ENV{MSYSTEM} "FAKEMSYS")
+set(ENV{MSYSTEM_PREFIX} "${CMAKE_CURRENT_LIST_DIR}/MSYSTEM_PREFIX")
+enable_language(C)
+find_file(MSYSTEM_PREFIX_H NAMES msystem_prefix.h)
+message(STATUS "MSYSTEM_PREFIX_H='${MSYSTEM_PREFIX_H}'")
diff --git a/Tests/RunCMake/find_file/MSYSTEM_PREFIX/include/msystem_prefix.h b/Tests/RunCMake/find_file/MSYSTEM_PREFIX/include/msystem_prefix.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_file/MSYSTEM_PREFIX/include/msystem_prefix.h
diff --git a/Tests/RunCMake/find_file/RunCMakeTest.cmake b/Tests/RunCMake/find_file/RunCMakeTest.cmake
index 296bb71..2d59e38 100644
--- a/Tests/RunCMake/find_file/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_file/RunCMakeTest.cmake
@@ -12,6 +12,10 @@
 run_cmake(VALIDATOR-specify-macro)
 run_cmake(VALIDATOR)
 
+if(CMAKE_HOST_WIN32 AND MINGW)
+  run_cmake(MSYSTEM_PREFIX)
+endif()
+
 run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=PrefixInPATH_File)
 
 if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
diff --git a/Tests/RunCMake/find_library/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/find_library/MSYSTEM_PREFIX-stdout.txt
new file mode 100644
index 0000000..b19bcce
--- /dev/null
+++ b/Tests/RunCMake/find_library/MSYSTEM_PREFIX-stdout.txt
@@ -0,0 +1 @@
+-- MSYSTEM_PREFIX_LIB='[^']*/Tests/RunCMake/find_library/MSYSTEM_PREFIX/lib/libmsystem_prefix.a'
diff --git a/Tests/RunCMake/find_library/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/find_library/MSYSTEM_PREFIX.cmake
new file mode 100644
index 0000000..ef4ce2f
--- /dev/null
+++ b/Tests/RunCMake/find_library/MSYSTEM_PREFIX.cmake
@@ -0,0 +1,5 @@
+set(ENV{MSYSTEM} "FAKEMSYS")
+set(ENV{MSYSTEM_PREFIX} "${CMAKE_CURRENT_LIST_DIR}/MSYSTEM_PREFIX")
+enable_language(C)
+find_library(MSYSTEM_PREFIX_LIB NAMES msystem_prefix)
+message(STATUS "MSYSTEM_PREFIX_LIB='${MSYSTEM_PREFIX_LIB}'")
diff --git a/Tests/RunCMake/find_library/MSYSTEM_PREFIX/lib/libmsystem_prefix.a b/Tests/RunCMake/find_library/MSYSTEM_PREFIX/lib/libmsystem_prefix.a
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_library/MSYSTEM_PREFIX/lib/libmsystem_prefix.a
diff --git a/Tests/RunCMake/find_library/RunCMakeTest.cmake b/Tests/RunCMake/find_library/RunCMakeTest.cmake
index 8b223b4..0bed252 100644
--- a/Tests/RunCMake/find_library/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_library/RunCMakeTest.cmake
@@ -20,6 +20,10 @@
 run_cmake(VALIDATOR-specify-macro)
 run_cmake(VALIDATOR)
 
+if(CMAKE_HOST_WIN32 AND MINGW)
+  run_cmake(MSYSTEM_PREFIX)
+endif()
+
 run_cmake_script(FromScriptMode "-DTEMP_DIR=${RunCMake_BINARY_DIR}/FromScriptMode-temp")
 
 run_cmake_with_options(FromPATHEnvDebugVar --debug-find-var=CREATED_LIBRARY)
diff --git a/Tests/RunCMake/find_package/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/find_package/MSYSTEM_PREFIX-stdout.txt
new file mode 100644
index 0000000..b1c8346
--- /dev/null
+++ b/Tests/RunCMake/find_package/MSYSTEM_PREFIX-stdout.txt
@@ -0,0 +1 @@
+-- MsysPfx_DIR='[^']*/Tests/RunCMake/find_package/MSYSTEM_PREFIX'
diff --git a/Tests/RunCMake/find_package/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/find_package/MSYSTEM_PREFIX.cmake
new file mode 100644
index 0000000..2826e53
--- /dev/null
+++ b/Tests/RunCMake/find_package/MSYSTEM_PREFIX.cmake
@@ -0,0 +1,5 @@
+set(ENV{MSYSTEM} "FAKEMSYS")
+set(ENV{MSYSTEM_PREFIX} "${CMAKE_CURRENT_LIST_DIR}/MSYSTEM_PREFIX")
+enable_language(C)
+find_package(MsysPfx QUIET)
+message(STATUS "MsysPfx_DIR='${MsysPfx_DIR}'")
diff --git a/Tests/RunCMake/find_package/MSYSTEM_PREFIX/MsysPfxConfig.cmake b/Tests/RunCMake/find_package/MSYSTEM_PREFIX/MsysPfxConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/MSYSTEM_PREFIX/MsysPfxConfig.cmake
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 006757a..a93b811 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -72,6 +72,10 @@
 run_cmake(REGISTRY_VIEW-wrong-view)
 run_cmake(REGISTRY_VIEW-propagated)
 
+if(CMAKE_HOST_WIN32 AND MINGW)
+  run_cmake(MSYSTEM_PREFIX)
+endif()
+
 if(CMAKE_HOST_WIN32)
   run_cmake(CMP0144-WARN-CaseInsensitive)
   run_cmake(CMP0144-OLD-CaseInsensitive)
diff --git a/Tests/RunCMake/find_path/MSYSTEM_PREFIX-stdout.txt b/Tests/RunCMake/find_path/MSYSTEM_PREFIX-stdout.txt
new file mode 100644
index 0000000..87ee490
--- /dev/null
+++ b/Tests/RunCMake/find_path/MSYSTEM_PREFIX-stdout.txt
@@ -0,0 +1 @@
+-- MSYSTEM_PREFIX_INCLUDE_DIR='[^']*/Tests/RunCMake/find_path/MSYSTEM_PREFIX/include'
diff --git a/Tests/RunCMake/find_path/MSYSTEM_PREFIX.cmake b/Tests/RunCMake/find_path/MSYSTEM_PREFIX.cmake
new file mode 100644
index 0000000..d17a52f
--- /dev/null
+++ b/Tests/RunCMake/find_path/MSYSTEM_PREFIX.cmake
@@ -0,0 +1,5 @@
+set(ENV{MSYSTEM} "FAKEMSYS")
+set(ENV{MSYSTEM_PREFIX} "${CMAKE_CURRENT_LIST_DIR}/MSYSTEM_PREFIX")
+enable_language(C)
+find_path(MSYSTEM_PREFIX_INCLUDE_DIR NAMES msystem_prefix.h)
+message(STATUS "MSYSTEM_PREFIX_INCLUDE_DIR='${MSYSTEM_PREFIX_INCLUDE_DIR}'")
diff --git a/Tests/RunCMake/find_path/MSYSTEM_PREFIX/include/msystem_prefix.h b/Tests/RunCMake/find_path/MSYSTEM_PREFIX/include/msystem_prefix.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_path/MSYSTEM_PREFIX/include/msystem_prefix.h
diff --git a/Tests/RunCMake/find_path/RunCMakeTest.cmake b/Tests/RunCMake/find_path/RunCMakeTest.cmake
index 9c76f2e..2ed4d7d 100644
--- a/Tests/RunCMake/find_path/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_path/RunCMakeTest.cmake
@@ -12,6 +12,10 @@
 run_cmake(VALIDATOR-specify-macro)
 run_cmake(VALIDATOR)
 
+if(CMAKE_HOST_WIN32 AND MINGW)
+  run_cmake(MSYSTEM_PREFIX)
+endif()
+
 if(APPLE)
   run_cmake(FrameworksWithSubdirs)
 endif()