Merge branch 'modules-restore-path-suffixes' into release-3.11

Merge-request: !1802
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4d2a9a..6623959 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -310,6 +310,8 @@
 # Simply to improve readability of the main script.
 #-----------------------------------------------------------------------
 macro (CMAKE_BUILD_UTILITIES)
+  find_package(Threads)
+
   #---------------------------------------------------------------------
   # Create the kwsys library for CMake.
   set(KWSYS_NAMESPACE cmsys)
diff --git a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
index f522c6b..7d3dfd1 100644
--- a/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
+++ b/Help/prop_tgt/AUTOGEN_TARGET_DEPENDS.rst
@@ -3,15 +3,29 @@
 
 Target dependencies of the corresponding ``_autogen`` target.
 
-Targets which have their :prop_tgt:`AUTOMOC` target ``ON`` have a
-corresponding ``_autogen`` target which is used to autogenerate generate moc
-files.  As this ``_autogen`` target is created at generate-time, it is not
-possible to define dependencies of it, such as to create inputs for the ``moc``
-executable.
+Targets which have their :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` property
+``ON`` have a corresponding ``_autogen`` target which is used to auto generate
+``moc`` and ``uic`` files.  As this ``_autogen`` target is created at
+generate-time, it is not possible to define dependencies of it,
+such as to create inputs for the ``moc`` or ``uic`` executable.
 
-The ``AUTOGEN_TARGET_DEPENDS`` target property can be set instead to a list of
-dependencies for the ``_autogen`` target.  The buildsystem will be generated to
-depend on its contents.
+The :prop_tgt:`AUTOGEN_TARGET_DEPENDS` target property can be set instead to a
+list of dependencies of the ``_autogen`` target.  Dependencies can be target
+names or file names.
 
 See the :manual:`cmake-qt(7)` manual for more information on using CMake
 with Qt.
+
+Use cases
+^^^^^^^^^
+
+If :prop_tgt:`AUTOMOC` or :prop_tgt:`AUTOUIC` depends on a file that is either
+
+- a :prop_sf:`GENERATED` non C++ file (e.g. a :prop_sf:`GENERATED` ``.json``
+  or ``.ui`` file) or
+- a :prop_sf:`GENERATED` C++ file that isn't recognized by :prop_tgt:`AUTOMOC`
+  and :prop_tgt:`AUTOUIC` because it's skipped by :prop_sf:`SKIP_AUTOMOC`,
+  :prop_sf:`SKIP_AUTOUIC`, :prop_sf:`SKIP_AUTOGEN` or :policy:`CMP0071` or
+- a file that isn't in the target's sources
+
+it must added to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`.
diff --git a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
index b738ecf..69957bf 100644
--- a/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
+++ b/Help/prop_tgt/AUTOMOC_DEPEND_FILTERS.rst
@@ -1,21 +1,27 @@
 AUTOMOC_DEPEND_FILTERS
 ----------------------
 
-Filter definitions used by :prop_tgt:`AUTOMOC` to extract file names from
-source code as additional dependencies for the ``moc`` file.
-
-This property is only used if the :prop_tgt:`AUTOMOC` property is ``ON``
-for this target.
+Filter definitions used by :prop_tgt:`AUTOMOC` to extract file names from a
+source file that are registered as additional dependencies for the
+``moc`` file of the source file.
 
 Filters are defined as ``KEYWORD;REGULAR_EXPRESSION`` pairs. First the file
 content is searched for ``KEYWORD``. If it is found at least once, then file
 names are extracted by successively searching for ``REGULAR_EXPRESSION`` and
 taking the first match group.
 
-Consider a filter extracts the file name ``DEP`` from the content of a file
-``FOO``. If ``DEP`` changes, then the ``moc`` file for ``FOO`` gets rebuilt.
-The file ``DEP`` is searched for first in the vicinity
-of ``FOO`` and afterwards in the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+The file name found in the first match group is searched for
+
+- first in the vicinity of the source file
+- and afterwards in the target's :prop_tgt:`INCLUDE_DIRECTORIES`.
+
+If any of the extracted files changes, then the ``moc`` file for the source
+file gets rebuilt even when the source file itself doesn't change.
+
+If any of the extracted files is :prop_sf:`GENERATED` or if it is not in the
+target's sources, then it might be necessary to add it to the
+``_autogen`` target  dependencies.
+See :prop_tgt:`AUTOGEN_TARGET_DEPENDS` for reference.
 
 By default :prop_tgt:`AUTOMOC_DEPEND_FILTERS` is initialized from
 :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`, which is empty by default.
@@ -24,22 +30,75 @@
 with Qt.
 
 
-Example
-^^^^^^^
+Example 1
+^^^^^^^^^
 
-Consider a file ``FOO.hpp`` holds a custom macro ``OBJ_JSON_FILE`` and we
-want the ``moc`` file to depend on the macro`s file name argument::
+A header file ``my_class.hpp`` uses a custom macro ``JSON_FILE_MACRO`` which
+is defined in an other header ``macros.hpp``.
+We want the ``moc`` file of ``my_class.hpp`` to depend on the file name
+argument of ``JSON_FILE_MACRO``::
 
