Merge branch 'android-fix-c++_shared' into release-3.9
diff --git a/Help/generator/Visual Studio 15 2017.rst b/Help/generator/Visual Studio 15 2017.rst
index a88f8bc..2ac0449 100644
--- a/Help/generator/Visual Studio 15 2017.rst
+++ b/Help/generator/Visual Studio 15 2017.rst
@@ -15,6 +15,18 @@
 ``Visual Studio 15 2017 ARM``
   Specify target platform ``ARM``.
 
+Instance Selection
+^^^^^^^^^^^^^^^^^^
+
+VS 2017 supports multiple installations on the same machine.
+CMake queries the Visual Studio Installer to locate VS instances.
+If more than one instance is installed we do not define which one
+is chosen by default.  If the ``VS150COMNTOOLS`` environment variable
+is set and points to the ``Common7/Tools`` directory within one of
+the instances, that instance will be used.  The environment variable
+must remain consistently set whenever CMake is re-run within a given
+build tree.
+
 Toolset Selection
 ^^^^^^^^^^^^^^^^^
 
diff --git a/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst b/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst
index dcd2a4e..a316abe 100644
--- a/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst
+++ b/Help/prop_dir/VS_GLOBAL_SECTION_POST_section.rst
@@ -26,4 +26,6 @@
 property, it will override the default section.  For example, setting
 VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default
 contents of the ExtensibilityGlobals section, while keeping
-ExtensibilityAddIns on its default.
+ExtensibilityAddIns on its default.  However, CMake will always
+add a ``SolutionGuid`` to the ``ExtensibilityGlobals`` section
+if it is not specified explicitly.
diff --git a/Modules/FindDoxygen.cmake b/Modules/FindDoxygen.cmake
index 26d44b9..46bf340 100644
--- a/Modules/FindDoxygen.cmake
+++ b/Modules/FindDoxygen.cmake
@@ -179,7 +179,8 @@
     will be converted to an absolute path relative to the current binary
     directory. This is necessary because doxygen will normally be run from a
     directory within the source tree so that relative source paths work as
-    expected.
+    expected. If this directory does not exist, it will be recursively created
+    prior to executing the doxygen commands.
 
 To change any of these defaults or override any other Doxygen config option,
 set relevant variables before calling ``doxygen_add_docs()``. For example:
@@ -619,7 +620,7 @@
     # If doxygen was found, use it to generate a minimal default Doxyfile.
     # We will delete this file after we have finished using it below to
     # generate the other files that doxygen_add_docs() will use.
-    set(_Doxygen_tpl "${PROJECT_BINARY_DIR}/CMakeDoxyfile.tpl")
+    set(_Doxygen_tpl "${CMAKE_BINARY_DIR}/CMakeDoxyfile.tpl")
     execute_process(
         COMMAND "${DOXYGEN_EXECUTABLE}" -s -g "${_Doxygen_tpl}"
         OUTPUT_QUIET
@@ -646,8 +647,8 @@
     # content is only dependent on the version of Doxygen being used. Therefore
     # we always put them at the top of the build tree so that they are in a
     # predictable location.
-    set(_doxyfile_in       "${PROJECT_BINARY_DIR}/CMakeDoxyfile.in")
-    set(_doxyfile_defaults "${PROJECT_BINARY_DIR}/CMakeDoxygenDefaults.cmake")
+    set(_doxyfile_in       "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in")
+    set(_doxyfile_defaults "${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake")
 
     file(WRITE "${_doxyfile_in}"       ${_Doxygen_dne_header})
     file(WRITE "${_doxyfile_defaults}" ${_Doxygen_dne_header})
@@ -896,7 +897,7 @@
 
     # Now bring in Doxgen's defaults for those things the project has not
     # already set and we have not provided above
-    include("${PROJECT_BINARY_DIR}/CMakeDoxygenDefaults.cmake" OPTIONAL)
+    include("${CMAKE_BINARY_DIR}/CMakeDoxygenDefaults.cmake" OPTIONAL)
 
     # Cleanup built HTMLs on "make clean"
     # TODO Any other dirs?
@@ -1020,18 +1021,25 @@
         WARN_LOGFILE
         XML_OUTPUT
     )
+
+    # Store the unmodified value of DOXYGEN_OUTPUT_DIRECTORY prior to invoking
+    # doxygen_quote_value() below. This will mutate the string specifically for
+    # consumption by Doxygen's config file, which we do not want when we use it
+    # later in the custom target's commands.
+    set( _original_doxygen_output_dir ${DOXYGEN_OUTPUT_DIRECTORY} )
+
     foreach(_item IN LISTS _doxygen_quoted_options)
         doxygen_quote_value(DOXYGEN_${_item})
     endforeach()
 
     # Prepare doxygen configuration file
-    set(_doxyfile_template "${PROJECT_BINARY_DIR}/CMakeDoxyfile.in")
+    set(_doxyfile_template "${CMAKE_BINARY_DIR}/CMakeDoxyfile.in")
     set(_target_doxyfile "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.${targetName}")
     configure_file("${_doxyfile_template}" "${_target_doxyfile}")
 
     # Add the target
-    add_custom_target(
-        ${targetName}
+    add_custom_target( ${targetName} VERBATIM
+        COMMAND ${CMAKE_COMMAND} -E make_directory ${_original_doxygen_output_dir}
         COMMAND "${DOXYGEN_EXECUTABLE}" "${_target_doxyfile}"
         WORKING_DIRECTORY "${_args_WORKING_DIRECTORY}"
         DEPENDS "${_target_doxyfile}"
diff --git a/Source/bindexplib.cxx b/Source/bindexplib.cxx
index cd1fb8a..e96226a 100644
--- a/Source/bindexplib.cxx
+++ b/Source/bindexplib.cxx
@@ -242,24 +242,26 @@
 
           // Check whether it is "Scalar deleting destructor" and "Vector
           // deleting destructor"
-          // if scalarPrefix and vectorPrefix are not found then print the
-          // symbol
+          // if scalarPrefix and vectorPrefix are not found then print
+          // the symbol
           const char* scalarPrefix = "??_G";
           const char* vectorPrefix = "??_E";
+          // The original code had a check for
+          //     symbol.find("real@") == std::string::npos)
+          // but this disallows member functions with the name "real".
           if (symbol.compare(0, 4, scalarPrefix) &&
               symbol.compare(0, 4, vectorPrefix)) {
             SectChar = this->SectionHeaders[pSymbolTable->SectionNumber - 1]
                          .Characteristics;
-
             // skip symbols containing a dot
             if (symbol.find('.') == std::string::npos) {
-              if (SectChar & IMAGE_SCN_MEM_EXECUTE) {
-                this->Symbols.insert(symbol);
-              } else if (SectChar & IMAGE_SCN_MEM_READ) {
-                // skip __real@ and __xmm@
-                if (symbol.find("_real") == std::string::npos &&
-                    symbol.find("_xmm") == std::string::npos) {
-                  this->DataSymbols.insert(symbol);
+              if (!pSymbolTable->Type && (SectChar & IMAGE_SCN_MEM_WRITE)) {
+                // Read only (i.e. constants) must be excluded
+                this->DataSymbols.insert(symbol);
+              } else {
+                if (pSymbolTable->Type || !(SectChar & IMAGE_SCN_MEM_READ) ||
+                    (SectChar & IMAGE_SCN_MEM_EXECUTE)) {
+                  this->Symbols.insert(symbol);
                 }
               }
             }
diff --git a/Source/cmFindBase.cxx b/Source/cmFindBase.cxx
index 581c401..e378208 100644
--- a/Source/cmFindBase.cxx
+++ b/Source/cmFindBase.cxx
@@ -216,6 +216,8 @@
     paths.AddCMakePrefixPath(varName);
     paths.AddEnvPrefixPath(varName);
   }
+
+  paths.AddSuffixes(this->SearchPathSuffixes);
 }
 
 void cmFindBase::FillCMakeVariablePath()
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 103e692..fd0e317 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -11,7 +11,7 @@
 
 cmFindCommon::PathGroup cmFindCommon::PathGroup::All("ALL");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::PackageRoot(
-  "PacakgeName_ROOT");
+  "PackageName_ROOT");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::CMake("CMAKE");
 cmFindCommon::PathLabel cmFindCommon::PathLabel::CMakeEnvironment(
   "CMAKE_ENVIRONMENT");
@@ -231,18 +231,6 @@
   }
 }
 
