Merge branch 'doc-file-GLOB-no-order' into release
diff --git a/Auxiliary/cmake-mode.el b/Auxiliary/cmake-mode.el
index 11e33b3..e50ae7b 100644
--- a/Auxiliary/cmake-mode.el
+++ b/Auxiliary/cmake-mode.el
@@ -70,11 +70,11 @@
 (defconst cmake-regex-indented
   (rx-to-string `(and bol (* (group (or (regexp ,cmake-regex-token) (any space ?\n)))))))
 (defconst cmake-regex-block-open
-  (rx-to-string `(and bow (or ,@(append cmake-keywords-block-open
-                                        (mapcar 'downcase cmake-keywords-block-open))) eow)))
+  (rx-to-string `(and symbol-start (or ,@(append cmake-keywords-block-open
+                                        (mapcar 'downcase cmake-keywords-block-open))) symbol-end)))
 (defconst cmake-regex-block-close
-  (rx-to-string `(and bow (or ,@(append cmake-keywords-block-close
-                                        (mapcar 'downcase cmake-keywords-block-close))) eow)))
+  (rx-to-string `(and symbol-start (or ,@(append cmake-keywords-block-close
+                                        (mapcar 'downcase cmake-keywords-block-close))) symbol-end)))
 (defconst cmake-regex-close
   (rx-to-string `(and bol (* space) (regexp ,cmake-regex-block-close)
                       (* space) (regexp ,cmake-regex-paren-left))))
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index fe7735c..5033e18 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -36,6 +36,12 @@
 A ``SHARED`` library may be marked with the :prop_tgt:`FRAMEWORK`
 target property to create an OS X Framework.
 
+If a library does not export any symbols, it must not be declared as a
+``SHARED`` library.  For example, a Windows resource DLL or a managed C++/CLI
+DLL that exports no unmanaged symbols would need to be a ``MODULE`` library.
+This is because CMake expects a ``SHARED`` library to always have an
+associated import library on Windows.
+
 By default the library file will be created in the build tree directory
 corresponding to the source tree directory in which the command was
 invoked.  See documentation of the :prop_tgt:`ARCHIVE_OUTPUT_DIRECTORY`,
diff --git a/Help/command/add_test.rst b/Help/command/add_test.rst
index 7e7e6bd..d8a96e9 100644
--- a/Help/command/add_test.rst
+++ b/Help/command/add_test.rst
@@ -28,6 +28,13 @@
   directory set to the build directory corresponding to the
   current source directory.
 
+The given test command is expected to exit with code ``0`` to pass and
+non-zero to fail, or vice-versa if the :prop_test:`WILL_FAIL` test
+property is set.  Any output written to stdout or stderr will be
+captured by :manual:`ctest(1)` but does not affect the pass/fail status
+unless the :prop_test:`PASS_REGULAR_EXPRESSION` or
+:prop_test:`FAIL_REGULAR_EXPRESSION` test property is used.
+
 The ``COMMAND`` and ``WORKING_DIRECTORY`` options may use "generator
 expressions" with the syntax ``$<...>``.  See the
 :manual:`cmake-generator-expressions(7)` manual for available expressions.
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index 357aae9..bc633e6 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -80,6 +80,10 @@
 dissimilar in that it is generally not linked to -- it is not used in
 the right-hand-side of the :command:`target_link_libraries` command.
 It is a type which is loaded as a plugin using runtime techniques.
+If the library does not export any unmanaged symbols (e.g. Windows
+resource DLL, C++/CLI DLL), it is required that the library not be a
+``SHARED`` library because CMake expects ``SHARED`` libraries to export
+at least one symbol.
 
 .. code-block:: cmake
 
@@ -781,7 +785,8 @@
 
 * On DLL platforms: the import library file (e.g. ``.lib``) of a shared
   library target created by the :command:`add_library` command
-  with the ``SHARED`` option.
+  with the ``SHARED`` option.  This file is only guaranteed to exist if
+  the library exports at least one unmanaged symbol.
 
 * On DLL platforms: the import library file (e.g. ``.lib``) of an
   executable target created by the :command:`add_executable` command
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index 2dc67bc..caf5bac 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -308,4 +308,4 @@
 * ``Clang``: Clang compiler versions 2.9 through 3.4.
 * ``GNU``: GNU compiler versions 4.4 through 5.0.
 * ``MSVC``: Microsoft Visual Studio versions 2010 through 2015.
-* ``SunPro``: Oracle SolarisStudio version 12.4 on a Linux host.
+* ``SunPro``: Oracle SolarisStudio version 12.4.
diff --git a/Help/release/3.4.rst b/Help/release/3.4.rst
index 8cc0796..89c5561 100644
--- a/Help/release/3.4.rst
+++ b/Help/release/3.4.rst
@@ -5,7 +5,7 @@
 
   .. contents::
 
-Changes made since CMake 3.4 include the following.
+Changes made since CMake 3.3 include the following.
 
 New Features
 ============
@@ -267,3 +267,7 @@
   created with the :command:`add_library` command.  ``MODULE``
   libraries are meant for explicit dynamic loading at runtime.
   They cannot be linked so ``SONAME`` is not useful.
+
+* The internal :variable:`CMAKE_<LANG>_COMPILE_OBJECT` rule variable now
+  substitutes compiler include flags in a separate ``<INCLUDES>`` placeholder
+  instead of the main ``<FLAGS>`` placeholder.
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 752acbd..5d1a3f7 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -5,8 +5,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/Modules/CPackWIX.cmake b/Modules/CPackWIX.cmake
index 5fe51a6..bef8e16 100644
--- a/Modules/CPackWIX.cmake
+++ b/Modules/CPackWIX.cmake
@@ -16,7 +16,7 @@
 #
 #  Will be automatically generated unless explicitly provided.
 #
-#  It should be explicitly set to a constant generated gloabally unique
+#  It should be explicitly set to a constant generated globally unique
 #  identifier (GUID) to allow your installers to replace existing
 #  installations that use the same GUID.
 #
@@ -226,7 +226,7 @@
 #  This variable can be used to provide a value for
 #  the Windows Installer property ``<PROPERTY>``
 #
-#  The follwing list contains some example properties that can be used to
+#  The following list contains some example properties that can be used to
 #  customize information under
 #  "Programs and Features" (also known as "Add or Remove Programs")
 #
diff --git a/Modules/Compiler/SunPro-CXX.cmake b/Modules/Compiler/SunPro-CXX.cmake
index 0e936ca..50d68ee 100644
--- a/Modules/Compiler/SunPro-CXX.cmake
+++ b/Modules/Compiler/SunPro-CXX.cmake
@@ -31,21 +31,17 @@
   "<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
   "<CMAKE_RANLIB> <TARGET> ")
 
-if (CMAKE_SYSTEM_NAME STREQUAL Linux)
-  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
-    set(CMAKE_CXX98_STANDARD_COMPILE_OPTION "-std=c++03")
-    set(CMAKE_CXX98_EXTENSION_COMPILE_OPTION "-std=c++03")
-    set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
-    set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
-  endif()
+if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+  set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
+  set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
+endif()
 
-  if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
-    if (NOT CMAKE_CXX_COMPILER_FORCED)
-      if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
-        message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
-      endif()
-      set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+  if (NOT CMAKE_CXX_COMPILER_FORCED)
+    if (NOT CMAKE_CXX_STANDARD_COMPUTED_DEFAULT)
+      message(FATAL_ERROR "CMAKE_CXX_STANDARD_COMPUTED_DEFAULT should be set for ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) version ${CMAKE_CXX_COMPILER_VERSION}")
     endif()
+    set(CMAKE_CXX_STANDARD_DEFAULT ${CMAKE_CXX_STANDARD_COMPUTED_DEFAULT})
   endif()
 endif()
 
@@ -55,12 +51,10 @@
   endmacro()
 
   set(_result 0)
-  if (CMAKE_SYSTEM_NAME STREQUAL Linux)
-    if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
-      _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
-      if (_result EQUAL 0)
-        _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
-      endif()
+  if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
+    _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
+    if (_result EQUAL 0)
+      _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
     endif()
   endif()
 endmacro()
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 90ceedf..c822bdb 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1731,6 +1731,7 @@
       --non-interactive ${svn_trust_cert_args} ${svn_user_pw_args} ${src_name})
     list(APPEND depends ${stamp_dir}/${name}-svninfo.txt)
   elseif(git_repository)
+    unset(CMAKE_MODULE_PATH) # Use CMake builtin find module
     find_package(Git QUIET)
     if(NOT GIT_EXECUTABLE)
       message(FATAL_ERROR "error: could not find git for clone of ${name}")
@@ -1739,7 +1740,7 @@
     # The git submodule update '--recursive' flag requires git >= v1.6.5
     #
     if(GIT_VERSION_STRING VERSION_LESS 1.6.5)
-      message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': git_version='${git_version}'")
+      message(FATAL_ERROR "error: git version 1.6.5 or later required for 'git submodule update --recursive': GIT_VERSION_STRING='${GIT_VERSION_STRING}'")
     endif()
 
     get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index 3ce2c73..d05d3da 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -81,7 +81,7 @@
 
 
 set(PostgreSQL_KNOWN_VERSIONS ${PostgreSQL_ADDITIONAL_VERSIONS}
-    "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
+    "9.5" "9.4" "9.3" "9.2" "9.1" "9.0" "8.4" "8.3" "8.2" "8.1" "8.0")
 
 # Define additional search paths for root directories.
 set( PostgreSQL_ROOT_DIRECTORIES
diff --git a/Modules/Platform/Darwin-Initialize.cmake b/Modules/Platform/Darwin-Initialize.cmake
index 62fb985..a08411b 100644
--- a/Modules/Platform/Darwin-Initialize.cmake
+++ b/Modules/Platform/Darwin-Initialize.cmake
@@ -100,6 +100,10 @@
         "Instead using SDK:\n \"${_CMAKE_OSX_SYSROOT_DEFAULT}\"."
         )
     endif()
+    if(NOT CMAKE_OSX_DEPLOYMENT_TARGET AND _CURRENT_OSX_VERSION VERSION_LESS _CMAKE_OSX_DEPLOYMENT_TARGET)
+      set(CMAKE_OSX_DEPLOYMENT_TARGET ${_CURRENT_OSX_VERSION} CACHE STRING
+        "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value." FORCE)
+    endif()
   else()
     # Assume developer files are in root (such as Xcode 4.5 command-line tools).
     set(_CMAKE_OSX_SYSROOT_DEFAULT "")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 087ed53..aaef212 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 3)
-set(CMake_VERSION_PATCH 20151005)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_MINOR 4)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 1)
diff --git a/Source/CTest/cmCTestCurl.cxx b/Source/CTest/cmCTestCurl.cxx
index b4c0137..fb6cc00 100644
--- a/Source/CTest/cmCTestCurl.cxx
+++ b/Source/CTest/cmCTestCurl.cxx
@@ -166,6 +166,10 @@
                      curlWriteMemoryCallback);
   ::curl_easy_setopt(this->Curl, CURLOPT_DEBUGFUNCTION,
                      curlDebugCallback);
+  // Be sure to set Content-Type to satisfy fussy modsecurity rules
+  struct curl_slist *headers = ::curl_slist_append(NULL,
+                                                   "Content-Type: text/xml");
+  ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, headers);
   std::vector<char> responseData;
   std::vector<char> debugData;
   ::curl_easy_setopt(this->Curl, CURLOPT_FILE, (void *)&responseData);
@@ -174,6 +178,8 @@
   // Now run off and do what you've been told!
   ::curl_easy_perform(this->Curl);
   ::fclose(ftpfile);
+  ::curl_easy_setopt(this->Curl, CURLOPT_HTTPHEADER, NULL);
+  ::curl_slist_free_all(headers);
 
   if ( responseData.size() > 0 )
     {
diff --git a/Source/CTest/cmCTestSubmitHandler.cxx b/Source/CTest/cmCTestSubmitHandler.cxx
index 1e12f15..833cad6 100644
--- a/Source/CTest/cmCTestSubmitHandler.cxx
+++ b/Source/CTest/cmCTestSubmitHandler.cxx
@@ -338,6 +338,8 @@
   CURLcode res;
   FILE* ftpfile;
   char error_buffer[1024];
+  struct curl_slist *headers = ::curl_slist_append(NULL,
+                                                   "Content-Type: text/xml");
 
   /* In windows, this will init the winsock stuff */
   ::curl_global_init(CURL_GLOBAL_ALL);
@@ -420,6 +422,9 @@
       ::curl_easy_setopt(curl, CURLOPT_PUT, 1);
       ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
 
+      // Be sure to set Content-Type to satisfy fussy modsecurity rules
+      ::curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
+
       std::string local_file = *file;
       if ( !cmSystemTools::FileExists(local_file.c_str()) )
         {
@@ -477,6 +482,7 @@
         cmCTestLog(this->CTest, ERROR_MESSAGE, "   Cannot find file: "
           << local_file << std::endl);
         ::curl_easy_cleanup(curl);
+        ::curl_slist_free_all(headers);
         ::curl_global_cleanup();
         return false;
         }
@@ -621,6 +627,7 @@
                      << std::endl);
           }
         ::curl_easy_cleanup(curl);
+        ::curl_slist_free_all(headers);
         ::curl_global_cleanup();
         return false;
         }
@@ -630,6 +637,7 @@
         "   Uploaded: " + local_file << std::endl, this->Quiet);
       }
     }
+  ::curl_slist_free_all(headers);
   ::curl_global_cleanup();
   return true;
 }
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
index ffee035..c538280 100644
--- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
+++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt
@@ -25,8 +25,7 @@
   )
   add_executable(WriteCompilerDetectionHeader "${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp")
 
-  if((UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
-      AND NOT CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+  if(UNIX OR NOT CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     include(CheckCXXSourceCompiles)
     check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection.h\"\nint main() { return 0; }\n"
       file_include_works
diff --git a/Utilities/Release/upload_release.cmake b/Utilities/Release/upload_release.cmake
index ac41300..171811a 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.3)
+ set(VERSION 3.4)
 endif()
 if(NOT DEFINED PROJECT_PREFIX)
   set(PROJECT_PREFIX cmake-${VERSION})