Merge branch 'FindCurses-remove-unused-check' into release
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e61621d..1250a94 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -382,10 +382,8 @@
   #---------------------------------------------------------------------
   # Build jsoncpp library.
   if(CMAKE_USE_SYSTEM_JSONCPP)
-    if(EXISTS ${CMAKE_ROOT}/Modules/FindJsonCpp.cmake)
-      find_package(JsonCpp)
-    elseif(NOT CMAKE_VERSION VERSION_LESS 3.0)
-      include(${CMake_SOURCE_DIR}/Modules/FindJsonCpp.cmake)
+    if(NOT CMAKE_VERSION VERSION_LESS 3.0)
+      include(${CMake_SOURCE_DIR}/Source/Modules/FindJsonCpp.cmake)
     else()
       message(FATAL_ERROR "CMAKE_USE_SYSTEM_JSONCPP requires CMake >= 3.0")
     endif()
diff --git a/Help/command/configure_file.rst b/Help/command/configure_file.rst
index 70357f2..4304f09 100644
--- a/Help/command/configure_file.rst
+++ b/Help/command/configure_file.rst
@@ -9,38 +9,103 @@
                  [COPYONLY] [ESCAPE_QUOTES] [@ONLY]
                  [NEWLINE_STYLE [UNIX|DOS|WIN32|LF|CRLF] ])
 
-Copies a file <input> to file <output> and substitutes variable values
-referenced in the file content.  If <input> is a relative path it is
-evaluated with respect to the current source directory.  The <input>
-must be a file, not a directory.  If <output> is a relative path it is
-evaluated with respect to the current binary directory.  If <output>
-names an existing directory the input file is placed in that directory
-with its original name.
+Copies an ``<input>`` file to an ``<output>`` file and substitutes
+variable values referenced as ``@VAR@`` or ``${VAR}`` in the input
+file content.  Each variable reference will be replaced with the
+current value of the variable, or the empty string if the variable
+is not defined.  Furthermore, input lines of the form::
 
-If the <input> file is modified the build system will re-run CMake to
+  #cmakedefine VAR ...
+
+will be replaced with either::
+
+  #define VAR ...
+
+or::
+
+  /* #undef VAR */
+
+depending on whether ``VAR`` is set in CMake to any value not considered
+a false constant by the :command:`if` command.  The "..." content on the
+line after the variable name, if any, is processed as above.
+Input file lines of the form ``#cmakedefine01 VAR`` will be replaced with
+either ``#define VAR 1`` or ``#define VAR 0`` similarly.
+
+If the input file is modified the build system will re-run CMake to
 re-configure the file and generate the build system again.
 
-This command replaces any variables in the input file referenced as
-${VAR} or @VAR@ with their values as determined by CMake.  If a
-variable is not defined, it will be replaced with nothing.  If
-COPYONLY is specified, then no variable expansion will take place.  If
-ESCAPE_QUOTES is specified then any substituted quotes will be C-style
-escaped.  The file will be configured with the current values of CMake
-variables.  If @ONLY is specified, only variables of the form @VAR@
-will be replaced and ${VAR} will be ignored.  This is useful for
-configuring scripts that use ${VAR}.
+The arguments are:
 
-Input file lines of the form "#cmakedefine VAR ..." will be replaced
-with either "#define VAR ..." or ``/* #undef VAR */`` depending on
-whether VAR is set in CMake to any value not considered a false
-constant by the if() command.  (Content of "...", if any, is processed
-as above.) Input file lines of the form "#cmakedefine01 VAR" will be
-replaced with either "#define VAR 1" or "#define VAR 0" similarly.
+``<input>``
+  Path to the input file.  A relative path is treated with respect to
+  the value of :variable:`CMAKE_CURRENT_SOURCE_DIR`.  The input path
+  must be a file, not a directory.
 
-With NEWLINE_STYLE the line ending could be adjusted:
+``<output>``
+  Path to the output file or directory.  A relative path is treated
+  with respect to the value of :variable:`CMAKE_CURRENT_BINARY_DIR`.
+  If the path names an existing directory the output file is placed
+  in that directory with the same file name as the input file.
 
-::
+``COPYONLY``
+  Copy the file without replacing any variable references or other
+  content.  This option may not be used with ``NEWLINE_STYLE``.
 
-    'UNIX' or 'LF' for \n, 'DOS', 'WIN32' or 'CRLF' for \r\n.
+``ESCAPE_QUOTES``
+  Escape any substituted quotes with backslashes (C-style).
 