-void cmFindCommon::FilterPaths(const std::vector<std::string>& inPaths,
-                               const std::set<std::string>& ignore,
-                               std::vector<std::string>& outPaths)
-{
-  for (std::vector<std::string>::const_iterator i = inPaths.begin();
-       i != inPaths.end(); ++i) {
-    if (ignore.count(*i) == 0) {
-      outPaths.push_back(*i);
-    }
-  }
-}
-
 void cmFindCommon::GetIgnoredPaths(std::vector<std::string>& ignore)
 {
   // null-terminated list of paths.
diff --git a/Source/cmFindCommon.h b/Source/cmFindCommon.h
index 2eed47b..7954267 100644
--- a/Source/cmFindCommon.h
+++ b/Source/cmFindCommon.h
@@ -81,11 +81,6 @@
   void GetIgnoredPaths(std::vector<std::string>& ignore);
   void GetIgnoredPaths(std::set<std::string>& ignore);
 
-  /** Remove paths in the ignore set from the supplied vector.  */
-  void FilterPaths(const std::vector<std::string>& inPaths,
-                   const std::set<std::string>& ignore,
-                   std::vector<std::string>& outPaths);
-
   /** Compute final search path list (reroot + trailing slash).  */
   void ComputeFinalPaths();
 
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 65670e5..f291f9d 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -739,7 +739,8 @@
   if (result && !found) {
     // warn if package required or neither quiet nor in config mode
     if (this->Required ||
-        !(this->Quiet || (this->UseConfigFiles && !this->UseFindModules))) {
+        !(this->Quiet || (this->UseConfigFiles && !this->UseFindModules &&
+                          this->ConsideredConfigs.empty()))) {
       // The variable is not set.
       std::ostringstream e;
       std::ostringstream aw;
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 0e02b0a..e3835ff 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -130,6 +130,7 @@
   this->DefaultNasmFlagTable = cmVS10NASMFlagTable;
   this->DefaultRcFlagTable = cmVS10RCFlagTable;
   this->Version = VS10;
+  this->PlatformToolsetNeedsDebugEnum = false;
 }
 
 bool cmGlobalVisualStudio10Generator::MatchesGeneratorName(
@@ -195,6 +196,24 @@
     return false;
   }
 
+  if (cmHasLiteralPrefix(this->GetPlatformToolsetString(), "v140")) {
+    // The GenerateDebugInformation link setting for the v140 toolset
+    // in VS 2015 was originally an enum with "No" and "Debug" values,
+    // differing from the "false" and "true" values used in older toolsets.
+    // A VS 2015 update changed it back.  Parse the "link.xml" file to
+    // discover which one we need.
+    std::string const link_xml = this->VCTargetsPath + "/1033/link.xml";
+    cmsys::ifstream fin(link_xml.c_str());
+    std::string line;
+    while (fin && cmSystemTools::GetLineFromStream(fin, line)) {
+      if (line.find(" Switch=\"DEBUG\" ") != std::string::npos) {
+        this->PlatformToolsetNeedsDebugEnum =
+          line.find(" Name=\"Debug\" ") != std::string::npos;
+        break;
+      }
+    }
+  }
+
   if (this->GeneratorToolsetCuda.empty()) {
     // Find the highest available version of the CUDA tools.
     std::vector<std::string> cudaTools;
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index 20f992a..4a5c245 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -59,6 +59,13 @@
   const char* GetPlatformToolsetCuda() const;
   std::string const& GetPlatformToolsetCudaString() const;
 
+  /** Return whether we need to use No/Debug instead of false/true
+      for GenerateDebugInformation.  */
+  bool GetPlatformToolsetNeedsDebugEnum() const
+  {
+    return this->PlatformToolsetNeedsDebugEnum;
+  }
+
   /** Return the CMAKE_SYSTEM_NAME.  */
   std::string const& GetSystemName() const { return this->SystemName; }
 
@@ -169,6 +176,8 @@
   virtual std::string FindDevEnvCommand();
   virtual std::string GetVSMakeProgram() { return this->GetMSBuildCommand(); }
 
+  bool PlatformToolsetNeedsDebugEnum;
+
   bool ParseGeneratorToolset(std::string const& ts, cmMakefile* mf);
 
   std::string VCTargetsPath;
diff --git a/Source/cmGlobalVisualStudio14Generator.cxx b/Source/cmGlobalVisualStudio14Generator.cxx
index df086d3..c8cf02c 100644
--- a/Source/cmGlobalVisualStudio14Generator.cxx
+++ b/Source/cmGlobalVisualStudio14Generator.cxx
@@ -8,8 +8,8 @@
 #include "cmMakefile.h"
 #include "cmVS140CLFlagTable.h"
 #include "cmVS140CSharpFlagTable.h"
+#include "cmVS140LinkFlagTable.h"
 #include "cmVS14LibFlagTable.h"
-#include "cmVS14LinkFlagTable.h"
 #include "cmVS14MASMFlagTable.h"
 #include "cmVS14RCFlagTable.h"
 
@@ -93,7 +93,7 @@
   this->DefaultClFlagTable = cmVS140CLFlagTable;
   this->DefaultCSharpFlagTable = cmVS140CSharpFlagTable;
   this->DefaultLibFlagTable = cmVS14LibFlagTable;
-  this->DefaultLinkFlagTable = cmVS14LinkFlagTable;
+  this->DefaultLinkFlagTable = cmVS140LinkFlagTable;
   this->DefaultMasmFlagTable = cmVS14MASMFlagTable;
   this->DefaultRcFlagTable = cmVS14RCFlagTable;
   this->Version = VS14;
diff --git a/Source/cmGlobalVisualStudio15Generator.cxx b/Source/cmGlobalVisualStudio15Generator.cxx
index da2bf8c..ce1ba00 100644
--- a/Source/cmGlobalVisualStudio15Generator.cxx
+++ b/Source/cmGlobalVisualStudio15Generator.cxx
@@ -8,6 +8,7 @@
 #include "cmMakefile.h"
 #include "cmVS141CLFlagTable.h"
 #include "cmVS141CSharpFlagTable.h"
+#include "cmVS141LinkFlagTable.h"
 #include "cmVSSetupHelper.h"
 
 static const char vs15generatorName[] = "Visual Studio 15 2017";
@@ -85,6 +86,7 @@
   this->DefaultPlatformToolset = "v141";
   this->DefaultClFlagTable = cmVS141CLFlagTable;
   this->DefaultCSharpFlagTable = cmVS141CSharpFlagTable;
+  this->DefaultLinkFlagTable = cmVS141LinkFlagTable;
   this->Version = VS15;
 }
 
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index f067d8f..b155f5b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -520,6 +520,7 @@
 void cmGlobalVisualStudio7Generator::WriteSLNGlobalSections(
   std::ostream& fout, cmLocalGenerator* root)
 {
+  std::string const guid = this->GetGUID(root->GetProjectName() + ".sln");
   bool extensibilityGlobalsOverridden = false;
   bool extensibilityAddInsOverridden = false;
   const std::vector<std::string> propKeys =
@@ -538,11 +539,14 @@
       } else
         continue;
       if (!name.empty()) {
-        if (name == "ExtensibilityGlobals" && sectionType == "postSolution")
+        bool addGuid = false;
+        if (name == "ExtensibilityGlobals" && sectionType == "postSolution") {
+          addGuid = true;
           extensibilityGlobalsOverridden = true;
-        else if (name == "ExtensibilityAddIns" &&
-                 sectionType == "postSolution")
+        } else if (name == "ExtensibilityAddIns" &&
+                   sectionType == "postSolution") {
           extensibilityAddInsOverridden = true;
+        }
         fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
         std::vector<std::string> keyValuePairs;
         cmSystemTools::ExpandListArgument(
@@ -557,15 +561,23 @@
             const std::string value =
               cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1));
             fout << "\t\t" << key << " = " << value << "\n";
+            if (key == "SolutionGuid") {
+              addGuid = false;
+            }
           }
         }