+  // my_class.hpp
   class My_Class : public QObject
   {
     Q_OBJECT
-    OBJ_JSON_FILE ( "DEP.json" )
+    JSON_FILE_MACRO ( "info.json" )
   ...
   };
 
-Then we might use :variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` to
-define a filter like this::
+In ``CMakeLists.txt`` we add a filter to
+:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS` like this::
 
-  set(CMAKE_AUTOMOC_DEPEND_FILTERS
-    "OBJ_JSON_FILE" "[\n][ \t]*OBJ_JSON_FILE[ \t]*\\([ \t]*\"([^\"]+)\""
+  list( APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
+    "JSON_FILE_MACRO"
+    "[\n][ \t]*JSON_FILE_MACRO[ \t]*\\([ \t]*\"([^\"]+)\""
   )
+
+We assume ``info.json`` is a plain (not :prop_sf:`GENERATED`) file that is
+listed in the target's source.  Therefore we do not need to add it to
+:prop_tgt:`AUTOGEN_TARGET_DEPENDS`.
+
+Example 2
+^^^^^^^^^
+
+In the target ``my_target`` a header file ``complex_class.hpp`` uses a
+custom macro ``JSON_BASED_CLASS`` which is defined in an other header
+``macros.hpp``::
+
+  // macros.hpp
+  ...
+  #define JSON_BASED_CLASS(name, json) \
+  class name : public QObject \
+  { \
+    Q_OBJECT \
+    Q_PLUGIN_METADATA(IID "demo" FILE json) \
+    name() {} \
+  };
+  ...
+
+::
+
+  // complex_class.hpp
+  #pragma once
+  JSON_BASED_CLASS(Complex_Class, "meta.json")
+  // end of file
+
+Since ``complex_class.hpp`` doesn't contain a ``Q_OBJECT`` macro it would be
+ignored by :prop_tgt:`AUTOMOC`.  We change this by adding ``JSON_BASED_CLASS``
+to :variable:`CMAKE_AUTOMOC_MACRO_NAMES`::
+
+  list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "JSON_BASED_CLASS")
+
+We want the ``moc`` file of ``complex_class.hpp`` to depend on
+``meta.json``.  So we add a filter to
+:variable:`CMAKE_AUTOMOC_DEPEND_FILTERS`::
+
+  list(APPEND CMAKE_AUTOMOC_DEPEND_FILTERS
+    "JSON_BASED_CLASS"
+    "[\n^][ \t]*JSON_BASED_CLASS[ \t]*\\([^,]*,[ \t]*\"([^\"]+)\""
+  )
+
+Additionally we assume ``meta.json`` is :prop_sf:`GENERATED` which is
+why we have to add it to :prop_tgt:`AUTOGEN_TARGET_DEPENDS`::
+
+  set_property(TARGET my_target APPEND PROPERTY AUTOGEN_TARGET_DEPENDS "meta.json")
diff --git a/Help/release/dev/0-sample-topic.rst b/Help/release/dev/0-sample-topic.rst
deleted file mode 100644
index e4cc01e..0000000
--- a/Help/release/dev/0-sample-topic.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-0-sample-topic
---------------
-
-* This is a sample release note for the change in a topic.
-  Developers should add similar notes for each topic branch
-  making a noteworthy change.  Each document should be named
-  and titled to match the topic name to avoid merge conflicts.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 552922e..7375faf 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -7,8 +7,6 @@
   This file should include the adjacent "dev.txt" file
   in development versions but not in release versions.
 
-.. include:: dev.txt
-
 Releases
 ========
 