-COPYONLY must not be used with NEWLINE_STYLE.
+``@ONLY``
+  Restrict variable replacement to references of the form ``@VAR@``.
+  This is useful for configuring scripts that use ``${VAR}`` syntax.
+
+``NEWLINE_STYLE <style>``
+  Specify the newline style for the output file.  Specify
+  ``UNIX`` or ``LF`` for ``\n`` newlines, or specify
+  ``DOS``, ``WIN32``, or ``CRLF`` for ``\r\n`` newlines.
+  This option may not be used with ``COPYONLY``.
+
+Example
+^^^^^^^
+
+Consider a source tree containing a ``foo.h.in`` file:
+
+.. code-block:: c
+
+  #cmakedefine FOO_ENABLE
+  #cmakedefine FOO_STRING "@FOO_STRING@"
+
+An adjacent ``CMakeLists.txt`` may use ``configure_file`` to
+configure the header:
+
+.. code-block:: cmake
+
+  option(FOO_ENABLE "Enable Foo" ON)
+  if(FOO_ENABLE)
+    set(FOO_STRING "foo")
+  endif()
+  configure_file(foo.h.in foo.h @ONLY)
+
+This creates a ``foo.h`` in the build directory corresponding to
+this source directory.  If the ``FOO_ENABLE`` option is on, the
+configured file will contain:
+
+.. code-block:: c
+
+  #define FOO_ENABLE
+  #define FOO_STRING "foo"
+
+Otherwise it will contain:
+
+.. code-block:: c
+
+  /* #undef FOO_ENABLE */
+  /* #undef FOO_STRING */
+
+One may then use the :command:`include_directories` command to
+specify the output directory as an include directory:
+
+.. code-block:: cmake
+
+  include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+so that sources may include the header as ``#include <foo.h>``.
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index db56010..965eede 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -126,7 +126,6 @@
    /module/FindJava
    /module/FindJNI
    /module/FindJPEG
-   /module/FindJsonCpp
    /module/FindKDE3
    /module/FindKDE4
    /module/FindLAPACK
diff --git a/Help/module/FindJsonCpp.rst b/Help/module/FindJsonCpp.rst
deleted file mode 100644
index ba87ece..0000000
--- a/Help/module/FindJsonCpp.rst
+++ /dev/null
@@ -1 +0,0 @@
-.. cmake-module:: ../../Modules/FindJsonCpp.cmake
diff --git a/Help/release/3.2.rst b/Help/release/3.2.rst
index ddc3d86..8abb1ca 100644
--- a/Help/release/3.2.rst
+++ b/Help/release/3.2.rst
@@ -124,19 +124,10 @@
 * A :module:`FindIntl` module was introduced to find the
   Gettext ``libintl`` library.
 
-* A :module:`FindJsonCpp` module was introduced to find the
-  JsonCpp package.
-
 * The :module:`FindLATEX` module learned to support components.
 
 * The :module:`FindMPI` module learned to find MS-MPI on Windows.
 
-* The :module:`FindOpenGL` module no longer explicitly searches
-  for any dependency on X11 libraries with the :module:`FindX11`
-  module.  Such dependencies should not need to be explicit.
-  Applications using X11 APIs themselves should find and link
-  to X11 libraries explicitly.
-
 * The :module:`FindOpenSSL` module now reports ``crypto`` and ``ssl``
   libraries separately in ``OPENSSL_CRYPTO_LIBRARY`` and
   ``OPENSSL_SSL_LIBRARY``, respectively, to allow applications to
@@ -231,6 +222,12 @@
   compatible.  If files were in a different encoding, including
   Latin 1, they will need to be converted.
 
+* The :module:`FindOpenGL` module no longer explicitly searches
+  for any dependency on X11 libraries with the :module:`FindX11`
+  module.  Such dependencies should not need to be explicit.
+  Applications using X11 APIs themselves should find and link
+  to X11 libraries explicitly.
+
 * The implementation of CMake now relies on some C++ compiler features which
   are not supported by some older compilers.  As a result, those old compilers
   can no longer be used to build CMake itself.  CMake continues to be able to
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 3dcb0d0..d248fe1 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -114,6 +114,7 @@
   JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
     ${_JAVA_HOME}/jre/lib/{libarch}
     ${_JAVA_HOME}/jre/lib
+    ${_JAVA_HOME}/lib/{libarch}
     ${_JAVA_HOME}/lib
     ${_JAVA_HOME}
     )
diff --git a/Modules/FindJsonCpp.cmake b/Source/Modules/FindJsonCpp.cmake
similarity index 97%
rename from Modules/FindJsonCpp.cmake
rename to Source/Modules/FindJsonCpp.cmake
index cbb4fb3..014d3bd 100644
--- a/Modules/FindJsonCpp.cmake
+++ b/Source/Modules/FindJsonCpp.cmake
@@ -93,7 +93,7 @@
 unset(_JsonCpp_H)
 
 #-----------------------------------------------------------------------------