+        if (addGuid) {
+          fout << "\t\tSolutionGuid = {" << guid << "}\n";
+        }
         fout << "\tEndGlobalSection\n";
       }
     }
   }
-  if (!extensibilityGlobalsOverridden)
+  if (!extensibilityGlobalsOverridden) {
     fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
+         << "\t\tSolutionGuid = {" << guid << "}\n"
          << "\tEndGlobalSection\n";
+  }
   if (!extensibilityAddInsOverridden)
     fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
          << "\tEndGlobalSection\n";
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 45c1764..9037961 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -147,7 +147,7 @@
   this->XcodeBuildCommandInitialized = false;
 
   this->ObjectDirArchDefault = "$(CURRENT_ARCH)";
-  this->ComputeObjectDirArch();
+  this->ObjectDirArch = this->ObjectDirArchDefault;
 
   cm->GetState()->SetIsGeneratorMultiConfig(true);
 }
@@ -3087,12 +3087,12 @@
     }
   }
 
-  this->ComputeObjectDirArch();
+  this->ComputeObjectDirArch(mf);
 }
 
-void cmGlobalXCodeGenerator::ComputeObjectDirArch()
+void cmGlobalXCodeGenerator::ComputeObjectDirArch(cmMakefile* mf)
 {
-  if (this->Architectures.size() > 1) {
+  if (this->Architectures.size() > 1 || this->UseEffectivePlatformName(mf)) {
     this->ObjectDirArch = "$(CURRENT_ARCH)";
   } else if (!this->Architectures.empty()) {
     this->ObjectDirArch = this->Architectures[0];
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index f38fa3c..e69793b 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -247,7 +247,7 @@
                                         const cmGeneratorTarget* t) const;
 
   void ComputeArchitectures(cmMakefile* mf);
-  void ComputeObjectDirArch();
+  void ComputeObjectDirArch(cmMakefile* mf);
 
   void addObject(cmXCodeObject* obj);
   std::string PostBuildMakeTarget(std::string const& tName,
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 6924ba2..cecf165 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -303,6 +303,13 @@
         !(fileType == cmSystemTools::HEADER_FILE_FORMAT)) {
       continue;
     }
+    if (PropertyEnabled(sf, "GENERATED") &&
+        !target->GetPropertyAsBool("__UNDOCUMENTED_AUTOGEN_GENERATED_FILES")) {
+      // FIXME: Add a policy whose NEW behavior allows generated files.
+      // The implementation already works.  We disable it here to avoid
+      // changing behavior for existing projects that do not expect it.
+      continue;
+    }
     const std::string absFile =
       cmsys::SystemTools::GetRealPath(sf->GetFullPath());
     // Skip flags
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 27e4928..042d111 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -971,17 +971,19 @@
         const std::string headerToMoc =
           this->MocFindHeader(scannedFileAbsPath, incSubDir + incRealBasename);
         if (!headerToMoc.empty()) {
-          // Register moc job
-          mocsIncluded[headerToMoc] = incString;
-          this->MocFindDepends(headerToMoc, contentText, mocDepends);
-          // Store meta information for relaxed mode
-          if (relaxed && (incRealBasename == scannedFileBasename)) {
-            ownMocUnderscoreInclude = incString;
-            ownMocUnderscoreHeader = headerToMoc;
+          if (!this->MocSkip(headerToMoc)) {
+            // Register moc job
+            mocsIncluded[headerToMoc] = incString;
+            this->MocFindDepends(headerToMoc, contentText, mocDepends);
+            // Store meta information for relaxed mode
+            if (relaxed && (incRealBasename == scannedFileBasename)) {
+              ownMocUnderscoreInclude = incString;
+              ownMocUnderscoreHeader = headerToMoc;
+            }
           }
         } else {
           std::ostringstream ost;
-          ost << "AutoMoc: Error: " << absFilename << "\n"
+          ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n"
               << "The file includes the moc file " << Quoted(incString)
               << ", but could not find header "
               << Quoted(incRealBasename + "{" +
@@ -1004,35 +1006,38 @@
             const std::string headerToMoc =
               this->MocFindHeader(scannedFileAbsPath, incSubDir + incBasename);
             if (!headerToMoc.empty()) {
-              // This is for KDE4 compatibility:
-              fileToMoc = headerToMoc;
-              if (!requiresMoc && (incBasename == scannedFileBasename)) {
-                std::ostringstream ost;
-                ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n"
+              if (!this->MocSkip(headerToMoc)) {
+                // This is for KDE4 compatibility:
+                fileToMoc = headerToMoc;
+                if (!requiresMoc && (incBasename == scannedFileBasename)) {
+                  std::ostringstream ost;
+                  ost
+                    << "AutoMoc: Warning: " << Quoted(absFilename) << "\n"
                     << "The file includes the moc file " << Quoted(incString)
                     << ", but does not contain a Q_OBJECT or Q_GADGET macro.\n"
                     << "Running moc on " << Quoted(headerToMoc) << "!\n"
                     << "Include " << Quoted("moc_" + incBasename + ".cpp")
                     << " for a compatibility with strict mode (see "
                        "CMAKE_AUTOMOC_RELAXED_MODE).\n";
-                this->LogWarning(ost.str());
-              } else {
-                std::ostringstream ost;
-                ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n"
-                    << "The file includes the moc file " << Quoted(incString)
-                    << " instead of " << Quoted("moc_" + incBasename + ".cpp")
-                    << ".\n"
-                    << "Running moc on " << Quoted(headerToMoc) << "!\n"
-                    << "Include " << Quoted("moc_" + incBasename + ".cpp")
-                    << " for compatibility with strict mode (see "
-                       "CMAKE_AUTOMOC_RELAXED_MODE).\n";
-                this->LogWarning(ost.str());
+                  this->LogWarning(ost.str());
+                } else {
+                  std::ostringstream ost;
+                  ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n"
+                      << "The file includes the moc file " << Quoted(incString)
+                      << " instead of "
+                      << Quoted("moc_" + incBasename + ".cpp") << ".\n"
+                      << "Running moc on " << Quoted(headerToMoc) << "!\n"
+                      << "Include " << Quoted("moc_" + incBasename + ".cpp")
+                      << " for compatibility with strict mode (see "
+                         "CMAKE_AUTOMOC_RELAXED_MODE).\n";
+                  this->LogWarning(ost.str());
+                }
               }
             } else {
               std::ostringstream ost;
               ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n"
                   << "The file includes the moc file " << Quoted(incString)
-                  << ". which seems to be the moc file from a different "
+                  << ", which seems to be the moc file from a different "
                      "source file. CMake also could not find a matching "
                      "header.";
               this->LogError(ost.str());
@@ -1048,7 +1053,7 @@
             // Accept but issue a warning if moc isn't required
             if (!requiresMoc) {
               std::ostringstream ost;
-              ost << "AutoMoc: Error: " << Quoted(absFilename) << "\n"
+              ost << "AutoMoc: Warning: " << Quoted(absFilename) << "\n"
                   << "The file includes the moc file " << Quoted(incString)
                   << ", but does not contain a Q_OBJECT or Q_GADGET "
                      "macro.";
@@ -1160,7 +1165,6 @@
       if (!this->UicSkip(absFilename) && !this->UicSkip(headerName)) {
         uicHeaderFiles.insert(headerName);
       }
-      break;
     }
   }
 }
diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS140LinkFlagTable.h
similarity index 97%
rename from Source/cmVS14LinkFlagTable.h
rename to Source/cmVS140LinkFlagTable.h
index 596f880..b9a4dc3 100644
--- a/Source/cmVS14LinkFlagTable.h
+++ b/Source/cmVS140LinkFlagTable.h
@@ -1,4 +1,4 @@
-static cmVS7FlagTable cmVS14LinkFlagTable[] = {
+static cmVS7FlagTable cmVS140LinkFlagTable[] = {
 
   // Enum Properties
   { "ShowProgress", "", "Not Set", "NotSet", 0 },
@@ -38,7 +38,12 @@
   { "GenerateDebugInformation", "DEBUG:FASTLINK",
     "Optimize for faster linking", "DebugFastLink",
     cmVS7FlagTable::CaseInsensitive },
-  { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "Debug",
+  { "GenerateDebugInformation", "DEBUG:FULL", "Optimize for debugging", "true",
+    cmVS7FlagTable::CaseInsensitive },
+  { "GenerateDebugInformation", "DEBUG:NONE",
+    "Produces no debugging information", "false",
+    cmVS7FlagTable::CaseInsensitive },
+  { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "true",
     cmVS7FlagTable::CaseInsensitive },
 
   { "SubSystem", "", "Not Set", "NotSet", 0 },
@@ -129,9 +134,6 @@
   { "CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", "System Dlls Only",
     "SystemDlls", 0 },
 
-  { "LinkControlFlowGuard", "guard:cf", "Enable Security Check with Guard",
-    "Guard", 0 },
-
   // Bool Properties
   { "LinkIncremental", "INCREMENTAL:NO", "", "false", 0 },
   { "LinkIncremental", "INCREMENTAL", "", "true", 0 },
diff --git a/Source/cmVS14LinkFlagTable.h b/Source/cmVS141LinkFlagTable.h
similarity index 96%
copy from Source/cmVS14LinkFlagTable.h
copy to Source/cmVS141LinkFlagTable.h
index 596f880..8f0f1f4 100644
--- a/Source/cmVS14LinkFlagTable.h
+++ b/Source/cmVS141LinkFlagTable.h
@@ -1,4 +1,4 @@
-static cmVS7FlagTable cmVS14LinkFlagTable[] = {
+static cmVS7FlagTable cmVS141LinkFlagTable[] = {
 
   // Enum Properties
   { "ShowProgress", "", "Not Set", "NotSet", 0 },
@@ -36,9 +36,15 @@
     "requireAdministrator", "RequireAdministrator", 0 },
 
   { "GenerateDebugInformation", "DEBUG:FASTLINK",
-    "Optimize for faster linking", "DebugFastLink",
+    "Generate Debug Information optimized for faster links", "DebugFastLink",
     cmVS7FlagTable::CaseInsensitive },
-  { "GenerateDebugInformation", "DEBUG", "Optimize for debugging", "Debug",
+  { "GenerateDebugInformation", "DEBUG:FULL",
+    "Generate Debug Information optimized for sharing and publishing",
+    "DebugFull", cmVS7FlagTable::CaseInsensitive },
+  { "GenerateDebugInformation", "DEBUG:NONE",
+    "Produces no debugging information", "false",
+    cmVS7FlagTable::CaseInsensitive },
+  { "GenerateDebugInformation", "DEBUG", "Generate Debug Information", "true",
     cmVS7FlagTable::CaseInsensitive },
 
   { "SubSystem", "", "Not Set", "NotSet", 0 },
@@ -129,9 +135,6 @@
   { "CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", "System Dlls Only",
     "SystemDlls", 0 },
 
-  { "LinkControlFlowGuard", "guard:cf", "Enable Security Check with Guard",
-    "Guard", 0 },
-
   // Bool Properties
   { "LinkIncremental", "INCREMENTAL:NO", "", "false", 0 },
   { "LinkIncremental", "INCREMENTAL", "", "true", 0 },
diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx
index c2ff664..7168f26 100644
--- a/Source/cmVSSetupHelper.cxx
+++ b/Source/cmVSSetupHelper.cxx
@@ -1,6 +1,7 @@
 /* Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
    file Copyright.txt or https://cmake.org/licensing for details.  */
 #include "cmVSSetupHelper.h"
+#include "cmSystemTools.h"
 
 #ifndef VSSetupConstants
 #define VSSetupConstants
@@ -240,6 +241,22 @@
       setupHelper == NULL)
     return false;
 
+  std::string envVSCommonToolsDir;
+
+  // FIXME: When we support VS versions beyond 2017, the version
+  // to choose will be passed in by the caller.  We need to map that
+  // to a per-version name of this environment variable.
+  if (cmSystemTools::GetEnv("VS150COMNTOOLS", envVSCommonToolsDir)) {
+    cmSystemTools::ConvertToUnixSlashes(envVSCommonToolsDir);
+  }
+  // FIXME: If the environment variable value changes between runs
+  // of CMake within a given build tree the results are not defined.
+  // Instead we should save a CMAKE_GENERATOR_INSTANCE value in the cache
+  // (similar to CMAKE_GENERATOR_TOOLSET) to hold it persistently.
+  // Unfortunately doing so will require refactoring elsewhere in
+  // order to make sure the value is available in time to create
+  // the generator.
+
   std::vector<VSInstanceInfo> vecVSInstances;
   SmartCOMPtr<IEnumSetupInstances> enumInstances = NULL;
   if (FAILED(
@@ -263,6 +280,17 @@
     instance = instance2 = NULL;
 
     if (isInstalled) {
+      if (!envVSCommonToolsDir.empty()) {
+        std::string currentVSLocation(instanceInfo.VSInstallLocation.begin(),
+                                      instanceInfo.VSInstallLocation.end());
+        cmSystemTools::ConvertToUnixSlashes(currentVSLocation);
+        currentVSLocation += "/Common7/Tools";
+        if (cmSystemTools::ComparePath(currentVSLocation,
+                                       envVSCommonToolsDir)) {
+          chosenInstanceInfo = instanceInfo;
+          return true;
+        }
+      }
       vecVSInstances.push_back(instanceInfo);
     }
   }
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index de1f5b0..88fa19c 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -17,8 +17,6 @@
 
 #include "cm_auto_ptr.hxx"
 
-static std::string const kWINDOWS_7_1_SDK = "Windows7.1SDK";
-
 static std::string cmVS10EscapeXML(std::string arg)
 {
   cmSystemTools::ReplaceString(arg, "&", "&amp;");
@@ -3130,12 +3128,7 @@
       linkOptions.AddFlag("StackReserveSize", stackVal);
     }
 
-    if (this->LocalGenerator->GetVersion() >=
-        cmGlobalVisualStudioGenerator::VS14) {
-      linkOptions.AddFlag("GenerateDebugInformation", "No");
-    } else {
-      linkOptions.AddFlag("GenerateDebugInformation", "false");
-    }
+    linkOptions.AddFlag("GenerateDebugInformation", "false");
 
     std::string pdb = this->GeneratorTarget->GetPDBDirectory(config.c_str());
     pdb += "/";
@@ -3182,26 +3175,14 @@
                            "%(IgnoreSpecificDefaultLibraries)");
   }
 
-  // Hack to fix flag version selection in a common use case.
-  // FIXME: Select flag table based on toolset instead of VS version.
-  if (this->LocalGenerator->GetVersion() >=
-      cmGlobalVisualStudioGenerator::VS14) {
-    const char* toolset = gg->GetPlatformToolset();
-    if (toolset &&
-        (toolset == kWINDOWS_7_1_SDK || /* clang-format please break here */
-         cmHasLiteralPrefix(toolset, "v80") ||
-         cmHasLiteralPrefix(toolset, "v90") ||
-         cmHasLiteralPrefix(toolset, "v100") ||
-         cmHasLiteralPrefix(toolset, "v110") ||
-         cmHasLiteralPrefix(toolset, "v120"))) {
-      if (const char* debug =
-            linkOptions.GetFlag("GenerateDebugInformation")) {
-        // Convert value from enumeration back to boolean for older toolsets.
-        if (strcmp(debug, "No") == 0) {
-          linkOptions.AddFlag("GenerateDebugInformation", "false");
-        } else if (strcmp(debug, "Debug") == 0) {
-          linkOptions.AddFlag("GenerateDebugInformation", "true");
-        }
+  // VS 2015 without all updates has a v140 toolset whose
+  // GenerateDebugInformation expects No/Debug instead of false/true.
+  if (gg->GetPlatformToolsetNeedsDebugEnum()) {
+    if (const char* debug = linkOptions.GetFlag("GenerateDebugInformation")) {
+      if (strcmp(debug, "false") == 0) {
+        linkOptions.AddFlag("GenerateDebugInformation", "No");
+      } else if (strcmp(debug, "true") == 0) {
+        linkOptions.AddFlag("GenerateDebugInformation", "Debug");
       }
     }
   }
diff --git a/Source/cmVisualStudio10ToolsetOptions.cxx b/Source/cmVisualStudio10ToolsetOptions.cxx
index afca216..9a1d950 100644
--- a/Source/cmVisualStudio10ToolsetOptions.cxx
+++ b/Source/cmVisualStudio10ToolsetOptions.cxx
@@ -26,10 +26,11 @@
 #include "cmVS12RCFlagTable.h"
 #include "cmVS140CLFlagTable.h"
 #include "cmVS140CSharpFlagTable.h"
+#include "cmVS140LinkFlagTable.h"
 #include "cmVS141CLFlagTable.h"
 #include "cmVS141CSharpFlagTable.h"
+#include "cmVS141LinkFlagTable.h"
 #include "cmVS14LibFlagTable.h"
-#include "cmVS14LinkFlagTable.h"
 #include "cmVS14MASMFlagTable.h"
 #include "cmVS14RCFlagTable.h"
 
@@ -114,8 +115,10 @@
 {
   std::string const useToolset = this->GetToolsetName(name, toolset);
 
-  if ((useToolset == "v140") || (useToolset == "v141")) {
-    return cmVS14LinkFlagTable;
+  if (useToolset == "v141") {
+    return cmVS141LinkFlagTable;
+  } else if (useToolset == "v140") {
+    return cmVS140LinkFlagTable;
   } else if (useToolset == "v120") {
     return cmVS12LinkFlagTable;
   } else if (useToolset == "v110") {
diff --git a/Tests/QtAutogen/mocDepends/CMakeLists.txt b/Tests/QtAutogen/mocDepends/CMakeLists.txt
index 8bd72eb..a67dcfe 100644
--- a/Tests/QtAutogen/mocDepends/CMakeLists.txt
+++ b/Tests/QtAutogen/mocDepends/CMakeLists.txt
@@ -28,6 +28,7 @@
 )
 target_link_libraries(mocDepends1 ${QT_CORE_TARGET})
 set_target_properties(mocDepends1 PROPERTIES AUTOMOC TRUE)
+set_property(TARGET mocDepends1 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
 
 # -- Test 2 using generated library
 # This tests the dependency of AUTOMOC of mocDepends2 to the
@@ -43,3 +44,4 @@
 add_executable(mocDepends2 test2.cpp )
 target_link_libraries(mocDepends2 SimpleLib ${QT_CORE_TARGET})
 set_target_properties(mocDepends2 PROPERTIES AUTOMOC TRUE)
+set_property(TARGET mocDepends2 PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
diff --git a/Tests/QtAutogen/mocRerun/CMakeLists.txt b/Tests/QtAutogen/mocRerun/CMakeLists.txt
index 69ea8d7..14b077b 100644
--- a/Tests/QtAutogen/mocRerun/CMakeLists.txt
+++ b/Tests/QtAutogen/mocRerun/CMakeLists.txt
@@ -27,6 +27,7 @@
   ${CMAKE_CURRENT_BINARY_DIR}/main.cpp
   res1.qrc
   )
+set_property(TARGET mocRerun PROPERTY __UNDOCUMENTED_AUTOGEN_GENERATED_FILES 1)
 target_include_directories(mocRerun PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
 target_link_libraries(mocRerun ${QT_CORE_TARGET})
 # Write target name to text file
diff --git a/Tests/RunCMake/AutoExportDll/foo.c b/Tests/RunCMake/AutoExportDll/foo.c
index e70fbb5..4b1318b 100644
--- a/Tests/RunCMake/AutoExportDll/foo.c
+++ b/Tests/RunCMake/AutoExportDll/foo.c
@@ -13,5 +13,3 @@
 {
   return 5;
 }
-
-const char testconst[] = "testconst";
diff --git a/Tests/RunCMake/AutoExportDll/say.cxx b/Tests/RunCMake/AutoExportDll/say.cxx
index eb9c0ff..51060e8 100644
--- a/Tests/RunCMake/AutoExportDll/say.cxx
+++ b/Tests/RunCMake/AutoExportDll/say.cxx
@@ -13,14 +13,6 @@
 int bar();
 int objlib();
 void justnop();
-
-// test const export
-#ifdef _WIN32
-// data symbols must be explicitly imported
-__declspec(dllimport) extern const char testconst[];
-#else
-extern const char testconst[];
-#endif
 }
 
 // test c++ functions
@@ -51,8 +43,6 @@
   bar();
   objlib();
   printf("\n");
-  printf("%s", testconst);
-  printf("\n");
 #ifdef HAS_JUSTNOP
   justnop();
 #endif
diff --git a/Tests/RunCMake/VSSolution/MorePost-check.cmake b/Tests/RunCMake/VSSolution/MorePost-check.cmake
index 0f7e370..d239b28 100644
--- a/Tests/RunCMake/VSSolution/MorePost-check.cmake
+++ b/Tests/RunCMake/VSSolution/MorePost-check.cmake
@@ -1,5 +1,5 @@
 parseGlobalSections(pre post MorePost)
 testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces")
 testGlobalSection(post TestSec4 Key6=Value1 "Key7=Value with spaces" Key8=ValueWithoutSpaces)
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/MorePre-check.cmake b/Tests/RunCMake/VSSolution/MorePre-check.cmake
index 45e7419..89b3c7e 100644
--- a/Tests/RunCMake/VSSolution/MorePre-check.cmake
+++ b/Tests/RunCMake/VSSolution/MorePre-check.cmake
@@ -1,5 +1,5 @@
 parseGlobalSections(pre post MorePre)
 testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces")
 testGlobalSection(pre TestSec3 Key3=Value1 "Key4=Value with spaces" Key5=ValueWithoutSpaces)
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/OnePost-check.cmake b/Tests/RunCMake/VSSolution/OnePost-check.cmake
index 6af5156..f7d3712 100644
--- a/Tests/RunCMake/VSSolution/OnePost-check.cmake
+++ b/Tests/RunCMake/VSSolution/OnePost-check.cmake
@@ -1,4 +1,4 @@
 parseGlobalSections(pre post OnePost)
 testGlobalSection(post TestSec2 Key1=Value1 "Key2=Value with spaces")
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/OnePre-check.cmake b/Tests/RunCMake/VSSolution/OnePre-check.cmake
index 70b18b2..c5db139 100644
--- a/Tests/RunCMake/VSSolution/OnePre-check.cmake
+++ b/Tests/RunCMake/VSSolution/OnePre-check.cmake
@@ -1,4 +1,4 @@
 parseGlobalSections(pre post OnePre)
 testGlobalSection(pre TestSec1 Key1=Value1 "Key2=Value with spaces")
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/Override1-check.cmake b/Tests/RunCMake/VSSolution/Override1-check.cmake
index a19e2e1..5905204 100644
--- a/Tests/RunCMake/VSSolution/Override1-check.cmake
+++ b/Tests/RunCMake/VSSolution/Override1-check.cmake
@@ -1,4 +1,4 @@
 parseGlobalSections(pre post Override1)
 testGlobalSection(post TestSec Key2=Value2 Key3=Value3)
-testGlobalSection(post ExtensibilityGlobals Key1=Value1)
+testGlobalSection(post ExtensibilityGlobals Key1=Value1 "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/Override2-check.cmake b/Tests/RunCMake/VSSolution/Override2-check.cmake
index d9656e1..c981ec0 100644
--- a/Tests/RunCMake/VSSolution/Override2-check.cmake
+++ b/Tests/RunCMake/VSSolution/Override2-check.cmake
@@ -1,4 +1,4 @@
 parseGlobalSections(pre post Override2)
 testGlobalSection(pre TestSec Key2=Value2 Key3=Value3)
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns Key1=Value1)
diff --git a/Tests/RunCMake/VSSolution/Override3-check.cmake b/Tests/RunCMake/VSSolution/Override3-check.cmake
new file mode 100644
index 0000000..baee9ed
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/Override3-check.cmake
@@ -0,0 +1,3 @@
+parseGlobalSections(pre post Override3)
+testGlobalSection(post ExtensibilityGlobals Key1=Value1 "SolutionGuid={custom-guid}")
+testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/Override3.cmake b/Tests/RunCMake/VSSolution/Override3.cmake
new file mode 100644
index 0000000..a59ce19
--- /dev/null
+++ b/Tests/RunCMake/VSSolution/Override3.cmake
@@ -0,0 +1,4 @@
+set_property(DIRECTORY PROPERTY VS_GLOBAL_SECTION_POST_ExtensibilityGlobals
+  Key1=Value1
+  SolutionGuid={custom-guid}
+  )
diff --git a/Tests/RunCMake/VSSolution/PrePost-check.cmake b/Tests/RunCMake/VSSolution/PrePost-check.cmake
index 322a689..957c964 100644
--- a/Tests/RunCMake/VSSolution/PrePost-check.cmake
+++ b/Tests/RunCMake/VSSolution/PrePost-check.cmake
@@ -2,5 +2,5 @@
 testGlobalSection(post Postsec Key1=Value2)
 testGlobalSection(pre Presec Key1=Value1 "Key2=Value with some spaces")
 testGlobalSection(post Emptysec)
-testGlobalSection(post ExtensibilityGlobals)
+testGlobalSection(post ExtensibilityGlobals "SolutionGuid={00000000-0000-0000-0000-000000000000}")
 testGlobalSection(post ExtensibilityAddIns)
diff --git a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
index 3a04db4..c25833d 100644
--- a/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
+++ b/Tests/RunCMake/VSSolution/RunCMakeTest.cmake
@@ -8,6 +8,7 @@
 run_cmake(PrePost)
 run_cmake(Override1)
 run_cmake(Override2)
+run_cmake(Override3)
 run_cmake(StartupProject)
 run_cmake(StartupProjectMissing)
 run_cmake(AddPackageToDefault)
diff --git a/Tests/RunCMake/VSSolution/solution_parsing.cmake b/Tests/RunCMake/VSSolution/solution_parsing.cmake
index 4e5bb59..4b27550 100644
--- a/Tests/RunCMake/VSSolution/solution_parsing.cmake
+++ b/Tests/RunCMake/VSSolution/solution_parsing.cmake
@@ -44,6 +44,9 @@
       endif()
       string(STRIP "${CMAKE_MATCH_1}" key)
       string(STRIP "${CMAKE_MATCH_2}" value)
+      if(key STREQUAL "SolutionGuid" AND value MATCHES "^{[0-9A-F-]+}$")
+        set(value "{00000000-0000-0000-0000-000000000000}")
+      endif()
       list(APPEND ${out_${sectionType}}_${sectionName} "${key}=${value}")
     endif()
   endforeach()
diff --git a/Tests/RunCMake/find_package/PackageRoot-stderr.txt b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
index 07b27bd..409fa89 100644
--- a/Tests/RunCMake/find_package/PackageRoot-stderr.txt
+++ b/Tests/RunCMake/find_package/PackageRoot-stderr.txt
@@ -1,7 +1,9 @@
 Foo_ROOT      :
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :FOO_TEST_FILE_ZOT-NOTFOUND
 FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :FOO_TEST_PATH_ZOT-NOTFOUND
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 
 Foo_ROOT      :
@@ -13,15 +15,19 @@
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
 BAR_TEST_FILE_BAR :BAR_TEST_FILE_BAR-NOTFOUND
+BAR_TEST_FILE_ZOT :BAR_TEST_FILE_ZOT-NOTFOUND
 BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
 BAR_TEST_PATH_BAR :BAR_TEST_PATH_BAR-NOTFOUND
+BAR_TEST_PATH_ZOT :BAR_TEST_PATH_ZOT-NOTFOUND
 BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_PROG_BAR :BAR_TEST_PROG_BAR-NOTFOUND
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -33,15 +39,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 
 Foo_ROOT      :
@@ -53,15 +63,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/foo/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/foo/env_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/foo/env_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -73,15 +87,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/foo/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/foo/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/foo/cmake_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 
 Foo_ROOT      :
@@ -93,15 +111,19 @@
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 
 Foo_ROOT      :
@@ -113,15 +135,19 @@
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :FOO_TEST_FILE_FOO-NOTFOUND
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :FOO_TEST_PATH_FOO-NOTFOUND
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 
 Foo_ROOT      :
@@ -133,15 +159,19 @@
 FOO_TEST_PROG_FOO :FOO_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_FILE_FOO :BAR_TEST_FILE_FOO-NOTFOUND
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :BAR_TEST_PATH_FOO-NOTFOUND
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :BAR_TEST_PROG_FOO-NOTFOUND
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -153,15 +183,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 
 Foo_ROOT      :
@@ -173,15 +207,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -193,15 +231,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -213,15 +255,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 
 Foo_ROOT      :
@@ -233,15 +279,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -253,15 +303,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/env_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/env_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/env_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -273,15 +327,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 
 Foo_ROOT      :
@@ -293,15 +351,19 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/env_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/env_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/env_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
 ENV{Foo_ROOT} :.*/PackageRoot/foo/env_root
 FOO_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
+FOO_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 FOO_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
+FOO_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 
 Foo_ROOT      :.*/PackageRoot/foo/cmake_root
@@ -313,7 +375,9 @@
 FOO_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_FILE_FOO :.*/PackageRoot/foo/cmake_root/include/foo.h
 BAR_TEST_FILE_BAR :.*/PackageRoot/bar/cmake_root/include/bar.h
+BAR_TEST_FILE_ZOT :.*/PackageRoot/foo/cmake_root/include/zot/zot.h
 BAR_TEST_PATH_FOO :.*/PackageRoot/foo/cmake_root/include
 BAR_TEST_PATH_BAR :.*/PackageRoot/bar/cmake_root/include
+BAR_TEST_PATH_ZOT :.*/PackageRoot/foo/cmake_root/include/zot
 BAR_TEST_PROG_FOO :.*/PackageRoot/foo/cmake_root/bin/foo.exe
 BAR_TEST_PROG_BAR :.*/PackageRoot/bar/cmake_root/bin/bar.exe
diff --git a/Tests/RunCMake/find_package/PackageRoot.cmake b/Tests/RunCMake/find_package/PackageRoot.cmake
index d9f41f8..421c243 100644
--- a/Tests/RunCMake/find_package/PackageRoot.cmake
+++ b/Tests/RunCMake/find_package/PackageRoot.cmake
@@ -37,7 +37,9 @@
   message("Foo_ROOT      :${Foo_ROOT}")
   message("ENV{Foo_ROOT} :$ENV{Foo_ROOT}")
   message("FOO_TEST_FILE_FOO :${FOO_TEST_FILE_FOO}")
+  message("FOO_TEST_FILE_ZOT :${FOO_TEST_FILE_ZOT}")
   message("FOO_TEST_PATH_FOO :${FOO_TEST_PATH_FOO}")
+  message("FOO_TEST_PATH_ZOT :${FOO_TEST_PATH_ZOT}")
   message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
   CleanUpPackageRootTest()
   message("")
@@ -57,8 +59,10 @@
   message("FOO_TEST_PROG_FOO :${FOO_TEST_PROG_FOO}")
   message("BAR_TEST_FILE_FOO :${BAR_TEST_FILE_FOO}")
   message("BAR_TEST_FILE_BAR :${BAR_TEST_FILE_BAR}")
+  message("BAR_TEST_FILE_ZOT :${BAR_TEST_FILE_ZOT}")
   message("BAR_TEST_PATH_FOO :${BAR_TEST_PATH_FOO}")
   message("BAR_TEST_PATH_BAR :${BAR_TEST_PATH_BAR}")
+  message("BAR_TEST_PATH_ZOT :${BAR_TEST_PATH_ZOT}")
   message("BAR_TEST_PROG_FOO :${BAR_TEST_PROG_FOO}")
   message("BAR_TEST_PROG_BAR :${BAR_TEST_PROG_BAR}")
   CleanUpPackageRootTest()
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
index eefa49c..72774a7 100644
--- a/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
+++ b/Tests/RunCMake/find_package/PackageRoot/FindBar.cmake
@@ -1,6 +1,8 @@
 find_file(BAR_TEST_FILE_FOO foo.h)
 find_file(BAR_TEST_FILE_BAR bar.h)
+find_file(BAR_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
 find_path(BAR_TEST_PATH_FOO foo.h)
 find_path(BAR_TEST_PATH_BAR bar.h)
+find_path(BAR_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
 find_program(BAR_TEST_PROG_FOO foo.exe)
 find_program(BAR_TEST_PROG_BAR bar.exe)
diff --git a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
index cb62390..e160a1d 100644
--- a/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
+++ b/Tests/RunCMake/find_package/PackageRoot/FindFoo.cmake
@@ -1,5 +1,7 @@
 find_file(FOO_TEST_FILE_FOO foo.h)
+find_file(FOO_TEST_FILE_ZOT zot.h PATH_SUFFIXES zot)
 find_path(FOO_TEST_PATH_FOO foo.h)
+find_path(FOO_TEST_PATH_ZOT zot.h PATH_SUFFIXES zot)
 find_program(FOO_TEST_PROG_FOO foo.exe)
 
 if ("Bar" IN_LIST Foo_FIND_COMPONENTS)
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/cmake_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/bar/env_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/cmake_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/PackageRoot/foo/env_root/include/zot/zot.h
diff --git a/Tests/RunCMake/find_package/RunCMakeTest.cmake b/Tests/RunCMake/find_package/RunCMakeTest.cmake
index 72f9c4d..7875db6 100644
--- a/Tests/RunCMake/find_package/RunCMakeTest.cmake
+++ b/Tests/RunCMake/find_package/RunCMakeTest.cmake
@@ -17,3 +17,5 @@
 run_cmake(PolicyPush)
 run_cmake(PolicyPop)
 run_cmake(SetFoundFALSE)
+run_cmake(WrongVersion)
+run_cmake(WrongVersionConfig)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
new file mode 100644
index 0000000..695f645
--- /dev/null
+++ b/Tests/RunCMake/find_package/SetFoundFALSE-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning at SetFoundFALSE.cmake:2 \(find_package\):
+  Found package configuration file:
+
+    .*/Tests/RunCMake/find_package/SetFoundFALSEConfig.cmake
+
+  but it set SetFoundFALSE_FOUND to FALSE so package "SetFoundFALSE" is
+  considered to be NOT FOUND.
+Call Stack \(most recent call first\):
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt b/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt
deleted file mode 100644
index 37e6e7e..0000000
--- a/Tests/RunCMake/find_package/SetFoundFALSE-stdout.txt
+++ /dev/null
@@ -1 +0,0 @@
--- Could NOT find SetFoundFALSE \(missing: SetFoundFALSE_DIR\)
diff --git a/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake
new file mode 100644
index 0000000..2dbcfb2
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-1/VersionedAConfigVersion.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 1)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 1)
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfig.cmake
diff --git a/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake
new file mode 100644
index 0000000..7eb8332
--- /dev/null
+++ b/Tests/RunCMake/find_package/VersionedA-2/VersionedAConfigVersion.cmake
@@ -0,0 +1,4 @@
+set(PACKAGE_VERSION 2)
+if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL 2)
+  set(PACKAGE_VERSION_COMPATIBLE 1)
+endif()
diff --git a/Tests/RunCMake/find_package/WrongVersion-stderr.txt b/Tests/RunCMake/find_package/WrongVersion-stderr.txt
new file mode 100644
index 0000000..ae9fc4a
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersion-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning at WrongVersion.cmake:[0-9]+ \(find_package\):
+  Could not find a configuration file for package "VersionedA" that is
+  compatible with requested version "3".
+
+  The following configuration files were considered but not accepted:
+
+    .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+    .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/WrongVersion.cmake b/Tests/RunCMake/find_package/WrongVersion.cmake
new file mode 100644
index 0000000..5bc711f
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersion.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+find_package(VersionedA 3)
diff --git a/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt b/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt
new file mode 100644
index 0000000..1b84233
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionConfig-stderr.txt
@@ -0,0 +1,11 @@
+^CMake Warning at WrongVersionConfig.cmake:[0-9]+ \(find_package\):
+  Could not find a configuration file for package "VersionedA" that is
+  compatible with requested version "3".
+
+  The following configuration files were considered but not accepted:
+
+    .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+    .*/Tests/RunCMake/find_package/VersionedA-[12]/VersionedAConfig.cmake, version: [12]
+
+Call Stack \(most recent call first\):
+  CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/find_package/WrongVersionConfig.cmake b/Tests/RunCMake/find_package/WrongVersionConfig.cmake
new file mode 100644
index 0000000..5bc711f
--- /dev/null
+++ b/Tests/RunCMake/find_package/WrongVersionConfig.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+find_package(VersionedA 3)
diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt
index 45ae3de..d85f366 100644
--- a/Utilities/cmcurl/CMakeLists.txt
+++ b/Utilities/cmcurl/CMakeLists.txt
@@ -929,6 +929,8 @@
   set(CMAKE_REQUIRED_LIBRARIES ws2_32)
 elseif(HAVE_LIBSOCKET)
   set(CMAKE_REQUIRED_LIBRARIES socket)
+elseif(HAVE_LIBNETWORK)
+  set(CMAKE_REQUIRED_LIBRARIES network)
 endif()
 
 check_symbol_exists(basename      "${CURL_INCLUDES}" HAVE_BASENAME)