diff --git a/Help/variable/CMAKE_NETRC.rst b/Help/variable/CMAKE_NETRC.rst
index 52f857e..903ec31 100644
--- a/Help/variable/CMAKE_NETRC.rst
+++ b/Help/variable/CMAKE_NETRC.rst
@@ -2,7 +2,7 @@
 -----------
 
 This variable is used to initialize the ``NETRC`` option for
-:command:`file(DOWNLOAD)` and :command:`file(DOWNLOAD)` commands and the
+:command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands and the
 module :module:`ExternalProject`. See those commands for additional
 information.
 
diff --git a/Help/variable/CMAKE_NETRC_FILE.rst b/Help/variable/CMAKE_NETRC_FILE.rst
index 1508f1e..0f09afe 100644
--- a/Help/variable/CMAKE_NETRC_FILE.rst
+++ b/Help/variable/CMAKE_NETRC_FILE.rst
@@ -2,7 +2,7 @@
 ----------------
 
 This variable is used to initialize the ``NETRC_FILE`` option for
-:command:`file(DOWNLOAD)` and :command:`file(DOWNLOAD)` commands and the
+:command:`file(DOWNLOAD)` and :command:`file(UPLOAD)` commands and the
 module :module:`ExternalProject`. See those commands for additional
 information.
 
diff --git a/Modules/Compiler/TI-CXX.cmake b/Modules/Compiler/TI-CXX.cmake
index 8b0069b..4c6af06 100644
--- a/Modules/Compiler/TI-CXX.cmake
+++ b/Modules/Compiler/TI-CXX.cmake
@@ -2,7 +2,7 @@
 set(CMAKE_LINK_LIBRARY_FLAG "--library=")
 set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
 
-set(CMAKE_DEPFILE_FLAGS_CCX "--preproc_with_compile --preproc_dependency=<DEPFILE>")
+set(CMAKE_DEPFILE_FLAGS_CXX "--preproc_with_compile --preproc_dependency=<DEPFILE>")
 
 set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
 set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <INCLUDES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index c16bbf2..881bff1 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -206,7 +206,7 @@
     list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_Magick++_LIBRARY)
   elseif(component STREQUAL "MagickWand")
     FIND_IMAGEMAGICK_API(MagickWand "wand/MagickWand.h;MagickWand/MagickWand.h"
-      Wand MagickWand CORE_RL_wand_
+      Wand MagickWand CORE_RL_wand_ CORE_RL_MagickWand_
       MagickWand-6 MagickWand-7
       MagickWand-Q16 MagickWand-Q8 MagickWand-Q16HDRI MagickWand-Q8HDRI
       MagickWand-6.Q64 MagickWand-6.Q32 MagickWand-6.Q64HDRI MagickWand-6.Q32HDRI
@@ -217,7 +217,7 @@
     list(APPEND ImageMagick_REQUIRED_VARS ImageMagick_MagickWand_LIBRARY)
   elseif(component STREQUAL "MagickCore")
     FIND_IMAGEMAGICK_API(MagickCore "magick/MagickCore.h;MagickCore/MagickCore.h"
-      Magick MagickCore CORE_RL_magick_
+      Magick MagickCore CORE_RL_magick_ CORE_RL_MagickCore_
       MagickCore-6 MagickCore-7
       MagickCore-Q16 MagickCore-Q8 MagickCore-Q16HDRI MagickCore-Q8HDRI
       MagickCore-6.Q64 MagickCore-6.Q32 MagickCore-6.Q64HDRI MagickCore-6.Q32HDRI
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index e7c0732..a0010a2 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -765,6 +765,7 @@
   ${CMAKE_LIBUV_LIBRARIES}
   ${CMAKE_LIBRHASH_LIBRARIES}
   ${CMake_KWIML_LIBRARIES}
+  ${CMAKE_THREAD_LIBS_INIT}
   )
 
 if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_PROCESSOR MATCHES "sparc")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index a6e8503..8fd129a 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
-set(CMake_VERSION_MINOR 10)
-set(CMake_VERSION_PATCH 20180205)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_MINOR 11)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 1)
diff --git a/Source/cmExportBuildAndroidMKGenerator.cxx b/Source/cmExportBuildAndroidMKGenerator.cxx
index 6f31a2d..817b5d9 100644
--- a/Source/cmExportBuildAndroidMKGenerator.cxx
+++ b/Source/cmExportBuildAndroidMKGenerator.cxx
@@ -8,6 +8,7 @@
 #include <utility>
 
 #include "cmGeneratorExpression.h"