-include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/../../Modules/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(JsonCpp
   FOUND_VAR JsonCpp_FOUND
   REQUIRED_VARS JsonCpp_LIBRARY JsonCpp_INCLUDE_DIR
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index b833648..996aa75 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -147,6 +147,8 @@
   this->CMakeInstance->SetStartOutputDirectory(this->BinaryDirectory.toLocal8Bit().data());
   this->CMakeInstance->SetGlobalGenerator(
     this->CMakeInstance->CreateGlobalGenerator(this->Generator.toLocal8Bit().data()));
+  this->CMakeInstance->SetGeneratorPlatform("");
+  this->CMakeInstance->SetGeneratorToolset("");
   this->CMakeInstance->LoadCache();
   this->CMakeInstance->SetSuppressDevWarnings(this->SuppressDevWarnings);
   this->CMakeInstance->SetWarnUninitialized(this->WarnUninitializedMode);
diff --git a/Tests/FindJsonCpp/Test/CMakeLists.txt b/Tests/FindJsonCpp/Test/CMakeLists.txt
index 4e1e271..d1dc647 100644
--- a/Tests/FindJsonCpp/Test/CMakeLists.txt
+++ b/Tests/FindJsonCpp/Test/CMakeLists.txt
@@ -2,6 +2,9 @@
 project(TestFindJsonCpp CXX)
 include(CTest)
 
+# CMake does not actually provide FindJsonCpp publicly.
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Modules)
+
 find_package(JsonCpp REQUIRED)
 
 add_executable(test_jsoncpp_tgt main.cxx)
diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake
index 345870b..2511db4 100644
--- a/Utilities/Release/dash2win64_release.cmake
+++ b/Utilities/Release/dash2win64_release.cmake
@@ -7,13 +7,8 @@
 set(CPACK_SOURCE_GENERATORS "ZIP")
 set(MAKE_PROGRAM "make")
 set(MAKE "${MAKE_PROGRAM} -j8")
-if(CMAKE_CREATE_VERSION STREQUAL "nightly")
-  set(CMAKE_USE_OPENSSL OFF)
-else()
-  set(CMAKE_USE_OPENSSL ON)
-endif()
 set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
-CMAKE_USE_OPENSSL:BOOL=${CMAKE_USE_OPENSSL}
+CMAKE_USE_OPENSSL:BOOL=OFF
 CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
 CMAKE_Fortran_COMPILER:FILEPATH=FALSE
 CMAKE_GENERATOR:INTERNAL=Unix Makefiles
diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake
index 910fcbd..bc95982 100644
--- a/Utilities/Release/dashmacmini5_release.cmake
+++ b/Utilities/Release/dashmacmini5_release.cmake
@@ -8,13 +8,8 @@
 set(CPACK_BINARY_GENERATORS "DragNDrop TGZ TZ")
 set(CPACK_SOURCE_GENERATORS "TGZ TZ")
 set(CPACK_DMG_FORMAT "UDBZ") #build using bzip2 for smaller package size
-if(CMAKE_CREATE_VERSION STREQUAL "nightly")
-  set(CMAKE_USE_OPENSSL OFF)
-else()
-  set(CMAKE_USE_OPENSSL ON)
-endif()
 set(INITIAL_CACHE "
-CMAKE_USE_OPENSSL:BOOL=${CMAKE_USE_OPENSSL}
+CMAKE_USE_OPENSSL:BOOL=OFF
 OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libcrypto.a
 OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1g-install/include
 OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1g-install/lib/libssl.a
diff --git a/bootstrap b/bootstrap
index e7d0496..5f12ee0 100755
--- a/bootstrap
+++ b/bootstrap
@@ -398,6 +398,8 @@
   --no-system-curl        use cmake-provided curl library (default)
   --system-expat          use system-installed expat library
   --no-system-expat       use cmake-provided expat library (default)
+  --system-jsoncpp        use system-installed jsoncpp library
+  --no-system-jsoncpp     use cmake-provided jsoncpp library (default)
   --system-zlib           use system-installed zlib library
   --no-system-zlib        use cmake-provided zlib library (default)
   --system-bzip2          use system-installed bzip2 library
@@ -637,10 +639,10 @@
   --init=*) cmake_init_file=`cmake_arg "$1"` ;;
   --system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=1" ;;
   --no-system-libs) cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARIES=0" ;;
-  --system-bzip2|--system-curl|--system-expat|--system-libarchive|--system-zlib)
+  --system-bzip2|--system-curl|--system-expat|--system-jsoncpp|--system-libarchive|--system-zlib)
     lib=`cmake_arg "$1" "--system-"`
     cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=1" ;;
-  --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-libarchive|--no-system-zlib)
+  --no-system-bzip2|--no-system-curl|--no-system-expat|--no-system-jsoncpp|--no-system-libarchive|--no-system-zlib)
     lib=`cmake_arg "$1" "--no-system-"`
     cmake_bootstrap_system_libs="${cmake_bootstrap_system_libs} -DCMAKE_USE_SYSTEM_LIBRARY_`cmake_toupper $lib`=0" ;;
   --qt-gui) cmake_bootstrap_qt_gui="1" ;;