+#include "cmGeneratorExpressionDAGChecker.h"
 #include "cmGeneratorTarget.h"
 #include "cmLinkItem.h"
 #include "cmLocalGenerator.h"
@@ -101,12 +102,21 @@
         os << "LOCAL_CPP_FEATURES += ";
         os << (property.second) << "\n";
       } else if (property.first == "INTERFACE_LINK_LIBRARIES") {
+        // evaluate any generator expressions with the current
+        // build type of the makefile
+        cmGeneratorExpression ge;
+        cmGeneratorExpressionDAGChecker dagChecker(
+          target->GetName(), "INTERFACE_LINK_LIBRARIES", nullptr, nullptr);
+        std::unique_ptr<cmCompiledGeneratorExpression> cge =
+          ge.Parse(property.second);
+        std::string evaluated = cge->Evaluate(
+          target->GetLocalGenerator(), config, false, target, &dagChecker);
         // need to look at list in pi->second and see if static or shared
         // FindTargetToLink
         // target->GetLocalGenerator()->FindGeneratorTargetToUse()
         // then add to LOCAL_CPPFLAGS
         std::vector<std::string> libraries;
-        cmSystemTools::ExpandListArgument(property.second, libraries);
+        cmSystemTools::ExpandListArgument(evaluated, libraries);
         std::string staticLibs;
         std::string sharedLibs;
         std::string ldlibs;
@@ -122,12 +132,6 @@
               staticLibs += " " + lib;
             }
           } else {
-            // evaluate any generator expressions with the current
-            // build type of the makefile
-            cmGeneratorExpression ge;
-            std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(lib);
-            std::string evaluated =
-              cge->Evaluate(target->GetLocalGenerator(), config);
             bool relpath = false;
             if (type == cmExportBuildAndroidMKGenerator::INSTALL) {
               relpath = lib.substr(0, 3) == "../";
@@ -135,12 +139,12 @@
             // check for full path or if it already has a -l, or
             // in the case of an install check for relative paths
             // if it is full or a link library then use string directly
-            if (cmSystemTools::FileIsFullPath(evaluated) ||
-                evaluated.substr(0, 2) == "-l" || relpath) {
-              ldlibs += " " + evaluated;
+            if (cmSystemTools::FileIsFullPath(lib) ||
+                lib.substr(0, 2) == "-l" || relpath) {
+              ldlibs += " " + lib;
               // if it is not a path and does not have a -l then add -l
-            } else if (!evaluated.empty()) {
-              ldlibs += " -l" + evaluated;
+            } else if (!lib.empty()) {
+              ldlibs += " -l" + lib;
             }
           }
         }
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index b1afdc9..d3f5aac 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -459,7 +459,11 @@
 
   // Add ZERO_CHECK
   bool regenerate = !mf->IsOn("CMAKE_SUPPRESS_REGENERATION");
-  if (regenerate) {
+  bool generateTopLevelProjectOnly =
+    mf->IsOn("CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY");
+  bool isTopLevel =
+    !root->GetStateSnapshot().GetBuildsystemDirectoryParent().IsValid();
+  if (regenerate && (isTopLevel || !generateTopLevelProjectOnly)) {
     this->CreateReRunCMakeFile(root, gens);
     std::string file =
       this->ConvertToRelativeForMake(this->CurrentReRunCMakeMakefile.c_str());
@@ -542,6 +546,7 @@
   makefileStream.SetCopyIfDifferent(true);
   makefileStream << "# Generated by CMake, DO NOT EDIT\n\n";
 
+  makefileStream << "TARGETS:= \n";
   makefileStream << "empty:= \n";
   makefileStream << "space:= $(empty) $(empty)\n";
   makefileStream << "spaceplus:= $(empty)\\ $(empty)\n\n";
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx
index 41142e5..93c78b5 100644
--- a/Source/cmQtAutoGenInitializer.cxx
+++ b/Source/cmQtAutoGenInitializer.cxx
@@ -8,6 +8,7 @@
 #include "cmCustomCommandLines.h"
 #include "cmDuration.h"
 #include "cmFilePathChecksum.h"
+#include "cmGeneratedFileStream.h"
 #include "cmGeneratorTarget.h"
 #include "cmGlobalGenerator.h"
 #include "cmLinkItem.h"
@@ -22,7 +23,6 @@
 #include "cmStateTypes.h"
 #include "cmSystemTools.h"
 #include "cmTarget.h"
-#include "cm_sys_stat.h"
 #include "cmake.h"
 #include "cmsys/FStream.hxx"
 #include "cmsys/SystemInformation.hxx"
@@ -867,34 +867,6 @@
     dir += cfg;
   }
 
-  auto OpenInfoFile = [](cmsys::ofstream& ofs,
-                         std::string const& fileName) -> bool {
-    // Ensure we have write permission
-    if (cmSystemTools::FileExists(fileName)) {
-      mode_t perm = 0;
-#if defined(_WIN32) && !defined(__CYGWIN__)
-      mode_t mode_write = S_IWRITE;
-#else
-      mode_t mode_write = S_IWUSR;
-#endif
-      cmSystemTools::GetPermissions(fileName, perm);
-      if (!(perm & mode_write)) {
-        cmSystemTools::SetPermissions(fileName, perm | mode_write);
-      }
-    }
-
-    ofs.open(fileName.c_str(),
-             (std::ios::out | std::ios::binary | std::ios::trunc));
-    if (!ofs) {
-      // File open error
-      std::string error = "Internal CMake error when trying to open file: ";
-      error += Quoted(fileName);
-      error += " for writing.";
-      cmSystemTools::Error(error.c_str());
-    }
-    return static_cast<bool>(ofs);
-  };
-
   // Generate autogen target info file
   if (this->MocEnabled || this->UicEnabled) {
     if (this->MocEnabled) {
@@ -911,8 +883,10 @@
       this->Parallel = std::to_string(GetParallelCPUCount());
     }
 
-    cmsys::ofstream ofs;
-    if (OpenInfoFile(ofs, this->AutogenInfoFile)) {
+    cmGeneratedFileStream ofs;
+    ofs.SetCopyIfDifferent(true);
+    ofs.Open(this->AutogenInfoFile.c_str(), false, true);
+    if (ofs) {
       // Utility lambdas
       auto CWrite = [&ofs](const char* key, std::string const& value) {
         ofs << "set(" << key << " " << cmOutputConverter::EscapeForCMake(value)
@@ -1012,14 +986,18 @@
         CWriteNestedLists("AM_UIC_OPTIONS_OPTIONS", this->UicFileOptions);
         CWriteList("AM_UIC_SEARCH_PATHS", this->UicSearchPaths);
       }
+    } else {
+      return;
     }
   }
 
   // Generate auto RCC info files
   if (this->RccEnabled) {
     for (Qrc const& qrc : this->Qrcs) {
-      cmsys::ofstream ofs;
-      if (OpenInfoFile(ofs, qrc.InfoFile)) {
+      cmGeneratedFileStream ofs;
+      ofs.SetCopyIfDifferent(true);
+      ofs.Open(qrc.InfoFile.c_str(), false, true);
+      if (ofs) {
         // Utility lambdas
         auto CWrite = [&ofs](const char* key, std::string const& value) {
           ofs << "set(" << key << " "
@@ -1069,7 +1047,7 @@
         CWrite("ARCC_OPTIONS", cmJoin(qrc.Options, ";"));
         CWrite("ARCC_INPUTS", cmJoin(qrc.Resources, ";"));
       } else {
-        break;
+        return;
       }
     }
   }
diff --git a/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake b/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake
index a93e7f5..43c9384 100644
--- a/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake
+++ b/Tests/CMakeTests/String-TIMESTAMP-UnixTime.cmake
@@ -11,12 +11,12 @@
 # see if we are somewhere in the right region.
 
 math(EXPR years_since_epoch "${year} - 1970")
-math(EXPR lower_bound "((${years_since_epoch} * 365) + ${days}) * 86400")
+math(EXPR lower_bound "((${years_since_epoch} * 365) + ${days} - 1) * 86400")
 math(EXPR upper_bound "((${years_since_epoch} * 366) + ${days}) * 86400")
 
 
-if(unix_time GREATER lower_bound AND unix_time LESS upper_bound)
+if(unix_time GREATER_EQUAL lower_bound AND unix_time LESS upper_bound)
   message("~${unix_time}~")
 else()
-  message(FATAL_ERROR "${timestamp} unix time not in expected range [${lower_bound}, ${upper_bound}]")
+  message(FATAL_ERROR "${timestamp} unix time not in expected range [${lower_bound}, ${upper_bound})")
 endif()
diff --git a/Tests/CMakeTests/StringTest.cmake.in b/Tests/CMakeTests/StringTest.cmake.in
index 83655da..566f4b1 100644
--- a/Tests/CMakeTests/StringTest.cmake.in
+++ b/Tests/CMakeTests/StringTest.cmake.in
@@ -47,7 +47,7 @@
 set(TIMESTAMP-MonthWeekNames-RESULT 0)
 set(TIMESTAMP-MonthWeekNames-STDERR "~[^%]+;[^%]+~")
 set(TIMESTAMP-UnixTime-RESULT 0)
-set(TIMESTAMP-UnixTime-STDERR "~[1-9][0-9]+~")
+set(TIMESTAMP-UnixTime-STDERR "~[0-9]+~")
 
 include("@CMAKE_CURRENT_SOURCE_DIR@/CheckCMakeTest.cmake")
 check_cmake_test(String
diff --git a/Tests/CompileFeatures/default_dialect.c b/Tests/CompileFeatures/default_dialect.c
index 4debd94..2b4627c 100644
--- a/Tests/CompileFeatures/default_dialect.c
+++ b/Tests/CompileFeatures/default_dialect.c
@@ -1,6 +1,6 @@
 
 #if DEFAULT_C11
-#if __STDC_VERSION__ != 201112L
+#if __STDC_VERSION__ < 201112L
 #error Unexpected value for __STDC_VERSION__.
 #endif
 #elif DEFAULT_C99
diff --git a/Tests/RunCMake/AndroidMK/AndroidMK.cmake b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
index 2596e8c..3fbb2cf 100644
--- a/Tests/RunCMake/AndroidMK/AndroidMK.cmake
+++ b/Tests/RunCMake/AndroidMK/AndroidMK.cmake
@@ -4,7 +4,7 @@
 add_library(car foo.cxx)
 add_library(bar bar.c)
 add_library(dog  foo.cxx)
-target_link_libraries(foo car bar dog debug -lm)
+target_link_libraries(foo PRIVATE car bar dog debug -lm)
 export(TARGETS bar dog car foo  ANDROID_MK
   ${build_BINARY_DIR}/Android.mk)
 install(TARGETS bar dog car foo DESTINATION lib EXPORT myexp)
diff --git a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
index 64a07f0..5eff6b9 100644
--- a/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/XcodeProject/RunCMakeTest.cmake
@@ -236,3 +236,17 @@
     deploymeny_target_test(${SDK})
   endforeach()
 endif()
+
+function(XcodeDependOnZeroCheck)
+  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/XcodeDependOnZeroCheck-build)
+  set(RunCMake_TEST_NO_CLEAN 1)
+
+  file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+  file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+
+  run_cmake(XcodeDependOnZeroCheck)
+  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target parentdirlib)
+  run_cmake_command(XcodeDependOnZeroCheck-build ${CMAKE_COMMAND} --build . --target subdirlib)
+endfunction()
+
+XcodeDependOnZeroCheck()
diff --git a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt
new file mode 100644
index 0000000..92c9a29
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck-build-stdout.txt
@@ -0,0 +1 @@
+BUILD AGGREGATE TARGET ZERO_CHECK
diff --git a/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck.cmake b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck.cmake
new file mode 100644
index 0000000..d759a65
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/XcodeDependOnZeroCheck.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY TRUE)
+project(XcodeDependOnZeroCheck CXX)
+add_subdirectory(zerocheck)
+add_library(parentdirlib foo.cpp)
diff --git a/Tests/RunCMake/XcodeProject/zerocheck/CMakeLists.txt b/Tests/RunCMake/XcodeProject/zerocheck/CMakeLists.txt
new file mode 100644
index 0000000..4adde99
--- /dev/null
+++ b/Tests/RunCMake/XcodeProject/zerocheck/CMakeLists.txt
@@ -0,0 +1,2 @@
+project(subproject)
+add_library(subdirlib ../foo.cpp)
diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake
index 3c83957..f627966 100644
--- a/Utilities/Release/upload_release.cmake
+++ b/Utilities/Release/upload_release.cmake
@@ -1,6 +1,6 @@
 set(CTEST_RUN_CURRENT_SCRIPT 0)
 if(NOT VERSION)
- set(VERSION 3.10)
+ set(VERSION 3.11)
 endif()
 if(NOT DEFINED PROJECT_PREFIX)
   set(PROJECT_PREFIX cmake-${VERSION})