Merge branch 'revert-definition-map-lookup' into release
diff --git a/.gitattributes b/.gitattributes
index d21f1dd..d3f7280 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -12,6 +12,8 @@
 *.dsp           -crlf
 *.dsptemplate   -crlf
 *.dsw           -crlf
+*.pfx           -crlf
+*.png           -crlf
 *.sln           -crlf
 *.vcproj        -crlf
 
diff --git a/Auxiliary/bash-completion/ctest b/Auxiliary/bash-completion/ctest
index 25cb998..327e12c 100644
--- a/Auxiliary/bash-completion/ctest
+++ b/Auxiliary/bash-completion/ctest
@@ -19,8 +19,12 @@
             _filedir
             return
             ;;
-        -L|--label-regex|-LE|--label-exclude|--track|-I|--tests-information|\
-        --max-width|--timeout|--stop-time)
+        -L|--label-regex|-LE|--label-exclude)
+            COMPREPLY=( $( compgen -W '$( ctest --print-labels 2>/dev/null |
+                grep "^  " 2>/dev/null | cut -d" " -f 3 )' -- "$cur" ) )
+            return
+            ;;
+        --track|-I|--tests-information|--max-width|--timeout|--stop-time)
             # argument required but no completions available
             return
             ;;
diff --git a/Auxiliary/cmake-syntax.vim b/Auxiliary/cmake-syntax.vim
index 80395ab..782130d 100644
--- a/Auxiliary/cmake-syntax.vim
+++ b/Auxiliary/cmake-syntax.vim
@@ -48,9 +48,9 @@
 syn keyword cmakeDeprecated ABSTRACT_FILES BUILD_NAME SOURCE_FILES SOURCE_FILES_REMOVE VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WRAP_EXCLUDE_FILES
            \ nextgroup=cmakeArguments
 
-" The keywords are generated as:  cmake --help-command-list | tr "\n" " "
+" The keywords are generated as:  cmake --help-command-list | tr "\n" " " | tr "[:lower:]" "[:upper:]"
 syn keyword cmakeStatement
-      \ ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BUILD_COMMAND BUILD_NAME CMAKE_MINIMUM_REQUIRED CONFIGURE_FILE CREATE_TEST_SOURCELIST ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_LINK_LIBRARIES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VTK_MAKE_INSTANTIATOR VTK_WRAP_JAVA VTK_WRAP_PYTHON VTK_WRAP_TCL WHILE WRITE_FILE
+            \ ADD_COMPILE_OPTIONS ADD_CUSTOM_COMMAND ADD_CUSTOM_TARGET ADD_DEFINITIONS ADD_DEPENDENCIES ADD_EXECUTABLE ADD_LIBRARY ADD_SUBDIRECTORY ADD_TEST AUX_SOURCE_DIRECTORY BREAK BUILD_COMMAND BUILD_NAME CMAKE_HOST_SYSTEM_INFORMATION CMAKE_MINIMUM_REQUIRED CMAKE_POLICY CONFIGURE_FILE CREATE_TEST_SOURCELIST CTEST_BUILD CTEST_CONFIGURE CTEST_COVERAGE CTEST_EMPTY_BINARY_DIRECTORY CTEST_MEMCHECK CTEST_READ_CUSTOM_FILES CTEST_RUN_SCRIPT CTEST_SLEEP CTEST_START CTEST_SUBMIT CTEST_TEST CTEST_UPDATE CTEST_UPLOAD DEFINE_PROPERTY ELSE ELSEIF ENABLE_LANGUAGE ENABLE_TESTING ENDFOREACH ENDFUNCTION ENDIF ENDMACRO ENDWHILE EXEC_PROGRAM EXECUTE_PROCESS EXPORT EXPORT_LIBRARY_DEPENDENCIES FILE FIND_FILE FIND_LIBRARY FIND_PACKAGE FIND_PATH FIND_PROGRAM FLTK_WRAP_UI FOREACH FUNCTION GET_CMAKE_PROPERTY GET_DIRECTORY_PROPERTY GET_FILENAME_COMPONENT GET_PROPERTY GET_SOURCE_FILE_PROPERTY GET_TARGET_PROPERTY GET_TEST_PROPERTY IF INCLUDE INCLUDE_DIRECTORIES INCLUDE_EXTERNAL_MSPROJECT INCLUDE_REGULAR_EXPRESSION INSTALL INSTALL_FILES INSTALL_PROGRAMS INSTALL_TARGETS LINK_DIRECTORIES LINK_LIBRARIES LIST LOAD_CACHE LOAD_COMMAND MACRO MAKE_DIRECTORY MARK_AS_ADVANCED MATH MESSAGE OPTION OUTPUT_REQUIRED_FILES PROJECT QT_WRAP_CPP QT_WRAP_UI REMOVE REMOVE_DEFINITIONS RETURN SEPARATE_ARGUMENTS SET SET_DIRECTORY_PROPERTIES SET_PROPERTY SET_SOURCE_FILES_PROPERTIES SET_TARGET_PROPERTIES SET_TESTS_PROPERTIES SITE_NAME SOURCE_GROUP STRING SUBDIR_DEPENDS SUBDIRS TARGET_COMPILE_DEFINITIONS TARGET_COMPILE_FEATURES TARGET_COMPILE_OPTIONS TARGET_INCLUDE_DIRECTORIES TARGET_LINK_LIBRARIES TARGET_SOURCES TRY_COMPILE TRY_RUN UNSET USE_MANGLED_MESA UTILITY_SOURCE VARIABLE_REQUIRES VARIABLE_WATCH WHILE WRITE_FILE
             \ nextgroup=cmakeArguments
 syn keyword cmakeTodo
             \ TODO FIXME XXX
diff --git a/CMakeCPack.cmake b/CMakeCPack.cmake
index fb55bfc..22ca8cf 100644
--- a/CMakeCPack.cmake
+++ b/CMakeCPack.cmake
@@ -50,7 +50,7 @@
   if(NOT DEFINED CPACK_SYSTEM_NAME)
     # make sure package is not Cygwin-unknown, for Cygwin just
     # cygwin is good for the system name
-    if("${CMAKE_SYSTEM_NAME}" STREQUAL "CYGWIN")
+    if("x${CMAKE_SYSTEM_NAME}" STREQUAL "xCYGWIN")
       set(CPACK_SYSTEM_NAME Cygwin)
     else()
       set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR})
@@ -59,11 +59,37 @@
   if(${CPACK_SYSTEM_NAME} MATCHES Windows)
     if(CMAKE_CL_64)
       set(CPACK_SYSTEM_NAME win64-x64)
+      set(CPACK_IFW_TARGET_DIRECTORY "@RootDir@/Program Files/${CMAKE_PROJECT_NAME}")
     else()
       set(CPACK_SYSTEM_NAME win32-x86)
     endif()
   endif()
 
+  if(${CMAKE_SYSTEM_NAME} MATCHES Windows)
+    set(_CPACK_IFW_PACKAGE_ICON
+        "set(CPACK_IFW_PACKAGE_ICON \"${CMake_SOURCE_DIR}/Source/QtDialog/CMakeSetup.ico\")")
+    if(BUILD_QtDialog)
+      set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/bin/cmake-gui.exe\", \"@StartMenuDir@/CMake (cmake-gui).lnk\");\n")
+    endif()
+    if(SPHINX_HTML)
+      set(_CPACK_IFW_SHORTCUT_OPTIONAL "${_CPACK_IFW_SHORTCUT_OPTIONAL}component.addOperation(\"CreateShortcut\", \"@TargetDir@/doc/cmake-${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}/html/index.html\", \"@StartMenuDir@/CMake Documentation.lnk\");\n")
+    endif()
+    configure_file("${CMake_SOURCE_DIR}/Source/QtIFW/installscript.qs.in"
+      "${CMake_BINARY_DIR}/installscript.qs" @ONLY
+    )
+    install(FILES "${CMake_SOURCE_DIR}/Source/QtIFW/cmake.org.html"
+      DESTINATION "."
+    )
+    set(_CPACK_IFW_PACKAGE_SCRIPT "set(CPACK_IFW_COMPONENT_GROUP_CMAKE_SCRIPT \"${CMake_BINARY_DIR}/installscript.qs\")")
+  endif()
+
+  if(${CMAKE_SYSTEM_NAME} MATCHES Linux)
+    set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/${CMAKE_PROJECT_NAME}")
+    set(CPACK_IFW_ADMIN_TARGET_DIRECTORY "@ApplicationsDir@/${CMAKE_PROJECT_NAME}")
+  endif()
+
+  set(_CPACK_IFW_PACKAGE_VERSION ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH})
+
   if(NOT DEFINED CPACK_PACKAGE_FILE_NAME)
     # if the CPACK_PACKAGE_FILE_NAME is not defined by the cache
     # default to source package - system, on cygwin system is not
diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in
index aba404f..57ed4ca 100644
--- a/CMakeCPackOptions.cmake.in
+++ b/CMakeCPackOptions.cmake.in
@@ -31,6 +31,28 @@
 # they might not if qt was not enabled for the build
 include("@QT_DIALOG_CPACK_OPTIONS_FILE@" OPTIONAL)
 
+if(CPACK_GENERATOR MATCHES "IFW")
+  # Installer configuration
+  set(CPACK_IFW_PACKAGE_TITLE "CMake Build Tool")
+  set(CPACK_IFW_PRODUCT_URL "http://www.cmake.org")
+  @_CPACK_IFW_PACKAGE_ICON@
+  set(CPACK_IFW_PACKAGE_WINDOW_ICON
+    "@CMake_SOURCE_DIR@/Source/QtDialog/CMakeSetup128.png")
+  # Package configuration group
+  set(CPACK_IFW_PACKAGE_GROUP CMake)
+  # Group configuration
+  set(CPACK_COMPONENT_GROUP_CMAKE_DISPLAY_NAME
+    "@CPACK_PACKAGE_NAME@")
+  set(CPACK_COMPONENT_GROUP_CMAKE_DESCRIPTION
+    "@CPACK_PACKAGE_DESCRIPTION_SUMMARY@")
+  # IFW group configuration
+  set(CPACK_IFW_COMPONENT_GROUP_CMAKE_VERSION
+    "@_CPACK_IFW_PACKAGE_VERSION@")
+  set(CPACK_IFW_COMPONENT_GROUP_CMAKE_LICENSES
+    "@CPACK_PACKAGE_NAME@ Copyright" "@CPACK_RESOURCE_FILE_LICENSE@")
+  @_CPACK_IFW_PACKAGE_SCRIPT@
+endif()
+
 if(CPACK_GENERATOR MATCHES "CygwinSource")
   # when packaging source make sure the .build directory is not included
     set(CPACK_SOURCE_IGNORE_FILES
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e4cd15..71850de 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -57,7 +57,7 @@
 
   # Allow the user to enable/disable all system utility library options by
   # defining CMAKE_USE_SYSTEM_LIBRARIES or CMAKE_USE_SYSTEM_LIBRARY_${util}.
-  set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE ZLIB)
+  set(UTILITIES BZIP2 CURL EXPAT LIBARCHIVE LIBLZMA ZLIB)
   foreach(util ${UTILITIES})
     if(NOT DEFINED CMAKE_USE_SYSTEM_LIBRARY_${util}
         AND DEFINED CMAKE_USE_SYSTEM_LIBRARIES)
@@ -93,6 +93,8 @@
     "${CMAKE_USE_SYSTEM_LIBRARY_ZLIB}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE;NOT CMAKE_USE_SYSTEM_CURL" ON)
   CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_BZIP2 "Use system-installed bzip2"
     "${CMAKE_USE_SYSTEM_LIBRARY_BZIP2}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
+  CMAKE_DEPENDENT_OPTION(CMAKE_USE_SYSTEM_LIBLZMA "Use system-installed liblzma"
+    "${CMAKE_USE_SYSTEM_LIBRARY_LIBLZMA}" "NOT CMAKE_USE_SYSTEM_LIBARCHIVE" ON)
 
   # Mention to the user what system libraries are being used.
   foreach(util ${UTILITIES})
@@ -201,12 +203,6 @@
 #-----------------------------------------------------------------------
 macro (CMAKE_BUILD_UTILITIES)
   #---------------------------------------------------------------------
-  # Create the KWIML library for CMake.
-  set(KWIML cmIML)
-  set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
-  add_subdirectory(Utilities/KWIML)
-
-  #---------------------------------------------------------------------
   # Create the kwsys library for CMake.
   set(KWSYS_NAMESPACE cmsys)
   set(KWSYS_USE_SystemTools 1)
@@ -307,6 +303,23 @@
   endif()
 
   #---------------------------------------------------------------------
+  # Build or use system liblzma for libarchive.
+  if(CMAKE_USE_SYSTEM_LIBLZMA)
+    find_package(LibLZMA)
+    if(NOT LIBLZMA_FOUND)
+      message(FATAL_ERROR "CMAKE_USE_SYSTEM_LIBLZMA is ON but LibLZMA is not found!")
+    endif()
+    set(LZMA_INCLUDE_DIR ${LIBLZMA_INCLUDE_DIRS})
+    set(LZMA_LIBRARY ${LIBLZMA_LIBRARIES})
+  else()
+    add_subdirectory(Utilities/cmliblzma)
+    CMAKE_SET_TARGET_FOLDER(cmliblzma "Utilities/3rdParty")
+    set(LZMA_INCLUDE_DIR
+      "${CMAKE_CURRENT_SOURCE_DIR}/Utilities/cmliblzma/liblzma/api")
+    set(LZMA_LIBRARY cmliblzma)
+  endif()
+
+  #---------------------------------------------------------------------
   # Build or use system libarchive for CMake and CTest.
   if(CMAKE_USE_SYSTEM_LIBARCHIVE)
     find_package(LibArchive)
@@ -321,7 +334,7 @@
     add_definitions(-DLIBARCHIVE_STATIC)
     set(ENABLE_NETTLE OFF CACHE INTERNAL "Enable use of Nettle")
     set(ENABLE_OPENSSL ${CMAKE_USE_OPENSSL} CACHE INTERNAL "Enable use of OpenSSL")
-    set(ENABLE_LZMA OFF CACHE INTERNAL "Enable the use of the system found LZMA library if found")
+    set(ENABLE_LZMA ON CACHE INTERNAL "Enable the use of the system found LZMA library if found")
     set(ENABLE_ZLIB ON CACHE INTERNAL "Enable the use of the system found ZLIB library if found")
     set(ENABLE_BZip2 ON CACHE INTERNAL "Enable the use of the system found BZip2 library if found")
     set(ENABLE_EXPAT OFF CACHE INTERNAL "Enable the use of the system found EXPAT library if found")
@@ -368,7 +381,7 @@
   # Use curses?
   if (UNIX)
     # there is a bug in the Syllable libraries which makes linking ccmake fail, Alex
-    if(NOT "${CMAKE_SYSTEM_NAME}" MATCHES syllable)
+    if(NOT CMAKE_SYSTEM_NAME MATCHES syllable)
       set(CURSES_NEED_NCURSES TRUE)
       find_package(Curses QUIET)
       if (CURSES_LIBRARY)
@@ -451,7 +464,7 @@
 # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
 #
 # If not defined or "", this variable defaults to the server at
-# http://www.cdash.org/CDash.
+# "http://open.cdash.org".
 #
 # If set explicitly to "NOTFOUND", curl tests and ctest tests that use
 # the network are skipped.
@@ -462,9 +475,14 @@
 # should be run first.
 #
 if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
-  set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash")
+  set(CMAKE_TESTS_CDASH_SERVER "http://open.cdash.org")
 endif()
 
+# Create the KWIML library for CMake.
+set(KWIML cmIML)
+set(KWIML_HEADER_ROOT ${CMake_BINARY_DIR}/Utilities)
+add_subdirectory(Utilities/KWIML)
+
 if(NOT CMake_TEST_EXTERNAL_CMAKE)
   # build the utilities (a macro defined in this file)
   CMAKE_BUILD_UTILITIES()
@@ -534,10 +552,6 @@
 
 # setup some Testing support (a macro defined in this file)
 CMAKE_SETUP_TESTING()
-configure_file(
-  "${CMAKE_CURRENT_SOURCE_DIR}/DartLocal.conf.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
-  COPYONLY)
 
 if(NOT CMake_TEST_EXTERNAL_CMAKE)
   if(NOT CMake_VERSION_IS_RELEASE)
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
index 819f9ba..df2f94c 100644
--- a/CTestConfig.cmake
+++ b/CTestConfig.cmake
@@ -13,8 +13,8 @@
 set(CTEST_NIGHTLY_START_TIME "1:00:00 UTC")
 
 set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake")
+set(CTEST_DROP_SITE "open.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=CMake")
 set(CTEST_DROP_SITE_CDASH TRUE)
 set(CTEST_CDASH_VERSION "1.6")
 set(CTEST_CDASH_QUERY_VERSION TRUE)
diff --git a/DartConfig.cmake b/DartConfig.cmake
index 37f66c7..92dffca 100644
--- a/DartConfig.cmake
+++ b/DartConfig.cmake
@@ -13,6 +13,6 @@
 set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
 
 set(CTEST_DROP_METHOD "http")
-set(CTEST_DROP_SITE "www.cdash.org")
-set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake")
+set(CTEST_DROP_SITE "open.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=CMake")
 set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/DartLocal.conf.in b/DartLocal.conf.in
deleted file mode 100644
index e28cb18..0000000
--- a/DartLocal.conf.in
+++ /dev/null
@@ -1,121 +0,0 @@
-ExpectedBuilds: \
-{andoria.kitware Linux-g++3.4-KDevelop} \
-{andoria.kitware Linux-g++3.4-SVN} \
-{DASH1.kitware Win32-nmake71} \
-{DASH1.kitware Win32-vs71} \
-{DASH1.kitware Win32-vs71Rel} \
-{DASH1.kitware zRel24-Win32-nmake71} \
-{DASH1.kitware zRel24-Win32-vs71} \
-{DASH11.kitware zRel24-Win32-nmake71} \
-{dash14.kitware Win32-bcc5.6} \
-{dash14.kitware Win32-cygwin} \
-{dash14.kitware Win32-mingw} \
-{dash14.kitware zRel24-Win32-bcc5.6} \
-{dash17.kitware Linux-g++4.0} \
-{dash1win64.kitware Win64-vs80} \
-{dash1win98.kitware Win32-vs60} \
-{DASH2.kitware Win32-nmake70} \
-{DASH2.kitware Win32-vs70} \
-{DASH2.kitware Win32-vs70-InPlace} \
-{DASH2.kitware zRel24-Win32-nmake70} \
-{DASH2.kitware zRel24-Win32-vs70} \
-{DASH3.kitware Win32-nmake60} \
-{DASH3.kitware Win32-vs60} \
-{DASH3.kitware zRel24-Win32-nmake60} \
-{DASH3.kitware zRel24-Win32-vs60} \
-{dash4.kitware Win32-bcc5.8} \
-{DASH5.kitware Linux-gcc332-InPlace} \
-{DASH5.kitware zRel24-Linix-gcc332} \
-{DASH6.kitware zRel24-Linix-gcc332} \
-{dash8.kitware Linux64-g++} \
-{dash8.kitware Linux64-g++332} \
-{dash8.kitware Linux64-g++341} \
-{dash8.kitware zRel24-Linux64-g++} \
-{dash8.kitware zRel24-Linux64-g++332} \
-{dashmacmini1.kitware Darwin-Tiger-Xcode21} \
-{dashmacmini1.kitware zRel24-Darwin-Tiger-g++} \
-{dashmacmini2.kitware DarwinIntel-g++} \
-{dashmacmini2.kitware DarwinIntel-Universal} \
-{dashmacmini2.kitware Darwin-Tiger-Xcode21-univ} \
-{dashmacmini3.kitware Darwin-LeopardIntel-g++} \
-{dashmacmini3.kitware Darwin-LeopardIntel-Universal} \
-{dashmacmini3.kitware Darwin-Leopard-Xcode21-univ} \
-{dashsgi1.kitware IRIX32-CC} \
-{dashsgi1.kitware IRIX64-CC} \
-{dashsun1.kitware SunOS-CC} \
-{dashsun1.kitware SunOS-CC-64} \
-{dashsun1.kitware SunOS-gcc34-64} \
-{destiny.kitware HP-UX-aCC} \
-{destiny.kitware HP-UX-aCC-gmake} \
-{devqnx.acfr.usyd.edu.au qnx-V3.3.5-gcc_ntox86} \
-{grayson.kitware Win32-nmake80} \
-{heart HP-UXia64-aCC} \
-{hythloth.kitware Linux64-bullseye-cov} \
-{hythloth.kitware Linux64-suncc-5.9} \
-{hythloth.kitware Linux-nightly-win32-release} \
-{insight.journal.kitware KWStyle} \
-{iris.elemtech IRIX64-CC64-7.4} \
-{iris.elemtech IRIX64-CC-7.4} \
-{JET.kitware Linux-valgrind2} \
-{krondor.kitware Darwin-c++} \
-{krondor.kitware zRel24-Darwin-c++} \
-{midworld.kitware DarwinG5-g++} \
-{midworld.kitware DarwinG5-XCode15} \
-{midworld.kitware zRel24-DarwinG5-g++} \
-{pre.vision.cs.rpi.edu FreeBSD-CC-gmake} \
-{pre.vision.cs.rpi.edu FreeBSD-CC-make} \
-{RogueResearch3 Mac10.5-CMake-gcc-dbg-ppc} \
-{RogueResearch3 Mac10.5-CMake-gcc-dbg-ppc64} \
-{RogueResearch3 Mac10.5-CMake-gcc-rel-ppc} \
-{RogueResearch3 Mac10.5-CMake-gcc-rel-ppc64} \
-{RogueResearch3 Mac10.5-CMake-Xcode-dbg-ppc} \
-{RogueResearch3 Mac10.5-CMake-Xcode-dbg-ppc64} \
-{RogueResearch4 Mac10.5-CMake-gcc-dbg-i386} \
-{RogueResearch4 Mac10.5-CMake-gcc-dbg-rosetta} \
-{RogueResearch4 Mac10.5-CMake-gcc-rel-i386} \
-{tick.rz.uni-augsburg.de LinuxPPC-g++3.3} \
-{tick.rz.uni-augsburg.de LinuxPPC-g++3.4} \
-{trinsic.kitware Win32-mingw} \
-{r06n01.pbm.ihost.com AIX53-xlC} \
-{r06n01.pbm.ihost.com zRel24-AIX53-xlC} \
-{valhalla.kitware Win32-wcl386}
-
-#{devqnx.acfr.usyd.edu.au qnx-V3.3.5-gcc_ntox86 } \
-#{mr-orange.obtech.net gentoo-linux-x86\_64-gcc-4.0.2 } \
-#{G5.Nfsnet.Org Darwin8.3-gcc4} \
-
-# commas in names do not work for expected builds....
-
-#{G4.Nfsnet.Org Darwin-c++} \
-#{salmon.nlm.nih.gov Darwin8.7-gcc4} \
-
-#{crd.ge.com Solaris-gcc343} \
-#{crd.ge.com Linux-icc81} \
-#{crd.ge.com Windows-bcc32} \
-#{crd.ge.com Windows-nmake71} \
-#{crd.ge.com Windows-nmake60} \
-
-#{dash16.kitware Linux-g++4.0} \
-#{styx Linuxia64-g++} \
-#{crd.ge.com Cygwin-gcc344} \
-#{valhalla.kitware Win32-bccRel} \
-#{valhalla.kitware Win32-bcc} \
-#{valhalla.kitware Win32-g++} \
-#{valhalla.kitware Win32-nmake60} \
-#{valhalla.kitware Win32-nmake70} \
-#{valhalla.kitware Win32-vs60} \
-#{valhalla.kitware Win32-vs70}
-#{crd.ge.com FreeBSD-gcc321} \
-#{crd.ge.com Linux-gcc320} \
-
-#{cogattaca.kitware LinuxWin32-g++-Werror} \
-#{cogattaca.kitware LinuxWin32-g++} \
-
-#{dash8.kitware Win64-icl80} \
-#{dash8.kitware zLRB-Win64-icl80} \
-
-#{hythloth.kitware Linux-icc-8.1} \
-
-CompressionMode: ALL
-CompressionCommand: /bin/gzip
-CompressionType: gzip
diff --git a/Help/command/add_custom_command.rst b/Help/command/add_custom_command.rst
index 028ca5a..e8b7cc8 100644
--- a/Help/command/add_custom_command.rst
+++ b/Help/command/add_custom_command.rst
@@ -3,10 +3,12 @@
 
 Add a custom build rule to the generated build system.
 
-There are two main signatures for add_custom_command The first
-signature is for adding a custom command to produce an output.
+There are two main signatures for ``add_custom_command``.
 
-::
+Generating Files
+^^^^^^^^^^^^^^^^
+
+The first signature is for adding a custom command to produce an output::
 
   add_custom_command(OUTPUT output1 [output2 ...]
                      COMMAND command1 [ARGS] [args1...]
@@ -18,28 +20,121 @@
                      [WORKING_DIRECTORY dir]
                      [COMMENT comment] [VERBATIM] [APPEND])
 
-This defines a command to generate specified OUTPUT file(s).  A target
-created in the same directory (CMakeLists.txt file) that specifies any
-output of the custom command as a source file is given a rule to
-generate the file using the command at build time.  Do not list the
-output in more than one independent target that may build in parallel
-or the two instances of the rule may conflict (instead use
-add_custom_target to drive the command and make the other targets
-depend on that one).  If an output name is a relative path it will be
-interpreted relative to the build tree directory corresponding to the
-current source directory.  Note that MAIN_DEPENDENCY is completely
-optional and is used as a suggestion to visual studio about where to
-hang the custom command.  In makefile terms this creates a new target
-in the following form:
-
-::
+This defines a command to generate specified ``OUTPUT`` file(s).
+A target created in the same directory (``CMakeLists.txt`` file)
+that specifies any output of the custom command as a source file
+is given a rule to generate the file using the command at build time.
+Do not list the output in more than one independent target that
+may build in parallel or the two instances of the rule may conflict
+(instead use the :command:`add_custom_target` command to drive the
+command and make the other targets depend on that one).
+In makefile terms this creates a new target in the following form::
 
   OUTPUT: MAIN_DEPENDENCY DEPENDS
           COMMAND
 
-If more than one command is specified they will be executed in order.
-The optional ARGS argument is for backward compatibility and will be
-ignored.
+The options are:
+
+``APPEND``
+  Append the ``COMMAND`` and ``DEPENDS`` option values to the custom
+  command for the first output specified.  There must have already
+  been a previous call to this command with the same output.
+  The ``COMMENT``, ``MAIN_DEPENDENCY``, and ``WORKING_DIRECTORY``
+  options are currently ignored when APPEND is given, but may be
+  used in the future.
+
+``COMMAND``
+  Specify the command-line(s) to execute at build time.
+  If more than one ``COMMAND`` is specified they will be executed in order,
+  but *not* necessarily composed into a stateful shell or batch script.
+  (To run a full script, use the :command:`configure_file` command or the
+  :command:`file(GENERATE)` command to create it, and then specify
+  a ``COMMAND`` to launch it.)
+  The optional ``ARGS`` argument is for backward compatibility and
+  will be ignored.
+
+  If ``COMMAND`` specifies an executable target (created by the
+  :command:`add_executable` command) it will automatically be replaced
+  by the location of the executable created at build time.
+  Additionally a target-level dependency will be added so that the
+  executable target will be built before any target using this custom
+  command.  However this does NOT add a file-level dependency that
+  would cause the custom command to re-run whenever the executable is
+  recompiled.
+
+  Arguments to ``COMMAND`` may use
+  :manual:`generator expressions <cmake-generator-expressions(7)>`.
+  References to target names in generator expressions imply target-level
+  dependencies, but NOT file-level dependencies.  List target names with
+  the ``DEPENDS`` option to add file-level dependencies.
+
+``COMMENT``
+  Display the given message before the commands are executed at
+  build time.
+
+``DEPENDS``
+  Specify files on which the command depends.  If any dependency is
+  an ``OUTPUT`` of another custom command in the same directory
+  (``CMakeLists.txt`` file) CMake automatically brings the other
+  custom command into the target in which this command is built.
+  If ``DEPENDS`` is not specified the command will run whenever
+  the ``OUTPUT`` is missing; if the command does not actually
+  create the ``OUTPUT`` then the rule will always run.
+  If ``DEPENDS`` specifies any target (created by the
+  :command:`add_custom_target`, :command:`add_executable`, or
+  :command:`add_library` command) a target-level dependency is
+  created to make sure the target is built before any target
+  using this custom command.  Additionally, if the target is an
+  executable or library a file-level dependency is created to
+  cause the custom command to re-run whenever the target is
+  recompiled.
+
+  Arguments to ``DEPENDS`` may use
+  :manual:`generator expressions <cmake-generator-expressions(7)>`.
+
+``IMPLICIT_DEPENDS``
+  Request scanning of implicit dependencies of an input file.
+  The language given specifies the programming language whose
+  corresponding dependency scanner should be used.
+  Currently only ``C`` and ``CXX`` language scanners are supported.
+  The language has to be specified for every file in the
+  ``IMPLICIT_DEPENDS`` list.  Dependencies discovered from the
+  scanning are added to those of the custom command at build time.
+  Note that the ``IMPLICIT_DEPENDS`` option is currently supported
+  only for Makefile generators and will be ignored by other generators.
+
+``MAIN_DEPENDENCY``
+  Specify the primary input source file to the command.  This is
+  treated just like any value given to the ``DEPENDS`` option
+  but also suggests to Visual Studio generators where to hang
+  the custom command.
+
+``OUTPUT``
+  Specify the output files the command is expected to produce.
+  If an output name is a relative path it will be interpreted
+  relative to the build tree directory corresponding to the
+  current source directory.
+  If the output of the custom command is not actually created
+  as a file on disk it should be marked with the :prop_sf:`SYMBOLIC`
+  source file property.
+
+``VERBATIM``
+  All arguments to the commands will be escaped properly for the
+  build tool so that the invoked command receives each argument
+  unchanged.  Note that one level of escapes is still used by the
+  CMake language processor before add_custom_command even sees the
+  arguments.  Use of ``VERBATIM`` is recommended as it enables
+  correct behavior.  When ``VERBATIM`` is not given the behavior
+  is platform specific because there is no protection of
+  tool-specific special characters.
+
+``WORKING_DIRECTORY``
+  Execute the command with the given current working directory.
+  If it is a relative path it will be interpreted relative to the
+  build tree directory corresponding to the current source directory.
+
+Build Events
+^^^^^^^^^^^^
 
 The second signature adds a custom command to a target such as a
 library or executable.  This is useful for performing an operation
@@ -60,103 +155,15 @@
 specified target.  When the command will happen is determined by which
 of the following is specified:
 
-::
-
-  PRE_BUILD - run before all other dependencies
-  PRE_LINK - run after other dependencies
-  POST_BUILD - run after the target has been built
-
-Note that the PRE_BUILD option is only supported on Visual Studio 7 or
-later.  For all other generators PRE_BUILD will be treated as
-PRE_LINK.
-
-If WORKING_DIRECTORY is specified the command will be executed in the
-directory given.  If it is a relative path it will be interpreted
-relative to the build tree directory corresponding to the current
-source directory.  If COMMENT is set, the value will be displayed as a
-message before the commands are executed at build time.  If APPEND is
-specified the COMMAND and DEPENDS option values are appended to the
-custom command for the first output specified.  There must have
-already been a previous call to this command with the same output.
-The COMMENT, WORKING_DIRECTORY, and MAIN_DEPENDENCY options are
-currently ignored when APPEND is given, but may be used in the future.
-
-If VERBATIM is given then all arguments to the commands will be
-escaped properly for the build tool so that the invoked command
-receives each argument unchanged.  Note that one level of escapes is
-still used by the CMake language processor before add_custom_command
-even sees the arguments.  Use of VERBATIM is recommended as it enables
-correct behavior.  When VERBATIM is not given the behavior is platform
-specific because there is no protection of tool-specific special
-characters.
-
-If the output of the custom command is not actually created as a file
-on disk it should be marked as SYMBOLIC with
-SET_SOURCE_FILES_PROPERTIES.
-
-The IMPLICIT_DEPENDS option requests scanning of implicit dependencies
-of an input file.  The language given specifies the programming
-language whose corresponding dependency scanner should be used.
-Currently only C and CXX language scanners are supported.  The
-language has to be specified for every file in the IMPLICIT_DEPENDS
-list.  Dependencies discovered from the scanning are added to those of
-the custom command at build time.  Note that the IMPLICIT_DEPENDS
-option is currently supported only for Makefile generators and will be
-ignored by other generators.
-
-If COMMAND specifies an executable target (created by ADD_EXECUTABLE)
-it will automatically be replaced by the location of the executable
-created at build time.  Additionally a target-level dependency will be
-added so that the executable target will be built before any target
-using this custom command.  However this does NOT add a file-level
-dependency that would cause the custom command to re-run whenever the
-executable is recompiled.
-
-Arguments to COMMAND may use "generator expressions" with the syntax
-``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual for
-available expressions.
-
-Note that tgt is not added as a dependency of the target this
-expression is evaluated on.
-
-::
-
-  $<TARGET_POLICY:pol>          = '1' if the policy was NEW when the 'head' target was created, else '0'.  If the policy was not set, the warning message for the policy will be emitted.  This generator expression only works for a subset of policies.
-  $<INSTALL_PREFIX>         = Content of the install prefix when the target is exported via INSTALL(EXPORT) and empty otherwise.
-
-Boolean expressions:
-
-::
-
-  $<AND:?[,?]...>           = '1' if all '?' are '1', else '0'
-  $<OR:?[,?]...>            = '0' if all '?' are '0', else '1'
-  $<NOT:?>                  = '0' if '?' is '1', else '1'
-
-where '?' is always either '0' or '1'.
-
-Expressions with an implicit 'this' target:
-
-::
-
-  $<TARGET_PROPERTY:prop>   = The value of the property prop on the target on which the generator expression is evaluated.
-
-References to target names in generator expressions imply target-level
-dependencies, but NOT file-level dependencies.  List target names with
-the DEPENDS option to add file dependencies.
-
-The DEPENDS option specifies files on which the command depends.  If
-any dependency is an OUTPUT of another custom command in the same
-directory (CMakeLists.txt file) CMake automatically brings the other
-custom command into the target in which this command is built.  If
-DEPENDS is not specified the command will run whenever the OUTPUT is
-missing; if the command does not actually create the OUTPUT then the
-rule will always run.  If DEPENDS specifies any target (created by an
-ADD_* command) a target-level dependency is created to make sure the
-target is built before any target using this custom command.
-Additionally, if the target is an executable or library a file-level
-dependency is created to cause the custom command to re-run whenever
-the target is recompiled.
-
-Arguments to ``DEPENDS`` may use "generator expressions" with the syntax
-``$<...>``.  See the :manual:`cmake-generator-expressions(7)` manual for
-available expressions.
+``PRE_BUILD``
+  Run before any other rules are executed within the target.
+  This is supported only on Visual Studio 7 or later.
+  For all other generators ``PRE_BUILD`` will be treated as
+  ``PRE_LINK``.
+``PRE_LINK``
+  Run after sources have been compiled but before linking the binary
+  or running the librarian or archiver tool of a static library.
+  This is not defined for targets created by the
+  :command:`add_custom_target` command.
+``POST_BUILD``
+  Run after all other rules within the target have been executed.
diff --git a/Help/command/add_library.rst b/Help/command/add_library.rst
index e93ef53..f86f3c5 100644
--- a/Help/command/add_library.rst
+++ b/Help/command/add_library.rst
@@ -1,8 +1,15 @@
 add_library
 -----------
 
+.. only:: html
+
+   .. contents::
+
 Add a library to the project using the specified source files.
 
+Normal Libraries
+^^^^^^^^^^^^^^^^
+
 ::
 
   add_library(<name> [STATIC | SHARED | MODULE]
@@ -44,7 +51,8 @@
 manual for available expressions.  See the :manual:`cmake-buildsystem(7)`
 manual for more on defining buildsystem properties.
 
---------------------------------------------------------------------------
+Imported Libraries
+^^^^^^^^^^^^^^^^^^
 
 ::
 
@@ -65,14 +73,15 @@
 location of the main library file on disk.  See documentation of the
 ``IMPORTED_*`` and ``INTERFACE_*`` properties for more information.
 
---------------------------------------------------------------------------
+Object Libraries
+^^^^^^^^^^^^^^^^
 
 ::
 
   add_library(<name> OBJECT <src>...)
 
-Creates a special "object library" target.  An object library compiles
-source files but does not archive or link their object files into a
+Creates an :ref:`Object Library <Object Libraries>`.  An object library
+compiles source files but does not archive or link their object files into a
 library.  Instead other targets created by :command:`add_library` or
 :command:`add_executable` may reference the objects using an expression of the
 form ``$<TARGET_OBJECTS:objlib>`` as a source, where ``objlib`` is the
@@ -85,7 +94,8 @@
 
 will include objlib's object files in a library and an executable
 along with those compiled from their own sources.  Object libraries
-may contain only sources (and headers) that compile to object files.
+may contain only sources that compile, header files, and other files
+that would not affect linking of a normal library (e.g. ``.txt``).
 They may contain custom commands generating such sources, but not
 ``PRE_BUILD``, ``PRE_LINK``, or ``POST_BUILD`` commands.  Object libraries
 cannot be imported, exported, installed, or linked.  Some native build
@@ -93,7 +103,8 @@
 adding at least one real source file to any target that references
 ``$<TARGET_OBJECTS:objlib>``.
 
---------------------------------------------------------------------------
+Alias Libraries
+^^^^^^^^^^^^^^^
 
 ::
 
@@ -111,7 +122,8 @@
 :command:`target_link_libraries` etc.  An ``ALIAS`` target may not be
 installed or exported.
 
---------------------------------------------------------------------------
+Interface Libraries
+^^^^^^^^^^^^^^^^^^^
 
 ::
 
@@ -124,8 +136,9 @@
 the interface target using the :command:`set_property`,
 :command:`target_link_libraries(INTERFACE)`,
 :command:`target_include_directories(INTERFACE)`,
-:command:`target_compile_options(INTERFACE)`
-and :command:`target_compile_definitions(INTERFACE)` commands, and then it
+:command:`target_compile_options(INTERFACE)`,
+:command:`target_compile_definitions(INTERFACE)`,
+and :command:`target_sources(INTERFACE)` commands, and then it
 is used as an argument to :command:`target_link_libraries` like any other
 target.
 
diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index ed801bb..d9b0b78 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -5,7 +5,11 @@
 
 ::
 
-  ctest_submit([PARTS ...] [FILES ...] [RETRY_COUNT count]                [RETRY_DELAY delay][RETURN_VALUE res])
+  ctest_submit([PARTS ...] [FILES ...]
+               [RETRY_COUNT count]
+               [RETRY_DELAY delay]
+               [RETURN_VALUE res]
+               )
 
 By default all available parts are submitted if no PARTS or FILES are
 specified.  The PARTS option lists a subset of parts to be submitted.
diff --git a/Help/command/file.rst b/Help/command/file.rst
index 869350a..dbc4149 100644
--- a/Help/command/file.rst
+++ b/Help/command/file.rst
@@ -64,6 +64,9 @@
 ``REGEX <regex>``
  Consider only strings that match the given regular expression.
 
+``ENCODING <encoding-type>``
+ Consider strings of a given encoding.  "UTF-8" is currently supported.
+
 For example, the code
 
 .. code-block:: cmake
@@ -298,6 +301,7 @@
 permissions, ``PATTERN``, ``REGEX``, and ``EXCLUDE`` options.
 
 The ``INSTALL`` signature differs slightly from ``COPY``: it prints
-status messages, and ``NO_SOURCE_PERMISSIONS`` is default.
+status messages (subject to the :variable:`CMAKE_INSTALL_MESSAGE` variable),
+and ``NO_SOURCE_PERMISSIONS`` is default.
 Installation scripts generated by the :command:`install` command
 use this signature (with some undocumented options for internal use).
diff --git a/Help/command/if.rst b/Help/command/if.rst
index a45b995..79e5d21 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -199,3 +199,9 @@
 * The left and right hand arguments to ``AND`` and ``OR`` are independently
   tested to see if they are boolean constants, if so they are used as
   such, otherwise they are assumed to be variables and are dereferenced.
+
+To prevent ambiguity, potential variable or keyword names can be
+specified in a :ref:`Quoted Argument` or a :ref:`Bracket Argument`.
+A quoted or bracketed variable or keyword will be interpreted as a
+string and not dereferenced or interpreted.
+See policy :policy:`CMP0054`.
diff --git a/Help/command/install.rst b/Help/command/install.rst
index 47108f0..4c52abf 100644
--- a/Help/command/install.rst
+++ b/Help/command/install.rst
@@ -1,8 +1,15 @@
 install
 -------
 
+.. only:: html
+
+   .. contents::
+
 Specify rules to run at install time.
 
+Introduction
+^^^^^^^^^^^^
+
 This command generates installation rules for a project.  Rules
 specified by calls to this command within a source directory are
 executed in order during installation.  The order across directories
@@ -52,7 +59,12 @@
   Specify that it is not an error if the file to be installed does
   not exist.
 
-------------------------------------------------------------------------------
+Command signatures that install files may print messages during
+installation.  Use the :variable:`CMAKE_INSTALL_MESSAGE` variable
+to control which messages are printed.
+
+Installing Targets
+^^^^^^^^^^^^^^^^^^
 
 ::
 
@@ -147,7 +159,8 @@
 Installing a target with the :prop_tgt:`EXCLUDE_FROM_ALL` target property
 set to ``TRUE`` has undefined behavior.
 
-------------------------------------------------------------------------------
+Installing Files
+^^^^^^^^^^^^^^^^
 
 ::
 
@@ -175,14 +188,15 @@
 However, if any item begins in a generator expression it must evaluate
 to a full path.
 
-------------------------------------------------------------------------------
+Installing Directories
+^^^^^^^^^^^^^^^^^^^^^^
 
 ::
 
   install(DIRECTORY dirs... DESTINATION <dir>
           [FILE_PERMISSIONS permissions...]
           [DIRECTORY_PERMISSIONS permissions...]
-          [USE_SOURCE_PERMISSIONS] [OPTIONAL]
+          [USE_SOURCE_PERMISSIONS] [OPTIONAL] [MESSAGE_NEVER]
           [CONFIGURATIONS [Debug|Release|...]]
           [COMPONENT <component>] [FILES_MATCHING]
           [[PATTERN <pattern> | REGEX <regex>]
@@ -205,6 +219,8 @@
 directories will be given the default permissions specified in the
 ``PROGRAMS`` form of the command.
 
+The ``MESSAGE_NEVER`` option disables file installation status output.
+
 Installation of directories may be controlled with fine granularity
 using the ``PATTERN`` or ``REGEX`` options.  These "match" options specify a
 globbing pattern or regular expression to match directories or files
@@ -247,7 +263,8 @@
 file permissions, the scripts will be given specific permissions, and any
 ``CVS`` directories will be excluded.
 
-------------------------------------------------------------------------------
+Custom Installation Logic
+^^^^^^^^^^^^^^^^^^^^^^^^^
 
 ::
 
@@ -266,7 +283,8 @@
 
 will print a message during installation.
 
-------------------------------------------------------------------------------
+Installing Exports
+^^^^^^^^^^^^^^^^^^
 
 ::
 
diff --git a/Help/command/set_tests_properties.rst b/Help/command/set_tests_properties.rst
index 82cd5d8..e29d690 100644
--- a/Help/command/set_tests_properties.rst
+++ b/Help/command/set_tests_properties.rst
@@ -27,7 +27,7 @@
 
 ::
 
-  Example: PASS_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
+  Example: FAIL_REGULAR_EXPRESSION "[^a-z]Error;ERROR;Failed"
 
 Both PASS_REGULAR_EXPRESSION and FAIL_REGULAR_EXPRESSION expect a list
 of regular expressions.
diff --git a/Help/command/string.rst b/Help/command/string.rst
index abde6ee..07d0ff3 100644
--- a/Help/command/string.rst
+++ b/Help/command/string.rst
@@ -36,6 +36,8 @@
   string(TIMESTAMP <output variable> [<format string>] [UTC])
   string(MAKE_C_IDENTIFIER <input string> <output variable>)
   string(GENEX_STRIP <input string> <output variable>)
+  string(UUID <output variable> NAMESPACE <namespace> NAME <name>
+         TYPE <MD5|SHA1> [UPPER])
 
 REGEX MATCH will match the regular expression once and store the match
 in the output variable.
@@ -159,3 +161,13 @@
 ``GENEX_STRIP`` will strip any
 :manual:`generator expressions <cmake-generator-expressions(7)>` from the
 ``input string`` and store the result in the ``output variable``.
+
+UUID creates a univerally unique identifier (aka GUID) as per RFC4122
+based on the hash of the combined values of <namespace>
+(which itself has to be a valid UUID) and <name>.
+The hash algorithm can be either ``MD5`` (Version 3 UUID) or
+``SHA1`` (Version 5 UUID).
+A UUID has the format ``xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx``
+where each `x` represents a lower case hexadecimal character.
+Where required an uppercase representation can be requested
+with the optional ``UPPER`` flag.
diff --git a/Help/command/target_link_libraries.rst b/Help/command/target_link_libraries.rst
index bced169..39537a7 100644
--- a/Help/command/target_link_libraries.rst
+++ b/Help/command/target_link_libraries.rst
@@ -18,7 +18,10 @@
 dependency will automatically be added in the build system to make sure
 the library being linked is up-to-date before the target links. Item names
 starting with ``-``, but not ``-l`` or ``-framework``, are treated as
-linker flags.
+linker flags.  Note that such flags will be treated like any other library
+link item for purposes of transitive dependencies, so they are generally
+safe to specify only as private link items that will not propagate to
+dependents of ``<target>``.
 
 A ``debug``, ``optimized``, or ``general`` keyword indicates that the
 library immediately following it is to be used only for the
diff --git a/Help/command/try_compile.rst b/Help/command/try_compile.rst
index 8ed3cf4..224c67b 100644
--- a/Help/command/try_compile.rst
+++ b/Help/command/try_compile.rst
@@ -36,9 +36,10 @@
 passed to cmake to avoid this clean.  However, multiple sequential
 try_compile operations reuse this single output directory.  If you use
 --debug-trycompile, you can only debug one try_compile call at a time.
-The recommended procedure is to configure with cmake all the way
-through once, then delete the cache entry associated with the
-try_compile call of interest, and then re-run cmake again with
+The recommended procedure is to protect all try_compile calls in your
+project by ``if(NOT DEFINED RESULT_VAR)`` logic, configure with cmake
+all the way through once, then delete the cache entry associated with
+the try_compile call of interest, and then re-run cmake again with
 --debug-trycompile.
 
 Some extra flags that can be included are, INCLUDE_DIRECTORIES,
diff --git a/Help/generator/Visual Studio 10 2010.rst b/Help/generator/Visual Studio 10 2010.rst
index 000677a..77ea9df 100644
--- a/Help/generator/Visual Studio 10 2010.rst
+++ b/Help/generator/Visual Studio 10 2010.rst
@@ -3,10 +3,17 @@
 
 Generates Visual Studio 10 (VS 2010) project files.
 
-It is possible to append a space followed by the platform name to
-create project files for a specific target platform.  E.g.
-"Visual Studio 10 2010 Win64" will create project files for the
-x64 processor; "Visual Studio 10 2010 IA64" for Itanium.
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 10 2010 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 10 2010 IA64``
+  Specify target platform ``Itanium``.
 
 For compatibility with CMake versions prior to 3.0, one may specify this
-generator using the name "Visual Studio 10" without the year component.
+generator using the name ``Visual Studio 10`` without the year component.
diff --git a/Help/generator/Visual Studio 11 2012.rst b/Help/generator/Visual Studio 11 2012.rst
index 42f6f91..5fa7f2c 100644
--- a/Help/generator/Visual Studio 11 2012.rst
+++ b/Help/generator/Visual Studio 11 2012.rst
@@ -3,10 +3,20 @@
 
 Generates Visual Studio 11 (VS 2012) project files.
 
-It is possible to append a space followed by the platform name to
-create project files for a specific target platform.  E.g.
-"Visual Studio 11 2012 Win64" will create project files for the
-x64 processor; "Visual Studio 11 2012 ARM" for ARM.
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 11 2012 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 11 2012 ARM``
+  Specify target platform ``ARM``.
+
+``Visual Studio 11 2012 <WinCE-SDK>``
+  Specify target platform matching a Windows CE SDK name.
 
 For compatibility with CMake versions prior to 3.0, one may specify this
 generator using the name "Visual Studio 11" without the year component.
diff --git a/Help/generator/Visual Studio 12 2013.rst b/Help/generator/Visual Studio 12 2013.rst
index d2f4912..2c3b119 100644
--- a/Help/generator/Visual Studio 12 2013.rst
+++ b/Help/generator/Visual Studio 12 2013.rst
@@ -3,10 +3,17 @@
 
 Generates Visual Studio 12 (VS 2013) project files.
 
-It is possible to append a space followed by the platform name to
-create project files for a specific target platform.  E.g.
-"Visual Studio 12 2013 Win64" will create project files for the
-x64 processor; "Visual Studio 12 2013 ARM" for ARM.
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 12 2013 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 12 2013 ARM``
+  Specify target platform ``ARM``.
 
 For compatibility with CMake versions prior to 3.0, one may specify this
 generator using the name "Visual Studio 12" without the year component.
diff --git a/Help/generator/Visual Studio 14.rst b/Help/generator/Visual Studio 14.rst
new file mode 100644
index 0000000..d621b7e
--- /dev/null
+++ b/Help/generator/Visual Studio 14.rst
@@ -0,0 +1,16 @@
+Visual Studio 14
+----------------
+
+Generates Visual Studio 14 project files.
+
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 14 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 14 ARM``
+  Specify target platform ``ARM``.
diff --git a/Help/generator/Visual Studio 8 2005.rst b/Help/generator/Visual Studio 8 2005.rst
index d7b6de2..29012c3 100644
--- a/Help/generator/Visual Studio 8 2005.rst
+++ b/Help/generator/Visual Studio 8 2005.rst
@@ -3,6 +3,14 @@
 
 Generates Visual Studio 8 2005 project files.
 
-It is possible to append a space followed by the platform name to
-create project files for a specific target platform.  E.g.  "Visual
-Studio 8 2005 Win64" will create project files for the x64 processor.
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 8 2005 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 8 2005 <WinCE-SDK>``
+  Specify target platform matching a Windows CE SDK name.
diff --git a/Help/generator/Visual Studio 9 2008.rst b/Help/generator/Visual Studio 9 2008.rst
index ade9fd5..40471b9 100644
--- a/Help/generator/Visual Studio 9 2008.rst
+++ b/Help/generator/Visual Studio 9 2008.rst
@@ -3,7 +3,17 @@
 
 Generates Visual Studio 9 2008 project files.
 
-It is possible to append a space followed by the platform name to
-create project files for a specific target platform.  E.g.  "Visual
-Studio 9 2008 Win64" will create project files for the x64 processor;
-"Visual Studio 9 2008 IA64" for Itanium.
+The :variable:`CMAKE_GENERATOR_PLATFORM` variable may be set
+to specify a target platform name.
+
+For compatibility with CMake versions prior to 3.1, one may specify
+a target platform name optionally at the end of this generator name:
+
+``Visual Studio 9 2008 Win64``
+  Specify target platform ``x64``.
+
+``Visual Studio 9 2008 IA64``
+  Specify target platform ``Itanium``.
+
+``Visual Studio 9 2008 <WinCE-SDK>``
+  Specify target platform matching a Windows CE SDK name.
diff --git a/Help/manual/OPTIONS_BUILD.txt b/Help/manual/OPTIONS_BUILD.txt
index 2079c44..363d0aa 100644
--- a/Help/manual/OPTIONS_BUILD.txt
+++ b/Help/manual/OPTIONS_BUILD.txt
@@ -51,6 +51,17 @@
 
  See native build system documentation for allowed toolset names.
 
+``-A <platform-name>``
+ Specify platform name if supported by generator.
+
+ Some CMake generators support a platform name to be given to the
+ native build system to choose a compiler or SDK.  This is supported only on
+ specific generators::
+
+   Visual Studio >= 8
+
+ See native build system documentation for allowed platform names.
+
 ``-Wno-dev``
  Suppress developer warnings.
 
diff --git a/Help/manual/cmake-buildsystem.7.rst b/Help/manual/cmake-buildsystem.7.rst
index fdd1be4..1ce9a7e 100644
--- a/Help/manual/cmake-buildsystem.7.rst
+++ b/Help/manual/cmake-buildsystem.7.rst
@@ -19,8 +19,8 @@
 Binary Targets
 ==============
 
-Executables and libraries are defined using the :command:`add_library`
-and :command:`add_executable` commands.  The resulting binary files have
+Executables and libraries are defined using the :command:`add_executable`
+and :command:`add_library` commands.  The resulting binary files have
 appropriate prefixes, suffixes and extensions for the platform targeted.
 Dependencies between binary targets are expressed using the
 :command:`target_link_libraries` command:
@@ -37,9 +37,28 @@
 When linking the ``zipapp`` executable, the ``archive`` static library is
 linked in.
 
+Binary Executables
+------------------
+
+The :command:`add_executable` command defines an executable target:
+
+.. code-block:: cmake
+
+  add_executable(mytool mytool.cpp)
+
+Commands such as :command:`add_custom_command`, which generates rules to be
+run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
+target as a ``COMMAND`` executable.  The buildsystem rules will ensure that
+the executable is built before attempting to run the command.
+
 Binary Library Types
 --------------------
 
+.. _`Normal Libraries`:
+
+Normal Libraries
+^^^^^^^^^^^^^^^^
+
 By default, the :command:`add_library` command defines a static library,
 unless a type is specified.  A type may be specified when using the command:
 
@@ -66,6 +85,11 @@
 
   add_library(archive MODULE 7z.cpp)
 
+.. _`Object Libraries`:
+
+Object Libraries
+^^^^^^^^^^^^^^^^
+
 The ``OBJECT`` library type is also not linked to. It defines a non-archival
 collection of object files resulting from compiling the given source files.
 The object files collection can be used as source inputs to other targets:
@@ -83,10 +107,11 @@
 :command:`target_link_libraries`.  They also may not be used as the ``TARGET``
 in a use of the :command:`add_custom_command(TARGET)` command signature.
 
-Commands such as :command:`add_custom_command`, which generates rules to be
-run at build time can transparently use an :prop_tgt:`EXECUTABLE <TYPE>`
-target as a ``COMMAND`` executable.  The buildsystem rules will ensure that
-the executable is built before attempting to run the command.
+Although object libraries may not be named directly in calls to
+the :command:`target_link_libraries` command, they can be "linked"
+indirectly by using an :ref:`Interface Library <Interface Libraries>`
+whose :prop_tgt:`INTERFACE_SOURCES` target property is set to name
+``$<TARGET_OBJECTS:objlib>``.
 
 Build Specification and Usage Requirements
 ==========================================
@@ -786,11 +811,12 @@
 :prop_tgt:`INTERFACE_COMPILE_DEFINITIONS`,
 :prop_tgt:`INTERFACE_COMPILE_OPTIONS`,
 :prop_tgt:`INTERFACE_LINK_LIBRARIES`, and
+:prop_tgt:`INTERFACE_SOURCES`,
 :prop_tgt:`INTERFACE_POSITION_INDEPENDENT_CODE`.
 Only the ``INTERFACE`` modes of the :command:`target_include_directories`,
 :command:`target_compile_definitions`, :command:`target_compile_options`,
-and :command:`target_link_libraries` commands may be used with ``INTERFACE``
-libraries.
+:command:`target_sources`, and :command:`target_link_libraries` commands
+may be used with ``INTERFACE`` libraries.
 
 A primary use-case for ``INTERFACE`` libraries is header-only libraries.
 
diff --git a/Help/manual/cmake-compile-features.7.rst b/Help/manual/cmake-compile-features.7.rst
index d4bbecc..8e3dbb8 100644
--- a/Help/manual/cmake-compile-features.7.rst
+++ b/Help/manual/cmake-compile-features.7.rst
@@ -166,11 +166,11 @@
     virtual void Execute() = 0;
   };
 
-  struct Concrete Foo_CXX_FINAL {
-    void Execute() Foo_CXX_OVERRIDE;
+  struct Concrete Foo_FINAL {
+    void Execute() Foo_OVERRIDE;
   };
 
-In this case, ``Foo_CXX_FINAL`` will expand to ``final`` if the
+In this case, ``Foo_FINAL`` will expand to ``final`` if the
 compiler supports the keyword, or to empty otherwise.
 
 In this use-case, the CMake code will wish to enable a particular language
@@ -189,13 +189,13 @@
       cxx_final cxx_override
   )
 
-  # Includes foo_compiler_detection.h and uses the Foo_DECL_CXX_FINAL symbol
+  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
   # which will expand to 'final' if the compiler supports the requested
   # CXX_STANDARD.
   add_library(foo foo.cpp)
   set_property(TARGET foo PROPERTY CXX_STANDARD 11)
 
-  # Includes foo_compiler_detection.h and uses the Foo_DECL_CXX_FINAL symbol
+  # Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
   # which will expand to 'final' if the compiler supports the feature,
   # even though CXX_STANDARD is not set explicitly.  The requirement of
   # cxx_constexpr causes CMake to set CXX_STANDARD internally, which
@@ -276,10 +276,13 @@
 .. code-block:: cmake
 
   add_library(foo INTERFACE)
+  set(with_variadics ${CMAKE_CURRENT_SOURCE_DIR}/with_variadics)
+  set(no_variadics ${CMAKE_CURRENT_SOURCE_DIR}/no_variadics)
   target_link_libraries(foo
     INTERFACE
-      "$<$<COMPILE_FEATURES:cxx_variadic_templates>:${CMAKE_CURRENT_SOURCE_DIR}/with_variadics>"
-      "$<$<NOT:$<COMPILE_FEATURES:cxx_variadic_templates>>:${CMAKE_CURRENT_SOURCE_DIR}/no_variadics>")
+      "$<$<COMPILE_FEATURES:cxx_variadic_templates>:${with_variadics}>"
+      "$<$<NOT:$<COMPILE_FEATURES:cxx_variadic_templates>>:${no_variadics}>"
+    )
 
 Consuming code then simply links to the ``foo`` target as usual and uses
 the feature-appropriate include directory
diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst
index 9851c12..eea5fc3 100644
--- a/Help/manual/cmake-developer.7.rst
+++ b/Help/manual/cmake-developer.7.rst
@@ -188,8 +188,8 @@
 
 Various implementations have differing implementation of ``size_t``.  When
 assigning the result of ``.size()`` on a container for example, the result
-should not be assigned to an ``unsigned int`` or similar. ``std::size_t`` must
-not be used.
+should be assigned to ``size_t`` not to ``std::size_t``, ``unsigned int`` or
+similar types.
 
 Templates
 ---------
@@ -521,14 +521,15 @@
 Command signatures should be marked up as plain literal blocks, not as
 cmake ``code-blocks``.
 
-Signatures are separated from preceding content by a horizontal
-line. That is, use:
+Signatures are separated from preceding content by a section header.
+That is, use:
 
 .. code-block:: rst
 
   ... preceding paragraph.
 
-  ---------------------------------------------------------------------
+  Normal Libraries
+  ^^^^^^^^^^^^^^^^
 
   ::
 
@@ -1004,7 +1005,8 @@
 .. code-block:: cmake
 
   if(CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.0.0)
-    message(AUTHOR_WARNING "Your project should require at least CMake 3.0.0 to use FindFoo.cmake")
+    message(AUTHOR_WARNING
+      "Your project should require at least CMake 3.0.0 to use FindFoo.cmake")
   endif()
 
 Now the actual libraries and so on have to be found.  The code here will
diff --git a/Help/manual/cmake-generator-expressions.7.rst b/Help/manual/cmake-generator-expressions.7.rst
index f04702e..981bd84 100644
--- a/Help/manual/cmake-generator-expressions.7.rst
+++ b/Help/manual/cmake-generator-expressions.7.rst
@@ -38,6 +38,8 @@
 expands to ``DEBUG_MODE`` when the ``Debug`` configuration is used, and
 otherwise expands to nothing.
 
+Available logical expressions are:
+
 ``$<0:...>``
   Empty string (ignores ``...``)
 ``$<1:...>``
@@ -111,20 +113,27 @@
 :variable:`CMAKE_CXX_COMPILER_VERSION <CMAKE_<LANG>_COMPILER_VERSION>` is less
 than 4.2.0.
 
+Available informational expressions are:
+
 ``$<CONFIGURATION>``
   Configuration name. Deprecated. Use ``CONFIG`` instead.
 ``$<CONFIG>``
   Configuration name
 ``$<PLATFORM_ID>``
-  The CMake-id of the platform
+  The CMake-id of the platform.
+  See also the :variable:`CMAKE_SYSTEM_NAME` variable.
 ``$<C_COMPILER_ID>``
   The CMake-id of the C compiler used.
+  See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
 ``$<CXX_COMPILER_ID>``
   The CMake-id of the CXX compiler used.
+  See also the :variable:`CMAKE_<LANG>_COMPILER_ID` variable.
 ``$<C_COMPILER_VERSION>``
   The version of the C compiler used.
+  See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
 ``$<CXX_COMPILER_VERSION>``
   The version of the CXX compiler used.
+  See also the :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable.
 ``$<TARGET_FILE:tgt>``
   Full path to main file (.exe, .so.1.2, .a) where ``tgt`` is the name of a target.
 ``$<TARGET_FILE_NAME:tgt>``
@@ -143,6 +152,17 @@
   Name of file with soname (.so.3).
 ``$<TARGET_SONAME_FILE_DIR:tgt>``
   Directory of with soname (.so.3).
+``$<TARGET_PDB_FILE:tgt>``
+  Full path to the linker generated program database file (.pdb)
+  where ``tgt`` is the name of a target.
+
+  See also the :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
+  target properties and their configuration specific variants
+  :prop_tgt:`PDB_NAME_<CONFIG>` and :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`.
+``$<TARGET_PDB_FILE_NAME:tgt>``
+  Name of the linker generated program database file (.pdb).
+``$<TARGET_PDB_FILE_DIR:tgt>``
+  Directory of the linker generated program database file (.pdb).
 ``$<TARGET_PROPERTY:tgt,prop>``
   Value of the property ``prop`` on the target ``tgt``.
 
@@ -169,7 +189,13 @@
 in this situation would require first checking if the INCLUDE_DIRECTORIES
 property is non-empty::
 
-  $<$<BOOL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>>:-I$<JOIN:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>, -I>>
+  $<$<BOOL:${prop}>:-I$<JOIN:${prop}, -I>>
+
+where ``${prop}`` refers to a helper variable::
+
+  set(prop "$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>")
+
+Available output expressions are:
 
 ``$<JOIN:list,...>``
   Joins the list with the content of ``...``
@@ -183,6 +209,13 @@
   Marks ``...`` as being the name of a target.  This is required if exporting
   targets to multiple dependent export sets.  The ``...`` must be a literal
   name of a target- it may not contain generator expressions.
+``$<LINK_ONLY:...>``
+  Content of ``...`` except when evaluated in a link interface while
+  propagating :ref:`Target Usage Requirements`, in which case it is the
+  empty string.
+  Intended for use only in an :prop_tgt:`INTERFACE_LINK_LIBRARIES` target
+  property, perhaps via the :command:`target_link_libraries` command,
+  to specify private link dependencies without other usage requirements.
 ``$<INSTALL_INTERFACE:...>``
   Content of ``...`` when the property is exported using :command:`install(EXPORT)`,
   and empty otherwise.
diff --git a/Help/manual/cmake-generators.7.rst b/Help/manual/cmake-generators.7.rst
index 8d0c704..7f5093f 100644
--- a/Help/manual/cmake-generators.7.rst
+++ b/Help/manual/cmake-generators.7.rst
@@ -64,6 +64,7 @@
    /generator/Visual Studio 10 2010
    /generator/Visual Studio 11 2012
    /generator/Visual Studio 12 2013
+   /generator/Visual Studio 14
    /generator/Xcode
 
 Extra Generators
diff --git a/Help/manual/cmake-modules.7.rst b/Help/manual/cmake-modules.7.rst
index ecc9cc4..61e4bb4 100644
--- a/Help/manual/cmake-modules.7.rst
+++ b/Help/manual/cmake-modules.7.rst
@@ -23,6 +23,7 @@
    /module/CheckCXXSourceRuns
    /module/CheckCXXSymbolExists
    /module/CheckFortranFunctionExists
+   /module/CheckFortranSourceCompiles
    /module/CheckFunctionExists
    /module/CheckIncludeFileCXX
    /module/CheckIncludeFile
@@ -55,6 +56,7 @@
    /module/CPackCygwin
    /module/CPackDeb
    /module/CPackDMG
+   /module/CPackIFW
    /module/CPackNSIS
    /module/CPackPackageMaker
    /module/CPackRPM
@@ -113,6 +115,7 @@
    /module/FindHg
    /module/FindHSPELL
    /module/FindHTMLHelp
+   /module/FindIce
    /module/FindIcotool
    /module/FindImageMagick
    /module/FindITK
@@ -205,6 +208,7 @@
    /module/FindWish
    /module/FindwxWidgets
    /module/FindwxWindows
+   /module/FindXerces
    /module/FindX11
    /module/FindXMLRPC
    /module/FindZLIB
diff --git a/Help/manual/cmake-policies.7.rst b/Help/manual/cmake-policies.7.rst
index 136cf5c..f1717a0 100644
--- a/Help/manual/cmake-policies.7.rst
+++ b/Help/manual/cmake-policies.7.rst
@@ -105,3 +105,4 @@
    /policy/CMP0051
    /policy/CMP0052
    /policy/CMP0053
+   /policy/CMP0054
diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst
index e4546c1..38bcd04 100644
--- a/Help/manual/cmake-properties.7.rst
+++ b/Help/manual/cmake-properties.7.rst
@@ -51,7 +51,6 @@
    /prop_dir/CACHE_VARIABLES
    /prop_dir/CLEAN_NO_CUSTOM
    /prop_dir/CMAKE_CONFIGURE_DEPENDS
-   /prop_dir/COMPILE_DEFINITIONS_CONFIG
    /prop_dir/COMPILE_DEFINITIONS
    /prop_dir/COMPILE_OPTIONS
    /prop_dir/DEFINITIONS
@@ -80,6 +79,8 @@
    :maxdepth: 1
 
    /prop_tgt/ALIASED_TARGET
+   /prop_tgt/ANDROID_API
+   /prop_tgt/ANDROID_GUI
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
    /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY
    /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG
@@ -101,7 +102,6 @@
    /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MAX
    /prop_tgt/COMPATIBLE_INTERFACE_NUMBER_MIN
    /prop_tgt/COMPATIBLE_INTERFACE_STRING
-   /prop_tgt/COMPILE_DEFINITIONS_CONFIG
    /prop_tgt/COMPILE_DEFINITIONS
    /prop_tgt/COMPILE_FEATURES
    /prop_tgt/COMPILE_FLAGS
@@ -205,9 +205,7 @@
    /prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG
    /prop_tgt/PDB_OUTPUT_DIRECTORY
    /prop_tgt/POSITION_INDEPENDENT_CODE
-   /prop_tgt/POST_INSTALL_SCRIPT
    /prop_tgt/PREFIX
-   /prop_tgt/PRE_INSTALL_SCRIPT
    /prop_tgt/PRIVATE_HEADER
    /prop_tgt/PROJECT_LABEL
    /prop_tgt/PUBLIC_HEADER
@@ -239,6 +237,7 @@
    /prop_tgt/VS_SCC_LOCALPATH
    /prop_tgt/VS_SCC_PROJECTNAME
    /prop_tgt/VS_SCC_PROVIDER
+   /prop_tgt/VS_WINRT_COMPONENT
    /prop_tgt/VS_WINRT_EXTENSIONS
    /prop_tgt/VS_WINRT_REFERENCES
    /prop_tgt/WIN32_EXECUTABLE
@@ -277,7 +276,6 @@
    /prop_sf/ABSTRACT
    /prop_sf/AUTOUIC_OPTIONS
    /prop_sf/AUTORCC_OPTIONS
-   /prop_sf/COMPILE_DEFINITIONS_CONFIG
    /prop_sf/COMPILE_DEFINITIONS
    /prop_sf/COMPILE_FLAGS
    /prop_sf/EXTERNAL_OBJECT
@@ -292,6 +290,8 @@
    /prop_sf/OBJECT_DEPENDS
    /prop_sf/OBJECT_OUTPUTS
    /prop_sf/SYMBOLIC
+   /prop_sf/VS_DEPLOYMENT_CONTENT
+   /prop_sf/VS_SHADER_TYPE
    /prop_sf/WRAP_EXCLUDE
    /prop_sf/XCODE_EXPLICIT_FILE_TYPE
    /prop_sf/XCODE_LAST_KNOWN_FILE_TYPE
@@ -317,3 +317,33 @@
 
    /prop_inst/CPACK_NEVER_OVERWRITE.rst
    /prop_inst/CPACK_PERMANENT.rst
+   /prop_inst/CPACK_WIX_ACL.rst
+
+
+Deprecated Properties on Directories
+=====================================
+
+.. toctree::
+   :maxdepth: 1
+
+   /prop_dir/COMPILE_DEFINITIONS_CONFIG
+
+
+Deprecated Properties on Targets
+================================
+
+.. toctree::
+   :maxdepth: 1
+
+   /prop_tgt/COMPILE_DEFINITIONS_CONFIG
+   /prop_tgt/POST_INSTALL_SCRIPT
+   /prop_tgt/PRE_INSTALL_SCRIPT
+
+
+Deprecated Properties on Source Files
+=====================================
+
+.. toctree::
+   :maxdepth: 1
+
+   /prop_sf/COMPILE_DEFINITIONS_CONFIG
diff --git a/Help/manual/cmake-toolchains.7.rst b/Help/manual/cmake-toolchains.7.rst
index f36a43c..fad5481 100644
--- a/Help/manual/cmake-toolchains.7.rst
+++ b/Help/manual/cmake-toolchains.7.rst
@@ -97,18 +97,27 @@
 
 If :manual:`cmake(1)` is invoked with the command line parameter
 ``-DCMAKE_TOOLCHAIN_FILE=path/to/file``, the file will be loaded early to set
-values for the compilers. A typical cross-compiling toolchain has content such
+values for the compilers.
+The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is
+cross-compiling.
+
+Cross Compiling for Linux
+-------------------------
+
+A typical cross-compiling toolchain for Linux has content such
 as:
 
 .. code-block:: cmake
 
   set(CMAKE_SYSTEM_NAME Linux)
+  set(CMAKE_SYSTEM_PROCESSOR arm)
 
   set(CMAKE_SYSROOT /home/devel/rasp-pi-rootfs)
   set(CMAKE_STAGING_PREFIX /home/devel/stage)
 
-  set(CMAKE_C_COMPILER /home/devel/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc)
-  set(CMAKE_CXX_COMPILER /home/devel/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++)
+  set(tools /home/devel/gcc-4.7-linaro-rpi-gnueabihf)
+  set(CMAKE_C_COMPILER ${tools}/bin/arm-linux-gnueabihf-gcc)
+  set(CMAKE_CXX_COMPILER ${tools}/bin/arm-linux-gnueabihf-g++)
 
   set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
   set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
@@ -118,6 +127,9 @@
 The :variable:`CMAKE_SYSTEM_NAME` is the CMake-identifier of the target platform
 to build for.
 
+The :variable:`CMAKE_SYSTEM_PROCESSOR` is the CMake-identifier of the target architecture
+to build for.
+
 The :variable:`CMAKE_SYSROOT` is optional, and may be specified if a sysroot
 is available.
 
@@ -139,13 +151,17 @@
 should be found only on the host and not on the target. This is the purpose of
 the ``CMAKE_FIND_ROOT_PATH_MODE_*`` variables.
 
-Some compilers are inherently cross compilers, such as Clang and the QNX QCC
-compiler. The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
+Cross Compiling using Clang
+---------------------------
+
+Some compilers such as Clang are inherently cross compilers.
+The :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
 value to those supported compilers when compiling:
 
 .. code-block:: cmake
 
   set(CMAKE_SYSTEM_NAME Linux)
+  set(CMAKE_SYSTEM_PROCESSOR arm)
 
   set(triple arm-linux-gnueabihf)
 
@@ -154,7 +170,18 @@
   set(CMAKE_CXX_COMPILER clang++)
   set(CMAKE_CXX_COMPILER_TARGET ${triple})
 
-Or, for QCC:
+Similarly, some compilers do not ship their own supplementary utilities
+such as linkers, but provide a way to specify the location of the external
+toolchain which will be used by the compiler driver. The
+:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a
+toolchain file to pass the path to the compiler driver.
+
+Cross Compiling for QNX
+-----------------------
+
+As the Clang compiler the QNX QCC compile is inherently a cross compiler.
+And the :variable:`CMAKE_<LANG>_COMPILER_TARGET` can be set to pass a
+value to those supported compilers when compiling:
 
 .. code-block:: cmake
 
@@ -167,12 +194,50 @@
   set(CMAKE_CXX_COMPILER QCC)
   set(CMAKE_CXX_COMPILER_TARGET ${arch})
 
+Cross Compiling for Windows CE
+------------------------------
 
-Similarly, some compilers do not ship their own supplementary utilities
-such as linkers, but provide a way to specify the location of the external
-toolchain which will be used by the compiler driver. The
-:variable:`CMAKE_<LANG>_COMPILER_EXTERNAL_TOOLCHAIN` variable can be set in a
-toolchain file to pass the path to the compiler driver.
+Cross compiling for Windows CE requires the corresponding SDK being
+installed on your system.  These SDKs are usually installed under
+``C:/Program Files (x86)/Windows CE Tools/SDKs``.
 
-The :variable:`CMAKE_CROSSCOMPILING` variable is set to true when CMake is
-cross-compiling.
+A toolchain file to configure a Visual Studio generator for
+Windows CE may look like this:
+
+.. code-block:: cmake
+
+  set(CMAKE_SYSTEM_NAME WindowsCE)
+
+  set(CMAKE_SYSTEM_VERSION 8.0)
+  set(CMAKE_SYSTEM_PROCESSOR arm)
+
+  set(CMAKE_GENERATOR_TOOLSET CE800) # Can be omitted for 8.0
+  set(CMAKE_GENERATOR_PLATFORM SDK_AM335X_SK_WEC2013_V310)
+
+The :variable:`CMAKE_GENERATOR_PLATFORM` tells the generator which SDK to use.
+Further :variable:`CMAKE_SYSTEM_VERSION` tells the generator what version of
+Windows CE to use.  Currently version 8.0 (Windows Embedded Compact 2013) is
+supported out of the box.  Other versions may require one to set
+:variable:`CMAKE_GENERATOR_TOOLSET` to the correct value.
+
+Cross Compiling for Windows Phone
+---------------------------------
+
+A toolchain file to configure a Visual Studio generator for
+Windows Phone may look like this:
+
+.. code-block:: cmake
+
+  set(CMAKE_SYSTEM_NAME WindowsPhone)
+  set(CMAKE_SYSTEM_VERSION 8.1)
+
+Cross Compiling for Windows Store
+---------------------------------
+
+A toolchain file to configure a Visual Studio generator for
+Windows Store may look like this:
+
+.. code-block:: cmake
+
+  set(CMAKE_SYSTEM_NAME WindowsStore)
+  set(CMAKE_SYSTEM_VERSION 8.1)
diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst
index df434c5..1deb8bb 100644
--- a/Help/manual/cmake-variables.7.rst
+++ b/Help/manual/cmake-variables.7.rst
@@ -37,6 +37,7 @@
    /variable/CMAKE_EXTRA_GENERATOR
    /variable/CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES
    /variable/CMAKE_GENERATOR
+   /variable/CMAKE_GENERATOR_PLATFORM
    /variable/CMAKE_GENERATOR_TOOLSET
    /variable/CMAKE_HOME_DIRECTORY
    /variable/CMAKE_IMPORT_LIBRARY_PREFIX
@@ -73,6 +74,8 @@
    /variable/CMAKE_VS_INTEL_Fortran_PROJECT_VERSION
    /variable/CMAKE_VS_MSBUILD_COMMAND
    /variable/CMAKE_VS_MSDEV_COMMAND
+   /variable/CMAKE_VS_NsightTegra_VERSION
+   /variable/CMAKE_VS_PLATFORM_NAME
    /variable/CMAKE_VS_PLATFORM_TOOLSET
    /variable/CMAKE_XCODE_PLATFORM_TOOLSET
    /variable/PROJECT_BINARY_DIR
@@ -128,6 +131,7 @@
    /variable/CMAKE_INCLUDE_DIRECTORIES_BEFORE
    /variable/CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE
    /variable/CMAKE_INSTALL_DEFAULT_COMPONENT_NAME
+   /variable/CMAKE_INSTALL_MESSAGE
    /variable/CMAKE_INSTALL_PREFIX
    /variable/CMAKE_LIBRARY_PATH
    /variable/CMAKE_MFC_FLAG
@@ -178,6 +182,7 @@
    /variable/MSVC10
    /variable/MSVC11
    /variable/MSVC12
+   /variable/MSVC14
    /variable/MSVC60
    /variable/MSVC70
    /variable/MSVC71
@@ -188,6 +193,9 @@
    /variable/MSVC_VERSION
    /variable/UNIX
    /variable/WIN32
+   /variable/WINCE
+   /variable/WINDOWS_PHONE
+   /variable/WINDOWS_STORE
    /variable/XCODE_VERSION
 
 Variables that Control the Build
@@ -196,6 +204,8 @@
 .. toctree::
    :maxdepth: 1
 
+   /variable/CMAKE_ANDROID_API
+   /variable/CMAKE_ANDROID_GUI
    /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
    /variable/CMAKE_AUTOMOC_MOC_OPTIONS
    /variable/CMAKE_AUTOMOC
@@ -250,6 +260,7 @@
    /variable/CMAKE_USE_RELATIVE_PATHS
    /variable/CMAKE_VISIBILITY_INLINES_HIDDEN
    /variable/CMAKE_WIN32_EXECUTABLE
+   /variable/CMAKE_XCODE_ATTRIBUTE_an-attribute
    /variable/EXECUTABLE_OUTPUT_PATH
    /variable/LIBRARY_OUTPUT_PATH
 
@@ -341,7 +352,9 @@
    /variable/CTEST_HG_UPDATE_OPTIONS
    /variable/CTEST_MEMORYCHECK_COMMAND
    /variable/CTEST_MEMORYCHECK_COMMAND_OPTIONS
+   /variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS
    /variable/CTEST_MEMORYCHECK_SUPPRESSIONS_FILE
+   /variable/CTEST_MEMORYCHECK_TYPE
    /variable/CTEST_NIGHTLY_START_TIME
    /variable/CTEST_P4_CLIENT
    /variable/CTEST_P4_COMMAND
@@ -357,6 +370,7 @@
    /variable/CTEST_TRIGGER_SITE
    /variable/CTEST_UPDATE_COMMAND
    /variable/CTEST_UPDATE_OPTIONS
+   /variable/CTEST_UPDATE_VERSION_ONLY
    /variable/CTEST_USE_LAUNCHERS
 
 Variables for CPack
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst
index 5743ab7..8dfc16a 100644
--- a/Help/manual/cmake.1.rst
+++ b/Help/manual/cmake.1.rst
@@ -38,7 +38,7 @@
  For true platform independence, CMake provides a list of commands
  that can be used on all systems.  Run with -E help for the usage
  information.  Commands available are: chdir, compare_files, copy,
- copy_directory, copy_if_different, echo, echo_append, environment,
+ copy_directory, copy_if_different, echo, echo_append, env, environment,
  make_directory, md5sum, remove, remove_directory, rename, sleep, tar, time,
  touch, touch_nocreate.  In addition, some platform specific commands
  are available.  On Windows: delete_regv, write_regv.  On
diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst
index a57a8f0..03e86af 100644
--- a/Help/manual/ctest.1.rst
+++ b/Help/manual/ctest.1.rst
@@ -111,7 +111,7 @@
 ``-D <dashboard>, --dashboard <dashboard>``
  Execute dashboard test
 
- This option tells ctest to act as a Dart client and perform a
+ This option tells ctest to act as a CDash client and perform a
  dashboard test.  All tests are <Mode><Test>, where Mode can be
  Experimental, Nightly, and Continuous, and Test can be Start,
  Update, Configure, Build, Test, Coverage, and Submit.
@@ -127,14 +127,14 @@
 ``-M <model>, --test-model <model>``
  Sets the model for a dashboard
 
- This option tells ctest to act as a Dart client where the TestModel
+ This option tells ctest to act as a CDash client where the TestModel
  can be Experimental, Nightly, and Continuous.  Combining -M and -T
  is similar to -D
 
 ``-T <action>, --test-action <action>``
  Sets the dashboard action to perform
 
- This option tells ctest to act as a Dart client and perform some
+ This option tells ctest to act as a CDash client and perform some
  action such as start, build, test etc.  Combining -M and -T is
  similar to -D
 
@@ -258,6 +258,9 @@
 ``--build-generator``
  Specify the generator to use.
 
+``--build-generator-platform``
+ Specify the generator-specific platform.
+
 ``--build-generator-toolset``
  Specify the generator-specific toolset.
 
@@ -325,11 +328,8 @@
  used to detect implicit dependencies in a test suite.
 
 ``--submit-index``
- Submit individual dashboard tests with specific index
-
- This option allows performing the same CTest action (such as test)
- multiple times and submit all stages to the same dashboard (Dart2
- required).  Each execution requires different index.
+ Legacy option for old Dart2 dashboard server feature.
+ Do not use.
 
 ``--timeout <seconds>``
  Set a global timeout on all tests.
@@ -668,6 +668,15 @@
   * :module:`CTest` module variable: ``UPDATE_TYPE`` if set,
     else ``CTEST_UPDATE_TYPE``
 
+``UpdateVersionOnly``
+  Specify that you want the version control update command to only
+  discover the current version that is checked out, and not to update
+  to a different version.
+
+  * `CTest Script`_ variable: :variable:`CTEST_UPDATE_VERSION_ONLY`
+
+
+
 Additional configuration settings include:
 
 ``NightlyStartTime``
@@ -812,6 +821,18 @@
   * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_COMMAND_OPTIONS`
   * :module:`CTest` module variable: ``MEMORYCHECK_COMMAND_OPTIONS``
 
+``MemoryCheckType``
+  Specify the type of memory checking to perform.
+
+  * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_TYPE`
+  * :module:`CTest` module variable: ``MEMORYCHECK_TYPE``
+
+``MemoryCheckSanitizerOptions``
+  Specify options to sanitizers when running with a sanitize-enabled build.
+
+  * `CTest Script`_ variable: :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS`
+  * :module:`CTest` module variable: ``MEMORYCHECK_SANITIZER_OPTIONS``
+
 ``MemoryCheckSuppressionFile``
   Specify a file containing suppression rules for the
   ``MemoryCheckCommand`` tool.  It will be passed with options
diff --git a/Help/module/CPackIFW.rst b/Help/module/CPackIFW.rst
new file mode 100644
index 0000000..ea05796
--- /dev/null
+++ b/Help/module/CPackIFW.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/CPackIFW.cmake
diff --git a/Help/module/CheckFortranSourceCompiles.rst b/Help/module/CheckFortranSourceCompiles.rst
new file mode 100644
index 0000000..b749a2a
--- /dev/null
+++ b/Help/module/CheckFortranSourceCompiles.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/CheckFortranSourceCompiles.cmake
diff --git a/Help/module/FindITK.rst b/Help/module/FindITK.rst
index dbfabbd..21a922f 100644
--- a/Help/module/FindITK.rst
+++ b/Help/module/FindITK.rst
@@ -1 +1,10 @@
-.. cmake-module:: ../../Modules/FindITK.cmake
+FindITK
+-------
+
+This module no longer exists.
+
+This module existed in versions of CMake prior to 3.1, but became
+only a thin wrapper around ``find_package(ITK NO_MODULE)`` to
+provide compatibility for projects using long-outdated conventions.
+Now ``find_package(ITK)`` will search for ``ITKConfig.cmake``
+directly.
diff --git a/Help/module/FindIce.rst b/Help/module/FindIce.rst
new file mode 100644
index 0000000..3af9405
--- /dev/null
+++ b/Help/module/FindIce.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindIce.cmake
diff --git a/Help/module/FindVTK.rst b/Help/module/FindVTK.rst
index f9c1efe..3bc67c5 100644
--- a/Help/module/FindVTK.rst
+++ b/Help/module/FindVTK.rst
@@ -1 +1,10 @@
-.. cmake-module:: ../../Modules/FindVTK.cmake
+FindVTK
+-------
+
+This module no longer exists.
+
+This module existed in versions of CMake prior to 3.1, but became
+only a thin wrapper around ``find_package(VTK NO_MODULE)`` to
+provide compatibility for projects using long-outdated conventions.
+Now ``find_package(VTK)`` will search for ``VTKConfig.cmake``
+directly.
diff --git a/Help/module/FindXerces.rst b/Help/module/FindXerces.rst
new file mode 100644
index 0000000..166d8dd
--- /dev/null
+++ b/Help/module/FindXerces.rst
@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindXerces.cmake
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index 16a5bc3..22c7c4f 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -22,7 +22,7 @@
 target_link_libraries command will no longer populate the properties
 matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy is NEW.
 
-Warning-free future-compatible code which works with CMake 2.8.9 onwards
+Warning-free future-compatible code which works with CMake 2.8.7 onwards
 can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
 of :command:`target_link_libraries`.
 
diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst
new file mode 100644
index 0000000..dffee5e
--- /dev/null
+++ b/Help/policy/CMP0054.rst
@@ -0,0 +1,18 @@
+CMP0054
+-------
+
+Only interpret :command:`if` arguments as variables or keywords when unquoted.
+
+CMake 3.1 and above no longer dereference variables or interpret keywords
+in an :command:`if` command argument when it is a :ref:`Quoted Argument`
+or a :ref:`Bracket Argument`.
+
+The ``OLD`` behavior for this policy is to dereference variables and
+interpret keywords even if they are quoted or bracketed.
+The ``NEW`` behavior is to not dereference variables or interpret keywords
+that have been quoted or bracketed.
+
+This policy was introduced in CMake version 3.1.
+CMake version |release| warns when the policy is not set and uses
+``OLD`` behavior.  Use the :command:`cmake_policy` command to set
+it to ``OLD`` or ``NEW`` explicitly.
diff --git a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst
index c22606b..a6af45f 100644
--- a/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst
+++ b/Help/prop_dir/COMPILE_DEFINITIONS_CONFIG.rst
@@ -1,6 +1,8 @@
 COMPILE_DEFINITIONS_<CONFIG>
 ----------------------------
 
+Ignored.  See CMake Policy :policy:`CMP0043`.
+
 Per-configuration preprocessor definitions in a directory.
 
 This is the configuration-specific version of :prop_dir:`COMPILE_DEFINITIONS`
diff --git a/Help/prop_inst/CPACK_WIX_ACL.rst b/Help/prop_inst/CPACK_WIX_ACL.rst
new file mode 100644
index 0000000..4e13ec4
--- /dev/null
+++ b/Help/prop_inst/CPACK_WIX_ACL.rst
@@ -0,0 +1,19 @@
+CPACK_WIX_ACL
+-------------
+
+Specifies access permissions for files or directories
+installed by a WiX installer.
+
+The property can contain multiple list entries,
+each of which has to match the following format.
+
+::
+
+  <user>[@<domain>]=<permission>[,<permission>]
+
+``<user>`` and ``<domain>`` specify the windows user and domain for which the
+``<Permission>`` element should be generated.
+
+``<permission>`` is any of the YesNoType attributes listed here::
+
+ http://wixtoolset.org/documentation/manual/v3/xsd/wix/permission.html
diff --git a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
index e695f38..8487076 100644
--- a/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
+++ b/Help/prop_sf/COMPILE_DEFINITIONS_CONFIG.rst
@@ -1,6 +1,8 @@
 COMPILE_DEFINITIONS_<CONFIG>
 ----------------------------
 
+Ignored.  See CMake Policy :policy:`CMP0043`.
+
 Per-configuration preprocessor definitions on a source file.
 
 This is the configuration-specific version of COMPILE_DEFINITIONS.
diff --git a/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst
new file mode 100644
index 0000000..9fb3ba3
--- /dev/null
+++ b/Help/prop_sf/VS_DEPLOYMENT_CONTENT.rst
@@ -0,0 +1,11 @@
+VS_DEPLOYMENT_CONTENT
+---------------------
+
+Mark a source file as content for deployment with a Windows Phone or
+Windows Store application when built with a Visual Studio generator.
+The value must evaluate to either ``1`` or ``0`` and may use
+:manual:`generator expressions <cmake-generator-expressions(7)>`
+to make the choice based on the build configuration.
+The ``.vcxproj`` file entry for the source file will be
+marked either ``DeploymentContent`` or ``ExcludedFromBuild``
+for values ``1`` and ``0``, respectively.
diff --git a/Help/prop_sf/VS_SHADER_TYPE.rst b/Help/prop_sf/VS_SHADER_TYPE.rst
new file mode 100644
index 0000000..6880256
--- /dev/null
+++ b/Help/prop_sf/VS_SHADER_TYPE.rst
@@ -0,0 +1,4 @@
+VS_SHADER_TYPE
+--------------
+
+Set the VS shader type of a ``.hlsl`` source file.
diff --git a/Help/prop_tgt/ANDROID_API.rst b/Help/prop_tgt/ANDROID_API.rst
new file mode 100644
index 0000000..714ad58
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_API.rst
@@ -0,0 +1,7 @@
+ANDROID_API
+-----------
+
+Set the Android Target API version (e.g. ``15``).  The version number
+must be a positive decimal integer.  This property is initialized by
+the value of the :variable:`CMAKE_ANDROID_API` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/ANDROID_GUI.rst b/Help/prop_tgt/ANDROID_GUI.rst
new file mode 100644
index 0000000..90d2428
--- /dev/null
+++ b/Help/prop_tgt/ANDROID_GUI.rst
@@ -0,0 +1,9 @@
+ANDROID_GUI
+-----------
+
+Build an executable as an application package on Android.
+
+When this property is set to true the executable when built for Android
+will be created as an application package.  This property is initialized
+by the value of the :variable:`CMAKE_ANDROID_GUI` variable if it is set
+when a target is created.
diff --git a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst
index e359d2c..84bd5e4 100644
--- a/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst
+++ b/Help/prop_tgt/COMPILE_DEFINITIONS_CONFIG.rst
@@ -1,6 +1,8 @@
 COMPILE_DEFINITIONS_<CONFIG>
 ----------------------------
 
+Ignored.  See CMake Policy :policy:`CMP0043`.
+
 Per-configuration preprocessor definitions on a target.
 
 This is the configuration-specific version of :prop_tgt:`COMPILE_DEFINITIONS`
diff --git a/Help/prop_tgt/VS_WINRT_COMPONENT.rst b/Help/prop_tgt/VS_WINRT_COMPONENT.rst
new file mode 100644
index 0000000..e160bd6
--- /dev/null
+++ b/Help/prop_tgt/VS_WINRT_COMPONENT.rst
@@ -0,0 +1,11 @@
+VS_WINRT_COMPONENT
+------------------
+
+Mark a target as a Windows Runtime component for the Visual Studio generator.
+Compile the target with ``C++/CX`` language extensions for Windows Runtime.
+For ``SHARED`` and ``MODULE`` libraries, this also defines the
+``_WINRT_DLL`` preprocessor macro.
+
+.. note::
+  Currently this is implemented only by Visual Studio generators.
+  Support may be added to other generators in the future.
diff --git a/Help/prop_tgt/VS_WINRT_EXTENSIONS.rst b/Help/prop_tgt/VS_WINRT_EXTENSIONS.rst
index cc6fb16..d1cba34 100644
--- a/Help/prop_tgt/VS_WINRT_EXTENSIONS.rst
+++ b/Help/prop_tgt/VS_WINRT_EXTENSIONS.rst
@@ -1,6 +1,5 @@
 VS_WINRT_EXTENSIONS
 -------------------
 
-Visual Studio project C++/CX language extensions for Windows Runtime
-
-Can be set to enable C++/CX language extensions.
+Deprecated.  Use :prop_tgt:`VS_WINRT_COMPONENT` instead.
+This property was an experimental partial implementation of that one.
diff --git a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
index 0be313c..de98c37 100644
--- a/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
+++ b/Help/prop_tgt/XCODE_ATTRIBUTE_an-attribute.rst
@@ -5,3 +5,6 @@
 
 Tell the Xcode generator to set '<an-attribute>' to a given value in
 the generated Xcode project.  Ignored on other generators.
+
+See the :variable:`CMAKE_XCODE_ATTRIBUTE_<an-attribute>` variable
+to set attributes on all targets in a directory tree.
diff --git a/Help/release/3.1.0.rst b/Help/release/3.1.0.rst
new file mode 100644
index 0000000..652bcd3
--- /dev/null
+++ b/Help/release/3.1.0.rst
@@ -0,0 +1,381 @@
+CMake 3.1.0 Release Notes
+*************************
+
+.. only:: html
+
+  .. contents::
+
+Changes made since CMake 3.0.0 include the following.
+
+Documentation Changes
+=====================
+
+* A new :manual:`cmake-compile-features(7)` manual was added.
+
+New Features
+============
+
+Generators
+----------
+
+* A :generator:`Visual Studio 14` generator was added.
+
+Windows Phone and Windows Store
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+* Generators for Visual Studio 11 (2012) and above learned to generate
+  projects for Windows Phone and Windows Store.  One may set the
+  :variable:`CMAKE_SYSTEM_NAME` variable to ``WindowsPhone``
+  or ``WindowsStore`` on the :manual:`cmake(1)` command-line
+  or in a :variable:`CMAKE_TOOLCHAIN_FILE` to activate these platforms.
+  Also set :variable:`CMAKE_SYSTEM_VERSION` to ``8.0`` or ``8.1`` to
+  specify the version of Windows to be targeted.
+
+NVIDIA Nsight Tegra
+^^^^^^^^^^^^^^^^^^^
+
+* Generators for Visual Studio 10 (2010) and above learned to generate
+  projects for NVIDIA Nsight Tegra Visual Studio Edition.  One may set
+  the :variable:`CMAKE_SYSTEM_NAME` variable to ``Android`` on the
+  :manual:`cmake(1)` command-line or in a :variable:`CMAKE_TOOLCHAIN_FILE`
+  to activate this platform.
+
+Syntax
+------
+
+* The :manual:`cmake-language(7)` syntax for :ref:`Variable References` and
+  :ref:`Escape Sequences` was simplified in order to allow a much faster
+  implementation.  See policy :policy:`CMP0053`.
+
+* The :command:`if` command no longer automatically dereferences
+  variables named in quoted or bracket arguments.  See policy
+  :policy:`CMP0054`.
+
+Commands
+--------
+
+* The :command:`add_custom_command` command learned to interpret
+  :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.
+
+* The :command:`export(PACKAGE)` command learned to check the
+  :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable to skip
+  exporting the package.
+
+* The :command:`file(STRINGS)` command gained a new ``ENCODING``
+  option to enable extraction of ``UTF-8`` strings.
+
+* The :command:`find_package` command learned to check the
+  :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` and
+  :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY`
+  variables to skip searching the package registries.
+
+* The :command:`install` command learned a ``MESSAGE_NEVER`` option
+  to avoid output during installation.
+
+* The :command:`string` command learned a new ``GENEX_STRIP`` subcommand
+  which removes
+  :manual:`generator expression <cmake-generator-expressions(7)>`.
+
+* The :command:`string` command learned a new ``UUID`` subcommand
+  to generate a univerally unique identifier.
+
+* New :command:`target_compile_features` command allows populating the
+  :prop_tgt:`COMPILE_FEATURES` target property, just like any other
+  build variable.
+
+* The :command:`target_sources` command was added to add to the
+  :prop_tgt:`SOURCES` target property.
+
+Variables
+---------
+
+* The Visual Studio generators for versions 8 (2005) and above
+  learned to read the target platform name from a new
+  :variable:`CMAKE_GENERATOR_PLATFORM` variable when it is
+  not specified as part of the generator name.  The platform
+  name may be specified on the :manual:`cmake(1)` command line
+  with the ``-A`` option, e.g. ``-G "Visual Studio 12 2013" -A x64``.
+
+* The :variable:`CMAKE_GENERATOR_TOOLSET` variable may now be
+  initialized in a toolchain file specified by the
+  :variable:`CMAKE_TOOLCHAIN_FILE` variable.  This is useful
+  when cross-compiling with the Xcode or Visual Studio
+  generators.
+
+* The :variable:`CMAKE_INSTALL_MESSAGE` variable was introduced to
+  optionally reduce output installation.
+
+Properties
+----------
+
+* New :prop_tgt:`CXX_STANDARD` and :prop_tgt:`CXX_EXTENSIONS` target
+  properties may specify values which CMake uses to compute required
+  compile options such as ``-std=c++11`` or ``-std=gnu++11``. The
+  :variable:`CMAKE_CXX_STANDARD` and :variable:`CMAKE_CXX_EXTENSIONS`
+  variables may be set to initialize the target properties.
+
+* New :prop_tgt:`C_STANDARD` and :prop_tgt:`C_EXTENSIONS` target
+  properties may specify values which CMake uses to compute required
+  compile options such as ``-std=c11`` or ``-std=gnu11``. The
+  :variable:`CMAKE_C_STANDARD` and :variable:`CMAKE_C_EXTENSIONS`
+  variables may be set to initialize the target properties.
+
+* New :prop_tgt:`COMPILE_FEATURES` target property may contain a list
+  of features required to compile a target.  CMake uses this
+  information to ensure that the compiler in use is capable of building
+  the target, and to add any necessary compile flags to support language
+  features.
+
+* New :prop_tgt:`COMPILE_PDB_NAME` and
+  :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties
+  were introduced to specify the MSVC compiler program database
+  file location (``cl /Fd``).  This complements the existing
+  :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
+  target properties that specify the linker program database
+  file location (``link /pdb``).
+
+* The :prop_tgt:`INTERFACE_LINK_LIBRARIES` target property now supports
+  a ``$<LINK_ONLY:...>``
+  :manual:`generator expression <cmake-generator-expressions(7)>`.
+
+* A new :prop_tgt:`INTERFACE_SOURCES` target property was introduced. This is
+  consumed by dependent targets, which compile and link the listed sources.
+
+* The :prop_tgt:`SOURCES` target property now contains
+  :manual:`generator expression <cmake-generator-expressions(7)>`
+  such as ``TARGET_OBJECTS`` when read at configure time, if
+  policy :policy:`CMP0051` is ``NEW``.
+
+* The :prop_tgt:`SOURCES` target property now generally supports
+  :manual:`generator expression <cmake-generator-expressions(7)>`.  The
+  generator expressions may be used in the :command:`add_library` and
+  :command:`add_executable` commands.
+
+* It is now possible to write and append to the :prop_tgt:`SOURCES` target
+  property.  The :variable:`CMAKE_DEBUG_TARGET_PROPERTIES` variable may be
+  used to trace the origin of sources.
+
+* A :prop_sf:`VS_DEPLOYMENT_CONTENT` source file property was added
+  to tell the Visual Studio generators to mark content for deployment
+  in Windows Phone and Windows Store projects.
+
+* The :prop_tgt:`VS_WINRT_COMPONENT` target property was created to
+  tell Visual Studio generators to compile a shared library as a
+  Windows Runtime (WinRT) component.
+
+* The :generator:`Xcode` generator learned to check source
+  file properties  :prop_sf:`XCODE_EXPLICIT_FILE_TYPE` and
+  :prop_sf:`XCODE_LAST_KNOWN_FILE_TYPE` for a custom Xcode
+  file reference type.
+
+Modules
+-------
+
+* The :module:`BundleUtilities` module learned to resolve and replace
+  ``@rpath`` placeholders on OS X to correctly bundle applications
+  using them.
+
+* The :module:`CMakePackageConfigHelpers` module
+  :command:`configure_package_config_file` command learned a new
+  ``INSTALL_PREFIX`` option to generate package configuration files
+  meant for a prefix other than :variable:`CMAKE_INSTALL_PREFIX`.
+
+* The :module:`CheckFortranSourceCompiles` module was added to
+  provide a ``CHECK_Fortran_SOURCE_COMPILES`` macro.
+
+* The :module:`ExternalData` module learned to tolerate a ``DATA{}``
+  reference to a missing source file with a warning instead of
+  rejecting it with an error.  This helps developers write new
+  ``DATA{}`` references to test reference outputs that have not
+  yet been created.
+
+* The :module:`ExternalProject` module learned to support lzma-compressed
+  source tarballs with ``.7z``, ``.tar.xz``, and ``.txz`` extensions.
+
+* The :module:`ExternalProject` module ``ExternalProject_Add`` command
+  learned a new ``BUILD_ALWAYS`` option to cause the external project
+  build step to run every time the host project is built.
+
+* The :module:`ExternalProject` module ``ExternalProject_Add`` command
+  learned a new ``EXCLUDE_FROM_ALL`` option to cause the external
+  project target to have the :prop_tgt:`EXCLUDE_FROM_ALL` target
+  property set.
+
+* The :module:`ExternalProject` module ``ExternalProject_Add_Step`` command
+  learned a new ``EXCLUDE_FROM_MAIN`` option to cause the step to not be
+  a direct dependency of the main external project target.
+
+* The :module:`ExternalProject` module ``ExternalProject_Add`` command
+  learned a new ``DOWNLOAD_NO_PROGRESS`` option to disable progress
+  output while downloading the source tarball.
+
+* The :module:`FeatureSummary` module ``feature_summary`` API
+  learned to accept multiple values for the ``WHAT`` option and
+  combine them appropriately.
+
+* The :module:`FindCUDA` module learned to support ``fatbin`` and ``cubin``
+  modules.
+
+* The :module:`FindGTest` module ``gtest_add_tests`` macro learned
+  a new ``AUTO`` option to automatically read the :prop_tgt:`SOURCES`
+  target property of the test executable and scan the source files
+  for tests to be added.
+
+* The :module:`FindGLEW` module now provides imported targets.
+
+* The :module:`FindGLUT` module now provides imported targets.
+
+* The :module:`FindHg` module gained a new ``Hg_WC_INFO`` macro to
+  help run ``hg`` to extract information about a Mercurial work copy.
+
+* The :module:`FindOpenCL` module was introduced.
+
+* The :module:`FindOpenGL` module now provides imported targets
+  ``OpenGL::GL`` and ``OpenGL::GLU`` when the libraries are found.
+
+* The :module:`FindOpenMP` module learned to support Fortran.
+
+* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
+  environment variable value as the ``pkg-config`` executable, if set.
+
+* The :module:`FindVTK` module dropped support for finding VTK 4.0.
+  It is now a thin-wrapper around ``find_package(VTK ... NO_MODULE)``.
+  This produces much clearer error messages when VTK is not found.
+
+* The :module:`FindZLIB` module now provides imported targets.
+
+* The :module:`GenerateExportHeader` module ``generate_export_header``
+  function learned to allow use with :ref:`Object Libraries`.
+
+* The :module:`InstallRequiredSystemLibraries` module gained a new
+  ``CMAKE_INSTALL_OPENMP_LIBRARIES`` option to install MSVC OpenMP
+  runtime libraries.
+
+* The :module:`UseSWIG` module learned to detect the module name
+  from ``.i`` source files if possible to avoid the need to set
+  the ``SWIG_MODULE_NAME`` source file property explicitly.
+
+* The :module:`WriteCompilerDetectionHeader` module was added to allow
+  creation of a portable header file for compiler optional feature detection.
+
+Generator Expressions
+---------------------
+
+* New ``COMPILE_FEATURES``
+  :manual:`generator expression <cmake-generator-expressions(7)>` allows
+  setting build properties based on available compiler features.
+
+CTest
+-----
+
+* The :command:`ctest_coverage` command learned to read variable
+  ``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``.
+
+* The :command:`ctest_coverage` command learned to support
+  Intel coverage files with the ``codecov`` tool.
+
+* The :command:`ctest_memcheck` command learned to support sanitizer
+  modes, including ``AddressSanitizer``, ``MemorySanitizer``,
+  ``ThreadSanitizer``, and ``UndefinedBehaviorSanitizer``.
+  Options may be set using the new
+  :variable:`CTEST_MEMORYCHECK_SANITIZER_OPTIONS` variable.
+
+CPack
+-----
+
+* :manual:`cpack(1)` gained an ``IFW`` generator to package using
+  Qt Framework Installer tools.  See the :module:`CPackIFW` module.
+
+* :manual:`cpack(1)` gained ``7Z`` and ``TXZ`` generators supporting
+  lzma-compressed archives.
+
+* The :module:`CPackDeb` module learned a new
+  :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
+  tarball compression type.
+
+* The :manual:`cpack(1)` ``WiX`` generator learned to support
+  a :prop_inst:`CPACK_WIX_ACL` installed file property to
+  specify an Access Control List.
+
+Other
+-----
+
+* The :manual:`cmake(1)` ``-E`` option learned a new ``env`` command.
+
+* The :manual:`cmake(1)` ``-E tar`` command learned to support
+  lzma-compressed files.
+
+* :ref:`Object Libraries` may now have extra sources that do not
+  compile to object files so long as they would not affect linking
+  of a normal library (e.g. ``.dat`` is okay but not ``.def``).
+
+* Visual Studio generators for VS 8 and later learned to support
+  the ``ASM_MASM`` language.
+
+* The Visual Studio generators learned to treat ``.hlsl`` source
+  files as High Level Shading Language sources (using ``FXCompile``
+  in ``.vcxproj`` files).  A :prop_sf:`VS_SHADER_TYPE` source file
+  property was added to specify the Shader Type.
+
+New Diagnostics
+===============
+
+* Policy :policy:`CMP0052` introduced to control directories in the
+  :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of exported targets.
+
+Deprecated and Removed Features
+===============================
+
+* In CMake 3.0 the :command:`target_link_libraries` command
+  accidentally began allowing unquoted arguments to use
+  :manual:`generator expressions <cmake-generator-expressions(7)>`
+  containing a (``;`` separated) list within them.  For example::
+
+    set(libs B C)
+    target_link_libraries(A PUBLIC $<BUILD_INTERFACE:${libs}>)
+
+  This is equivalent to writing::
+
+    target_link_libraries(A PUBLIC $<BUILD_INTERFACE:B C>)
+
+  and was never intended to work.  It did not work in CMake 2.8.12.
+  Such generator expressions should be in quoted arguments::
+
+    set(libs B C)
+    target_link_libraries(A PUBLIC "$<BUILD_INTERFACE:${libs}>")
+
+  CMake 3.1 again requires the quotes for this to work correctly.
+
+* Callbacks established by the :command:`variable_watch` command will no
+  longer receive the ``ALLOWED_UNKNOWN_READ_ACCESS`` access type when
+  the undocumented ``CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS`` variable is
+  set.  Uninitialized variable accesses will always be reported as
+  ``UNKNOWN_READ_ACCESS``.
+
+* The :module:`CMakeDetermineVSServicePack` module now warns that
+  it is deprecated and should not longer be used.  Use the
+  :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
+
+Other Changes
+=============
+
+* The :manual:`cmake-gui(1)` learned to capture output from child
+  processes started by the :command:`execute_process` command
+  and display it in the output window.
+
+* The :manual:`cmake-language(7)` internal implementation of generator
+  expression and list expansion parsers have been optimized and shows
+  non-trivial speedup on large projects.
+
+* The Makefile generators learned to use response files with GNU tools
+  on Windows to pass library directories and names to the linker.
+
+* When generating linker command-lines, CMake now avoids repeating
+  items corresponding to SHARED library targets.
+
+* Support for the Open Watcom compiler has been overhauled.
+  The :variable:`CMAKE_<LANG>_COMPILER_ID` is now ``OpenWatcom``,
+  and the :variable:`CMAKE_<LANG>_COMPILER_VERSION` now uses
+  the Open Watcom external version numbering.  The external
+  version numbers are lower than the internal version number
+  by 11.
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/dev/CMP0052.rst b/Help/release/dev/CMP0052.rst
deleted file mode 100644
index adb3d44..0000000
--- a/Help/release/dev/CMP0052.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-CMP0052
--------
-
-* Policy :policy:`CMP0052` introduced to control directories in the
-  :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` of exported targets.
diff --git a/Help/release/dev/CMP0053.rst b/Help/release/dev/CMP0053.rst
deleted file mode 100644
index 3b835fb..0000000
--- a/Help/release/dev/CMP0053.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-CMP0053
--------
-
-* The :manual:`cmake-language(7)` syntax for :ref:`Variable References` and
-  :ref:`Escape Sequences` was simplified in order to allow a much faster
-  implementation.  See policy :policy:`CMP0053`.
diff --git a/Help/release/dev/CMakeDetermineVSServicePack.rst b/Help/release/dev/CMakeDetermineVSServicePack.rst
deleted file mode 100644
index d9d7b41..0000000
--- a/Help/release/dev/CMakeDetermineVSServicePack.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-CMakeDetermineVSServicePack
----------------------------
-
-* The :module:`CMakeDetermineVSServicePack` module now warns that
-  it is deprecated and should not longer be used.  Use the
-  :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
diff --git a/Help/release/dev/ExternalData-missing-not-fatal.rst b/Help/release/dev/ExternalData-missing-not-fatal.rst
deleted file mode 100644
index e9f1f04..0000000
--- a/Help/release/dev/ExternalData-missing-not-fatal.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-ExternalData-missing-not-fatal
-------------------------------
-
-* The :module:`ExternalData` module learned to tolerate a ``DATA{}``
-  reference to a missing source file with a warning instead of
-  rejecting it with an error.  This helps developers write new
-  ``DATA{}`` references to test reference outputs that have not
-  yet been created.
diff --git a/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst b/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst
deleted file mode 100644
index 5384671..0000000
--- a/Help/release/dev/ExternalProject-BUILD_ALWAYS.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-ExternalProject-BUILD_ALWAYS
-----------------------------
-
-* The :module:`ExternalProject` module ``ExternalProject_Add`` command
-  learned a new ``BUILD_ALWAYS`` option to cause the external project
-  build step to run every time the host project is built.
diff --git a/Help/release/dev/ExternalProject-no-download-progress.rst b/Help/release/dev/ExternalProject-no-download-progress.rst
deleted file mode 100644
index 41db55d..0000000
--- a/Help/release/dev/ExternalProject-no-download-progress.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-ExternalProject-no-download-progress
-------------------------------------
-
-* The :module:`ExternalProject` module ``ExternalProject_Add`` command
-  learned a new ``DOWNLOAD_NO_PROGRESS`` option to disable progress
-  output while downloading the source tarball.
diff --git a/Help/release/dev/ExternalProject_exclude-from-all.rst b/Help/release/dev/ExternalProject_exclude-from-all.rst
deleted file mode 100644
index 1d62b3a..0000000
--- a/Help/release/dev/ExternalProject_exclude-from-all.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-ExternalProject_exclude-from-all
---------------------------------
-
-* The :module:`ExternalProject` module ``ExternalProject_Add`` command
-  learned a new ``EXCLUDE_FROM_ALL`` option to cause the external
-  project target to have the :prop_tgt:`EXCLUDE_FROM_ALL` target
-  property set.
-
-* The :module:`ExternalProject` module ``ExternalProject_Add_Step`` command
-  learned a new ``EXCLUDE_FROM_MAIN`` option to cause the step to not be
-  a direct dependency of the main external project target.
diff --git a/Help/release/dev/FeatureSummary_combine_WHAT_values.rst b/Help/release/dev/FeatureSummary_combine_WHAT_values.rst
deleted file mode 100644
index 174ef15..0000000
--- a/Help/release/dev/FeatureSummary_combine_WHAT_values.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-FeatureSummary_combine_WHAT_values
-----------------------------------
-
-* The :module:`FeatureSummary` module ``feature_summary`` API
-  learned to accept multiple values for the ``WHAT`` option and
-  combine them appropriately.
diff --git a/Help/release/dev/FindCUDA-cubin-fatbin.rst b/Help/release/dev/FindCUDA-cubin-fatbin.rst
deleted file mode 100644
index d44da8e..0000000
--- a/Help/release/dev/FindCUDA-cubin-fatbin.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-FindCUDA-cubin-fatbin
----------------------
-
-* The :module:`FindCUDA` module learned to support ``fatbin`` and ``cubin``
-  modules.
diff --git a/Help/release/dev/FindGTest-AUTO-SOURCES.rst b/Help/release/dev/FindGTest-AUTO-SOURCES.rst
deleted file mode 100644
index 17b2a1b..0000000
--- a/Help/release/dev/FindGTest-AUTO-SOURCES.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-FindGTest-AUTO-SOURCES
-----------------------
-
-* The :module:`FindGTest` module ``gtest_add_tests`` macro learned
-  a new ``AUTO`` option to automatically read the :prop_tgt:`SOURCES`
-  target property of the test executable and scan the source files
-  for tests to be added.
diff --git a/Help/release/dev/FindHg-WC_INFO.rst b/Help/release/dev/FindHg-WC_INFO.rst
deleted file mode 100644
index 0caf2b3..0000000
--- a/Help/release/dev/FindHg-WC_INFO.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-FindHg-WC_INFO
---------------
-
-* The :module:`FindHg` module gained a new ``Hg_WC_INFO`` macro to
-  help run ``hg`` to extract information about a Mercurial work copy.
diff --git a/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst b/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst
deleted file mode 100644
index c0f6471..0000000
--- a/Help/release/dev/FindPkgConfig-PKG_CONFIG.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-FindPkgConfig-PKG_CONFIG
-------------------------
-
-* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
-  environment variable value as the ``pkg-config`` executable, if set.
diff --git a/Help/release/dev/OpenWatcom.rst b/Help/release/dev/OpenWatcom.rst
deleted file mode 100644
index 63f6e8c..0000000
--- a/Help/release/dev/OpenWatcom.rst
+++ /dev/null
@@ -1,9 +0,0 @@
-OpenWatcom
-----------
-
-* Support for the Open Watcom compiler has been overhauled.
-  The :variable:`CMAKE_<LANG>_COMPILER_ID` is now ``OpenWatcom``,
-  and the :variable:`CMAKE_<LANG>_COMPILER_VERSION` now uses
-  the Open Watcom external version numbering.  The external
-  version numbers are lower than the internal version number
-  by 11.
diff --git a/Help/release/dev/UseSWIG-guess_module_name.rst b/Help/release/dev/UseSWIG-guess_module_name.rst
deleted file mode 100644
index c895046..0000000
--- a/Help/release/dev/UseSWIG-guess_module_name.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-UseSWIG-guess_module_name
--------------------------
-
-* The :module:`UseSWIG` module learned to detect the module name
-  from ``.i`` source files if possible to avoid the need to set
-  the ``SWIG_MODULE_NAME`` source file property explicitly.
diff --git a/Help/release/dev/add-FindOpenCL.rst b/Help/release/dev/add-FindOpenCL.rst
deleted file mode 100644
index e1e30d1..0000000
--- a/Help/release/dev/add-FindOpenCL.rst
+++ /dev/null
@@ -1,4 +0,0 @@
-add-FindOpenCL
---------------
-
-* The :module:`FindOpenCL` module was introduced.
diff --git a/Help/release/dev/add_custom_command-DEPENDS-genex.rst b/Help/release/dev/add_custom_command-DEPENDS-genex.rst
deleted file mode 100644
index 1e528e6..0000000
--- a/Help/release/dev/add_custom_command-DEPENDS-genex.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-add_custom_command-DEPENDS-genex
---------------------------------
-
-* The :command:`add_custom_command` command learned to interpret
-  :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.
diff --git a/Help/release/dev/cmake-gui-capture-output.rst b/Help/release/dev/cmake-gui-capture-output.rst
deleted file mode 100644
index 40cd25e..0000000
--- a/Help/release/dev/cmake-gui-capture-output.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cmake-gui-capture-output
-------------------------
-
-* The :manual:`cmake-gui(1)` learned to capture output from child
-  processes started by the :command:`execute_process` command
-  and display it in the output window.
diff --git a/Help/release/dev/compile-language-features.rst b/Help/release/dev/compile-language-features.rst
deleted file mode 100644
index d10e22b..0000000
--- a/Help/release/dev/compile-language-features.rst
+++ /dev/null
@@ -1,28 +0,0 @@
-target-language-features
-------------------------
-
-* New :prop_tgt:`CXX_STANDARD` and :prop_tgt:`CXX_EXTENSIONS` target
-  properties may specify values which CMake uses to compute required
-  compile options such as ``-std=c++11`` or ``-std=gnu++11``. The
-  :variable:`CMAKE_CXX_STANDARD` and :variable:`CMAKE_CXX_EXTENSIONS`
-  variables may be set to initialize the target properties.
-
-* New :prop_tgt:`C_STANDARD` and :prop_tgt:`C_EXTENSIONS` target
-  properties may specify values which CMake uses to compute required
-  compile options such as ``-std=c11`` or ``-std=gnu11``. The
-  :variable:`CMAKE_C_STANDARD` and :variable:`CMAKE_C_EXTENSIONS`
-  variables may be set to initialize the target properties.
-
-* New :prop_tgt:`COMPILE_FEATURES` target property may contain a list
-  of features required to compile a target.  CMake uses this
-  information to ensure that the compiler in use is capable of building
-  the target, and to add any necessary compile flags to support language
-  features.
-
-* New :command:`target_compile_features` command allows populating the
-  :prop_tgt:`COMPILE_FEATURES` target property, just like any other
-  build variable.
-
-* New ``COMPILE_FEATURES``
-  :manual:`generator expression <cmake-generator-expressions(7)>` allows
-  setting build properties based on available compiler features.
diff --git a/Help/release/dev/cpack-deb-compression-types.rst b/Help/release/dev/cpack-deb-compression-types.rst
deleted file mode 100644
index a33e333..0000000
--- a/Help/release/dev/cpack-deb-compression-types.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-cpack-deb-compression-types
----------------------------
-
-* The :module:`CPackDeb` module learned a new
-  :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
-  tarball compression type.
diff --git a/Help/release/dev/ctest-coverage-extra.rst b/Help/release/dev/ctest-coverage-extra.rst
deleted file mode 100644
index 85d023b..0000000
--- a/Help/release/dev/ctest-coverage-extra.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ctest-coverage-extra
---------------------
-
-* The :command:`ctest_coverage` command learned to read variable
-  ``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``.
diff --git a/Help/release/dev/ctest-intel-coverage.rst b/Help/release/dev/ctest-intel-coverage.rst
deleted file mode 100644
index 11455a5..0000000
--- a/Help/release/dev/ctest-intel-coverage.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-ctest-intel-coverage
---------------------
-
-* The :command:`ctest_coverage` command learned to support
-  Intel coverage files with the ``codecov`` tool.
diff --git a/Help/release/dev/custom-ninja-deptypes.rst b/Help/release/dev/custom-ninja-deptypes.rst
deleted file mode 100644
index 7750da8..0000000
--- a/Help/release/dev/custom-ninja-deptypes.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-custom-ninja-deptypes
----------------------
-
-* Add a `CMAKE_NINJA_DEPTYPE_<LANG>` variable so that compilers may set the
-  deptype for use in Ninja other than those CMake itself knows about.
diff --git a/Help/release/dev/delay-generator-toolset.rst b/Help/release/dev/delay-generator-toolset.rst
deleted file mode 100644
index 0512834..0000000
--- a/Help/release/dev/delay-generator-toolset.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-delay-generator-toolset
------------------------
-
-* The :variable:`CMAKE_GENERATOR_TOOLSET` variable may now be
-  initialized in a toolchain file specified by the
-  :variable:`CMAKE_TOOLCHAIN_FILE` variable.  This is useful
-  when cross-compiling with the Xcode or Visual Studio
-  generators.
diff --git a/Help/release/dev/faster-parsers.rst b/Help/release/dev/faster-parsers.rst
deleted file mode 100644
index c2a8bfb..0000000
--- a/Help/release/dev/faster-parsers.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-faster-parsers
---------------
-
-* The :manual:`cmake-language(7)` internal implementation of generator
-  expression and list expansion parsers have been optimized and shows
-  non-trivial speedup on large projects.
diff --git a/Help/release/dev/link-libraries-response-files.rst b/Help/release/dev/link-libraries-response-files.rst
deleted file mode 100644
index cecf7f6..0000000
--- a/Help/release/dev/link-libraries-response-files.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-link-libraries-response-files
------------------------------
-
-* The Makefile generators learned to use response files with GNU tools
-  on Windows to pass library directories and names to the linker.
diff --git a/Help/release/dev/module-WriteCompilerDetectionHeader.rst b/Help/release/dev/module-WriteCompilerDetectionHeader.rst
deleted file mode 100644
index 10e7b86..0000000
--- a/Help/release/dev/module-WriteCompilerDetectionHeader.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-module-WriteCompilerDetectionHeader
------------------------------------
-
-* The :module:`WriteCompilerDetectionHeader` module was added to allow
-  creation of a portable header file for compiler optional feature detection.
diff --git a/Help/release/dev/msvc-compiler-pdb-files.rst b/Help/release/dev/msvc-compiler-pdb-files.rst
deleted file mode 100644
index d06d202..0000000
--- a/Help/release/dev/msvc-compiler-pdb-files.rst
+++ /dev/null
@@ -1,10 +0,0 @@
-msvc-compiler-pdb-files
------------------------
-
-* New :prop_tgt:`COMPILE_PDB_NAME` and
-  :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` target properties
-  were introduced to specify the MSVC compiler program database
-  file location (``cl /Fd``).  This complements the existing
-  :prop_tgt:`PDB_NAME` and :prop_tgt:`PDB_OUTPUT_DIRECTORY`
-  target properties that specify the linker program database
-  file location (``link /pdb``).
diff --git a/Help/release/dev/package-disable-registry.rst b/Help/release/dev/package-disable-registry.rst
deleted file mode 100644
index 1b23fde..0000000
--- a/Help/release/dev/package-disable-registry.rst
+++ /dev/null
@@ -1,11 +0,0 @@
-package-disable-registry
-------------------------
-
-* The :command:`export(PACKAGE)` command learned to check the
-  :variable:`CMAKE_EXPORT_NO_PACKAGE_REGISTRY` variable to skip
-  exporting the package.
-
-* The :command:`find_package` command learned to check the
-  :variable:`CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY` and
-  :variable:`CMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY`
-  variables to skip searching the package registries.
diff --git a/Help/release/dev/string-GENEX_STRIP.rst b/Help/release/dev/string-GENEX_STRIP.rst
deleted file mode 100644
index b5b1074..0000000
--- a/Help/release/dev/string-GENEX_STRIP.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-string-GENEX_STRIP
-------------------
-
-* The :command:`string` command learned a new ``GENEX_STRIP`` subcommand
-  which removes
-  :manual:`generator expression <cmake-generator-expressions(7)>`.
diff --git a/Help/release/dev/target-INTERFACE_SOURCES.rst b/Help/release/dev/target-INTERFACE_SOURCES.rst
deleted file mode 100644
index 4e34943..0000000
--- a/Help/release/dev/target-INTERFACE_SOURCES.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-target-INTERFACE_SOURCES
-------------------------
-
-* A new :prop_tgt:`INTERFACE_SOURCES` target property was introduced. This is
-  consumed by dependent targets, which compile and link the listed sources.
diff --git a/Help/release/dev/target-SOURCES-genex.rst b/Help/release/dev/target-SOURCES-genex.rst
deleted file mode 100644
index 9a65101..0000000
--- a/Help/release/dev/target-SOURCES-genex.rst
+++ /dev/null
@@ -1,12 +0,0 @@
-target-SOURCES-genex
---------------------
-
-* The :prop_tgt:`SOURCES` target property now contains
-  :manual:`generator expression <cmake-generator-expressions(7)>`
-  such as ``TARGET_OBJECTS`` when read at configure time, if
-  policy :policy:`CMP0051` is ``NEW``.
-
-* The :prop_tgt:`SOURCES` target property now generally supports
-  :manual:`generator expression <cmake-generator-expressions(7)>`.  The
-  generator expressions may be used in the :command:`add_library` and
-  :command:`add_executable` commands.
diff --git a/Help/release/dev/target-SOURCES-write.rst b/Help/release/dev/target-SOURCES-write.rst
deleted file mode 100644
index a754a73..0000000
--- a/Help/release/dev/target-SOURCES-write.rst
+++ /dev/null
@@ -1,6 +0,0 @@
-target-SOURCES-write.rst
-------------------------
-
-* It is now possible to write and append to the :prop_tgt:`SOURCES` target
-  property.  The :variable:`CMAKE_DEBUG_TARGET_PROPERTIES` variable may be
-  used to trace the origin of sources.
diff --git a/Help/release/dev/target_sources-command.rst b/Help/release/dev/target_sources-command.rst
deleted file mode 100644
index abfb303..0000000
--- a/Help/release/dev/target_sources-command.rst
+++ /dev/null
@@ -1,5 +0,0 @@
-target_sources-command
-----------------------
-
-* The :command:`target_sources` command was added to add to the
-  :prop_tgt:`SOURCES` target property.
diff --git a/Help/release/dev/variable_watch-no-allowed-access.rst b/Help/release/dev/variable_watch-no-allowed-access.rst
deleted file mode 100644
index ba7b4a5..0000000
--- a/Help/release/dev/variable_watch-no-allowed-access.rst
+++ /dev/null
@@ -1,8 +0,0 @@
-variable_watch-no-allowed-access
---------------------------------
-
-* Callbacks established by the :command:`variable_watch` command will no
-  longer receive the ``ALLOWED_UNKNOWN_READ_ACCESS`` access type when
-  the undocumented ``CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS`` variable is
-  set.  Uninitialized variable accesses will always be reported as
-  ``UNKNOWN_READ_ACCESS``.
diff --git a/Help/release/dev/xcode-file-type.rst b/Help/release/dev/xcode-file-type.rst
deleted file mode 100644
index 6f637f7..0000000
--- a/Help/release/dev/xcode-file-type.rst
+++ /dev/null
@@ -1,7 +0,0 @@
-xcode-file-type
----------------
-
-* The :generator:`Xcode` generator learned to check source
-  file properties  :prop_sf:`XCODE_EXPLICIT_FILE_TYPE` and
-  :prop_sf:`XCODE_LAST_KNOWN_FILE_TYPE` for a custom Xcode
-  file reference type.
diff --git a/Help/release/index.rst b/Help/release/index.rst
index 15ce065..616a582 100644
--- a/Help/release/index.rst
+++ b/Help/release/index.rst
@@ -5,12 +5,11 @@
   This file should include the adjacent "dev.txt" file
   in development versions but not in release versions.
 
-.. include:: dev.txt
-
 Releases
 ========
 
 .. toctree::
    :maxdepth: 1
 
+   3.1.0 <3.1.0>
    3.0.0 <3.0.0>
diff --git a/Help/variable/CMAKE_ANDROID_API.rst b/Help/variable/CMAKE_ANDROID_API.rst
new file mode 100644
index 0000000..c8264e0
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_API.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_API
+-----------------
+
+Default value for the :prop_tgt:`ANDROID_API` target property.
+See that target property for additional information.
diff --git a/Help/variable/CMAKE_ANDROID_GUI.rst b/Help/variable/CMAKE_ANDROID_GUI.rst
new file mode 100644
index 0000000..1755375
--- /dev/null
+++ b/Help/variable/CMAKE_ANDROID_GUI.rst
@@ -0,0 +1,5 @@
+CMAKE_ANDROID_GUI
+-----------------
+
+Default value for the :prop_tgt:`ANDROID_GUI` target property of
+executables.  See that target property for additional information.
diff --git a/Help/variable/CMAKE_GENERATOR_PLATFORM.rst b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
new file mode 100644
index 0000000..5809b6a
--- /dev/null
+++ b/Help/variable/CMAKE_GENERATOR_PLATFORM.rst
@@ -0,0 +1,15 @@
+CMAKE_GENERATOR_PLATFORM
+------------------------
+
+Generator-specific target platform name specified by user.
+
+Some CMake generators support a target platform name to be given
+to the native build system to choose a compiler toolchain.
+If the user specifies a toolset name (e.g. via the cmake -A option)
+the value will be available in this variable.
+
+The value of this variable should never be modified by project code.
+A toolchain file specified by the :variable:`CMAKE_TOOLCHAIN_FILE`
+variable may initialize ``CMAKE_GENERATOR_PLATFORM``.  Once a given
+build tree has been initialized with a particular value for this
+variable, changing the value has undefined behavior.
diff --git a/Help/variable/CMAKE_INSTALL_MESSAGE.rst b/Help/variable/CMAKE_INSTALL_MESSAGE.rst
new file mode 100644
index 0000000..304df26
--- /dev/null
+++ b/Help/variable/CMAKE_INSTALL_MESSAGE.rst
@@ -0,0 +1,30 @@
+CMAKE_INSTALL_MESSAGE
+---------------------
+
+Specify verbosity of installation script code generated by the
+:command:`install` command (using the :command:`file(INSTALL)` command).
+For paths that are newly installed or updated, installation
+may print lines like::
+
+  -- Installing: /some/destination/path
+
+For paths that are already up to date, installation may print
+lines like::
+
+  -- Up-to-date: /some/destination/path
+
+The ``CMAKE_INSTALL_MESSAGE`` variable may be set to control
+which messages are printed:
+
+``ALWAYS``
+  Print both ``Installing`` and ``Up-to-date`` messages.
+
+``LAZY``
+  Print ``Installing`` but not ``Up-to-date`` messages.
+
+``NEVER``
+  Print neither ``Installing`` nor ``Up-to-date`` messages.
+
+Other values have undefined behavior and may not be diagnosed.
+
+If this variable is not set, the default behavior is ``ALWAYS``.
diff --git a/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst
new file mode 100644
index 0000000..386c3a9
--- /dev/null
+++ b/Help/variable/CMAKE_VS_NsightTegra_VERSION.rst
@@ -0,0 +1,7 @@
+CMAKE_VS_NsightTegra_VERSION
+----------------------------
+
+When using a Visual Studio generator with the
+:variable:`CMAKE_SYSTEM_NAME` variable set to ``Android``,
+this variable contains the version number of the
+installed NVIDIA Nsight Tegra Visual Studio Edition.
diff --git a/Help/variable/CMAKE_VS_PLATFORM_NAME.rst b/Help/variable/CMAKE_VS_PLATFORM_NAME.rst
new file mode 100644
index 0000000..c6f8d41
--- /dev/null
+++ b/Help/variable/CMAKE_VS_PLATFORM_NAME.rst
@@ -0,0 +1,7 @@
+CMAKE_VS_PLATFORM_NAME
+----------------------
+
+Visual Studio target platform name.
+
+VS 8 and above allow project files to specify a target platform.
+CMake provides the name of the chosen platform in this variable.
diff --git a/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst
new file mode 100644
index 0000000..096f64e
--- /dev/null
+++ b/Help/variable/CMAKE_XCODE_ATTRIBUTE_an-attribute.rst
@@ -0,0 +1,10 @@
+CMAKE_XCODE_ATTRIBUTE_<an-attribute>
+------------------------------------
+
+Set Xcode target attributes directly.
+
+Tell the Xcode generator to set '<an-attribute>' to a given value in
+the generated Xcode project.  Ignored on other generators.
+
+See the :prop_tgt:`XCODE_ATTRIBUTE_<an-attribute>` target property
+to set attributes on a specific target.
diff --git a/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst b/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst
new file mode 100644
index 0000000..2de5fb6
--- /dev/null
+++ b/Help/variable/CTEST_MEMORYCHECK_SANITIZER_OPTIONS.rst
@@ -0,0 +1,5 @@
+CTEST_MEMORYCHECK_SANITIZER_OPTIONS
+-----------------------------------
+
+Specify the CTest ``MemoryCheckSanitizerOptions`` setting
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/CTEST_MEMORYCHECK_TYPE.rst b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst
new file mode 100644
index 0000000..f1087c0
--- /dev/null
+++ b/Help/variable/CTEST_MEMORYCHECK_TYPE.rst
@@ -0,0 +1,7 @@
+CTEST_MEMORYCHECK_TYPE
+----------------------
+
+Specify the CTest ``MemoryCheckType`` setting
+in a :manual:`ctest(1)` dashboard client script.
+Valid values are Valgrind, Purify, BoundsChecker, and ThreadSanitizer,
+AddressSanitizer, MemorySanitizer, and UndefinedBehaviorSanitizer.
diff --git a/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst b/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst
new file mode 100644
index 0000000..e646e6e
--- /dev/null
+++ b/Help/variable/CTEST_UPDATE_VERSION_ONLY.rst
@@ -0,0 +1,5 @@
+CTEST_UPDATE_VERSION_ONLY
+-------------------------
+
+Specify the CTest ``UpdateVersionOnly`` setting
+in a :manual:`ctest(1)` dashboard client script.
diff --git a/Help/variable/MSVC14.rst b/Help/variable/MSVC14.rst
new file mode 100644
index 0000000..33c782b
--- /dev/null
+++ b/Help/variable/MSVC14.rst
@@ -0,0 +1,6 @@
+MSVC14
+------
+
+True when using Microsoft Visual C 14.0
+
+Set to true when the compiler is version 14.0 of Microsoft Visual C.
diff --git a/Help/variable/MSVC_VERSION.rst b/Help/variable/MSVC_VERSION.rst
index d74114e..ef3b0b5 100644
--- a/Help/variable/MSVC_VERSION.rst
+++ b/Help/variable/MSVC_VERSION.rst
@@ -3,9 +3,7 @@
 
 The version of Microsoft Visual C/C++ being used if any.
 
-Known version numbers are:
-
-::
+Known version numbers are::
 
   1200 = VS  6.0
   1300 = VS  7.0
@@ -15,3 +13,4 @@
   1600 = VS 10.0
   1700 = VS 11.0
   1800 = VS 12.0
+  1900 = VS 14.0
diff --git a/Help/variable/WINCE.rst b/Help/variable/WINCE.rst
new file mode 100644
index 0000000..54ff7de
--- /dev/null
+++ b/Help/variable/WINCE.rst
@@ -0,0 +1,5 @@
+WINCE
+-----
+
+True when the :variable:`CMAKE_SYSTEM_NAME` variable is set
+to ``WindowsCE``.
diff --git a/Help/variable/WINDOWS_PHONE.rst b/Help/variable/WINDOWS_PHONE.rst
new file mode 100644
index 0000000..61d91b0
--- /dev/null
+++ b/Help/variable/WINDOWS_PHONE.rst
@@ -0,0 +1,5 @@
+WINDOWS_PHONE
+-------------
+
+True when the :variable:`CMAKE_SYSTEM_NAME` variable is set
+to ``WindowsPhone``.
diff --git a/Help/variable/WINDOWS_STORE.rst b/Help/variable/WINDOWS_STORE.rst
new file mode 100644
index 0000000..dae3b53
--- /dev/null
+++ b/Help/variable/WINDOWS_STORE.rst
@@ -0,0 +1,5 @@
+WINDOWS_STORE
+-------------
+
+True when the :variable:`CMAKE_SYSTEM_NAME` variable is set
+to ``WindowsStore``.
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 0c733fa..fee0a7c 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -19,6 +19,7 @@
 #    get_bundle_and_executable
 #    get_bundle_all_executables
 #    get_item_key
+#    get_item_rpaths
 #    clear_bundle_keys
 #    set_bundle_key_values
 #    get_bundle_keys
@@ -124,7 +125,7 @@
 # ::
 #
 #   SET_BUNDLE_KEY_VALUES(<keys_var> <context> <item> <exepath> <dirs>
-#                         <copyflag>)
+#                         <copyflag> [<rpaths>])
 #
 # Add a key to the list (if necessary) for the given item.  If added,
 # also set all the variables associated with that key.
@@ -237,6 +238,7 @@
     file(READ "${bundle}/Contents/Info.plist" info_plist)
     string(REPLACE ";" "\\;" info_plist "${info_plist}")
     string(REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
+    string(REPLACE "\r" "${eol_char};" info_plist "${info_plist}")
 
     # Scan the lines for "<key>CFBundleExecutable</key>" - the line after that
     # is the name of the main executable.
@@ -377,7 +379,25 @@
 function(get_bundle_all_executables bundle exes_var)
   set(exes "")
 
-  file(GLOB_RECURSE file_list "${bundle}/*")
+  if(UNIX)
+    find_program(find_cmd "find")
+    mark_as_advanced(find_cmd)
+  endif()
+
+  # find command is much quicker than checking every file one by one on Unix
+  # which can take long time for large bundles, and since anyway we expect
+  # executable to have execute flag set we can narrow the list much quicker.
+  if(find_cmd)
+    execute_process(COMMAND "${find_cmd}" "${bundle}"
+      -type f \( -perm -0100 -o -perm -0010 -o -perm -0001 \)
+      OUTPUT_VARIABLE file_list
+      OUTPUT_STRIP_TRAILING_WHITESPACE
+      )
+    string(REPLACE "\n" ";" file_list "${file_list}")
+  else()
+    file(GLOB_RECURSE file_list "${bundle}/*")
+  endif()
+
   foreach(f ${file_list})
     is_file_executable("${f}" is_executable)
     if(is_executable)
@@ -389,6 +409,29 @@
 endfunction()
 
 
+function(get_item_rpaths item rpaths_var)
+  if(APPLE)
+    find_program(otool_cmd "otool")
+    mark_as_advanced(otool_cmd)
+  endif()
+
+  if(otool_cmd)
+    execute_process(
+      COMMAND "${otool_cmd}" -l "${item}"
+      OUTPUT_VARIABLE load_cmds_ov
+      )
+    string(REGEX REPLACE "[^\n]+cmd LC_RPATH\n[^\n]+\n[^\n]+path ([^\n]+) \\(offset[^\n]+\n" "rpath \\1\n" load_cmds_ov "${load_cmds_ov}")
+    string(REGEX MATCHALL "rpath [^\n]+" load_cmds_ov "${load_cmds_ov}")
+    string(REGEX REPLACE "rpath " "" load_cmds_ov "${load_cmds_ov}")
+    if(load_cmds_ov)
+      gp_append_unique(${rpaths_var} "${load_cmds_ov}")
+    endif()
+  endif()
+
+  set(${rpaths_var} ${${rpaths_var}} PARENT_SCOPE)
+endfunction()
+
+
 function(get_item_key item key_var)
   get_filename_component(item_name "${item}" NAME)
   if(WIN32)
@@ -407,12 +450,14 @@
     set(${key}_EMBEDDED_ITEM PARENT_SCOPE)
     set(${key}_RESOLVED_EMBEDDED_ITEM PARENT_SCOPE)
     set(${key}_COPYFLAG PARENT_SCOPE)
+    set(${key}_RPATHS PARENT_SCOPE)
   endforeach()
   set(${keys_var} PARENT_SCOPE)
 endfunction()
 
 
 function(set_bundle_key_values keys_var context item exepath dirs copyflag)
+  set(rpaths "${ARGV6}")
   get_filename_component(item_name "${item}" NAME)
 
   get_item_key("${item}" key)
@@ -422,10 +467,12 @@
   list(LENGTH ${keys_var} length_after)
 
   if(NOT length_before EQUAL length_after)
-    gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item)
+    gp_resolve_item("${context}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}")
 
     gp_item_default_embedded_path("${item}" default_embedded_path)
 
+    get_item_rpaths("${resolved_item}" item_rpaths)
+
     if(item MATCHES "[^/]+\\.framework/")
       # For frameworks, construct the name under the embedded path from the
       # opening "${item_name}.framework/" to the closing "/${item_name}":
@@ -461,6 +508,8 @@
     set(${key}_EMBEDDED_ITEM "${embedded_item}" PARENT_SCOPE)
     set(${key}_RESOLVED_EMBEDDED_ITEM "${resolved_embedded_item}" PARENT_SCOPE)
     set(${key}_COPYFLAG "${copyflag}" PARENT_SCOPE)
+    set(${key}_RPATHS "${item_rpaths}" PARENT_SCOPE)
+    set(${key}_RDEP_RPATHS "${rpaths}" PARENT_SCOPE)
   else()
     #message("warning: item key '${key}' already in the list, subsequent references assumed identical to first")
   endif()
@@ -481,18 +530,27 @@
     #
     get_bundle_all_executables("${bundle}" exes)
 
+    # Set keys for main executable first:
+    #
+    set_bundle_key_values(${keys_var} "${executable}" "${executable}" "${exepath}" "${dirs}" 0)
+
+    # Get rpaths specified by main executable:
+    #
+    get_item_key("${executable}" executable_key)
+    set(main_rpaths "${${executable_key}_RPATHS}")
+
     # For each extra lib, accumulate a key as well and then also accumulate
     # any of its prerequisites. (Extra libs are typically dynamically loaded
     # plugins: libraries that are prerequisites for full runtime functionality
     # but that do not show up in otool -L output...)
     #
     foreach(lib ${libs})
-      set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0)
+      set_bundle_key_values(${keys_var} "${lib}" "${lib}" "${exepath}" "${dirs}" 0 "${main_rpaths}")
 
       set(prereqs "")
-      get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}")
+      get_prerequisites("${lib}" prereqs 1 1 "${exepath}" "${dirs}" "${main_rpaths}")
       foreach(pr ${prereqs})
-        set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1)
+        set_bundle_key_values(${keys_var} "${lib}" "${pr}" "${exepath}" "${dirs}" 1 "${main_rpaths}")
       endforeach()
     endforeach()
 
@@ -501,16 +559,27 @@
     # binaries in the bundle have been analyzed.
     #
     foreach(exe ${exes})
-      # Add the exe itself to the keys:
+      # Main executable is scanned first above:
       #
-      set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0)
+      if(NOT "${exe}" STREQUAL "${executable}")
+        # Add the exe itself to the keys:
+        #
+        set_bundle_key_values(${keys_var} "${exe}" "${exe}" "${exepath}" "${dirs}" 0 "${main_rpaths}")
+
+        # Get rpaths specified by executable:
+        #
+        get_item_key("${exe}" exe_key)
+        set(exe_rpaths "${main_rpaths}" "${${exe_key}_RPATHS}")
+      else()
+        set(exe_rpaths "${main_rpaths}")
+      endif()
 
       # Add each prerequisite to the keys:
       #
       set(prereqs "")
-      get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}")
+      get_prerequisites("${exe}" prereqs 1 1 "${exepath}" "${dirs}" "${exe_rpaths}")
       foreach(pr ${prereqs})
-        set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1)
+        set_bundle_key_values(${keys_var} "${exe}" "${pr}" "${exepath}" "${dirs}" 1 "${exe_rpaths}")
       endforeach()
     endforeach()
 
@@ -524,6 +593,8 @@
       set(${key}_EMBEDDED_ITEM "${${key}_EMBEDDED_ITEM}" PARENT_SCOPE)
       set(${key}_RESOLVED_EMBEDDED_ITEM "${${key}_RESOLVED_EMBEDDED_ITEM}" PARENT_SCOPE)
       set(${key}_COPYFLAG "${${key}_COPYFLAG}" PARENT_SCOPE)
+      set(${key}_RPATHS "${${key}_RPATHS}" PARENT_SCOPE)
+      set(${key}_RDEP_RPATHS "${${key}_RDEP_RPATHS}" PARENT_SCOPE)
     endforeach()
   endif()
 endfunction()
@@ -579,12 +650,45 @@
       execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
 
       # Plus Resources, if they exist:
-      string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
-      string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
+      string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
+      string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
       if(EXISTS "${resolved_resources}")
         #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'")
         execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}")
       endif()
+
+      # Some frameworks e.g. Qt put Info.plist in wrong place, so when it is
+      # missing in resources, copy it from other well known incorrect locations:
+      if(NOT EXISTS "${resolved_resources}/Info.plist")
+        # Check for Contents/Info.plist in framework root (older Qt SDK):
+        string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Contents/Info.plist" resolved_info_plist "${resolved_item}")
+        string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources/Info.plist" resolved_embedded_info_plist "${resolved_embedded_item}")
+        if(EXISTS "${resolved_info_plist}")
+          #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_info_plist}' '${resolved_embedded_info_plist}'")
+          execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_info_plist}" "${resolved_embedded_info_plist}")
+        endif()
+      endif()
+
+      # Check if framework is versioned and fix it layout
+      string(REGEX REPLACE "^.*/([^/]+)/[^/]+$" "\\1" resolved_embedded_version "${resolved_embedded_item}")
+      string(REGEX REPLACE "^(.*)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions "${resolved_embedded_item}")
+      string(REGEX REPLACE "^.*/([^/]+)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions_basename "${resolved_embedded_item}")
+      if(resolved_embedded_versions_basename STREQUAL "Versions")
+        # Ensure Current symlink points to the framework version
+        if(NOT EXISTS "${resolved_embedded_versions}/Current")
+          execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${resolved_embedded_version}" "${resolved_embedded_versions}/Current")
+        endif()
+        # Restore symlinks in framework root pointing to current framework
+        # binary and resources:
+        string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1" resolved_embedded_root "${resolved_embedded_item}")
+        string(REGEX REPLACE "^.*/([^/]+)$" "\\1" resolved_embedded_item_basename "${resolved_embedded_item}")
+        if(NOT EXISTS "${resolved_embedded_root}/${resolved_embedded_item_basename}")
+          execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/${resolved_embedded_item_basename}" "${resolved_embedded_root}/${resolved_embedded_item_basename}")
+        endif()
+        if(NOT EXISTS "${resolved_embedded_root}/Resources")
+          execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Resources" "${resolved_embedded_root}/Resources")
+        endif()
+      endif()
     endif()
     if(UNIX AND NOT APPLE)
       file(RPATH_REMOVE FILE "${resolved_embedded_item}")
@@ -629,8 +733,10 @@
     message(FATAL_ERROR "cannot fixup an item that is not in the bundle...")
   endif()
 
+  set(rpaths "${${ikey}_RPATHS}" "${${ikey}_RDEP_RPATHS}")
+
   set(prereqs "")
-  get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}")
+  get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}" "${rpaths}")
 
   set(changes "")
 
@@ -650,12 +756,28 @@
     execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
   endif()
 
+  # Only if install_name_tool supports -delete_rpath:
+  #
+  execute_process(COMMAND install_name_tool
+    OUTPUT_VARIABLE install_name_tool_usage
+    ERROR_VARIABLE  install_name_tool_usage
+    )
+  if(install_name_tool_usage MATCHES ".*-delete_rpath.*")
+    foreach(rpath ${${ikey}_RPATHS})
+      set(changes ${changes} -delete_rpath "${rpath}")
+    endforeach()
+  endif()
+
+  if(${ikey}_EMBEDDED_ITEM)
+    set(changes ${changes} -id "${${ikey}_EMBEDDED_ITEM}")
+  endif()
+
   # Change this item's id and all of its references in one call
   # to install_name_tool:
   #
-  execute_process(COMMAND install_name_tool
-    ${changes} -id "${${ikey}_EMBEDDED_ITEM}" "${resolved_embedded_item}"
-  )
+  if(changes)
+    execute_process(COMMAND install_name_tool ${changes} "${resolved_embedded_item}")
+  endif()
 endfunction()
 
 
@@ -746,10 +868,8 @@
 
   get_bundle_main_executable("${bundle}" main_bundle_exe)
 
-  file(GLOB_RECURSE file_list "${bundle}/*")
+  get_bundle_all_executables("${bundle}" file_list)
   foreach(f ${file_list})
-    is_file_executable("${f}" is_executable)
-    if(is_executable)
       get_filename_component(exepath "${f}" PATH)
       math(EXPR count "${count} + 1")
 
@@ -788,7 +908,6 @@
         set(result 0)
         set(info ${info} "external prerequisites found:\nf='${f}'\nexternal_prereqs='${external_prereqs}'\n")
       endif()
-    endif()
   endforeach()
 
   if(result)
diff --git a/Modules/CMakeASMInformation.cmake b/Modules/CMakeASMInformation.cmake
index dce1624..62ef972 100644
--- a/Modules/CMakeASMInformation.cmake
+++ b/Modules/CMakeASMInformation.cmake
@@ -50,6 +50,24 @@
   include(Platform/${CMAKE_SYSTEM_NAME}-${CMAKE_BASE_NAME} OPTIONAL)
 endif()
 
+# This should be included before the _INIT variables are
+# used to initialize the cache.  Since the rule variables
+# have if blocks on them, users can still define them here.
+# But, it should still be after the platform file so changes can
+# be made to those values.
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE)
+  # Save the full path of the file so try_compile can use it.
+  include(${CMAKE_USER_MAKE_RULES_OVERRIDE} RESULT_VARIABLE _override)
+  set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_override}")
+endif()
+
+if(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM)
+  # Save the full path of the file so try_compile can use it.
+  include(${CMAKE_USER_MAKE_RULES_OVERRIDE_ASM} RESULT_VARIABLE _override)
+  set(CMAKE_USER_MAKE_RULES_OVERRIDE_ASM "${_override}")
+endif()
+
 # Set default assembler file extensions:
 if(NOT CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS)
   set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS s;S;asm)
diff --git a/Modules/CMakeASM_MASMInformation.cmake b/Modules/CMakeASM_MASMInformation.cmake
index eb105ab..972883c 100644
--- a/Modules/CMakeASM_MASMInformation.cmake
+++ b/Modules/CMakeASM_MASMInformation.cmake
@@ -18,7 +18,7 @@
 
 set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm)
 
-set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <FLAGS> /c  /Fo <OBJECT> <SOURCE>")
+set(CMAKE_ASM${ASM_DIALECT}_COMPILE_OBJECT "<CMAKE_ASM${ASM_DIALECT}_COMPILER> <DEFINES> <FLAGS> /c  /Fo <OBJECT> <SOURCE>")
 
 include(CMakeASMInformation)
 set(ASM_DIALECT)
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index 9d8ba9e..19b2bbc 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -28,14 +28,16 @@
      FAIL_REGEX "option.*not supported"                     # Intel
      FAIL_REGEX "invalid argument .*option"                 # Intel
      FAIL_REGEX "ignoring option .*argument required"       # Intel
+     FAIL_REGEX "ignoring option .*argument is of wrong type" # Intel
      FAIL_REGEX "[Uu]nknown option"                         # HP
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
      FAIL_REGEX "command option .* contains an incorrect subargument" # XL
-     FAIL_REGEX "not supported in this configuration; ignored"       # AIX
+     FAIL_REGEX "not supported in this configuration. ignored"       # AIX
      FAIL_REGEX "File with unknown suffix passed to linker" # PGI
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
      FAIL_REGEX "Incorrect command line option:"            # Borland
      FAIL_REGEX "Warning: illegal option"                   # SunStudio 12
+     FAIL_REGEX "[Ww]arning: Invalid suboption"             # Fujitsu
    )
 endmacro ()
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake
index d8a0d67..19bcbcc 100644
--- a/Modules/CMakeCompilerIdDetection.cmake
+++ b/Modules/CMakeCompilerIdDetection.cmake
@@ -17,6 +17,7 @@
   get_filename_component(name ${file} NAME_WE)
   string(REGEX REPLACE "-.*" "" CompilerId ${name})
   set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
+  set(_compiler_id_simulate_${CompilerId} ${_compiler_id_simulate} PARENT_SCOPE)
   set(_compiler_id_pp_test_${CompilerId} ${_compiler_id_pp_test} PARENT_SCOPE)
 endfunction()
 
@@ -60,8 +61,6 @@
     list(APPEND ordered_compilers
       Intel
       PathScale
-      AppleClang
-      Clang
       Embarcadero
       Borland
       Watcom
@@ -75,6 +74,7 @@
       PGI
       Cray
       TI
+      Fujitsu
     )
     if (lang STREQUAL C)
       list(APPEND ordered_compilers
@@ -83,6 +83,8 @@
     endif()
     list(APPEND ordered_compilers
       SCO
+      AppleClang
+      Clang
       GNU
       MSVC
       ADSP
@@ -114,7 +116,9 @@
       endif()
       set(id_content "${pp_if} ${_compiler_id_pp_test_${Id}}\n")
       if (CID_ID_STRING)
-        set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"")
+        set(PREFIX ${CID_PREFIX})
+        string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY)
+        set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}")
       endif()
       if (CID_ID_DEFINE)
         set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n")
@@ -122,6 +126,8 @@
       endif()
       if (CID_VERSION_STRINGS)
         set(PREFIX ${CID_PREFIX})
+        set(MACRO_DEC DEC)
+        set(MACRO_HEX HEX)
         string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY)
         set(id_content "${id_content}${VERSION_BLOCK}\n")
       endif()
diff --git a/Modules/CMakeDetermineASM_MASMCompiler.cmake b/Modules/CMakeDetermineASM_MASMCompiler.cmake
index 665a65c..142ef95 100644
--- a/Modules/CMakeDetermineASM_MASMCompiler.cmake
+++ b/Modules/CMakeDetermineASM_MASMCompiler.cmake
@@ -17,7 +17,8 @@
 set(ASM_DIALECT "_MASM")
 
 # if we are using the 64bit cl compiler, assume we also want the 64bit assembler
-if(CMAKE_CL_64)
+if(";${CMAKE_VS_PLATFORM_NAME};${MSVC_C_ARCHITECTURE_ID};${MSVC_CXX_ARCHITECTURE_ID};"
+    MATCHES ";(Win64|Itanium|x64|IA64);")
    set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml64)
 else()
    set(CMAKE_ASM${ASM_DIALECT}_COMPILER_INIT ml)
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index 3847b75..6b425c6 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -136,7 +136,9 @@
     if (COMPILER_BASENAME MATCHES "^(.+-)(clang|g?cc)(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
       set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
     elseif("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
-      set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
+      if(CMAKE_C_COMPILER_TARGET)
+        set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_C_COMPILER_TARGET}-)
+      endif()
     elseif(COMPILER_BASENAME MATCHES "qcc(\\.exe)?$")
       if(CMAKE_C_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
         set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index e6a9d9a..893c454 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -133,7 +133,9 @@
     if (COMPILER_BASENAME MATCHES "^(.+-)(clan)?[gc]\\+\\+(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$")
       set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1})
     elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-      set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
+      if(CMAKE_CXX_COMPILER_TARGET)
+        set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_CXX_COMPILER_TARGET}-)
+      endif()
     elseif(COMPILER_BASENAME MATCHES "QCC(\\.exe)?$")
       if(CMAKE_CXX_COMPILER_TARGET MATCHES "gcc_nto([^_le]+)(le)?")
         set(_CMAKE_TOOLCHAIN_PREFIX nto${CMAKE_MATCH_1}-)
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index cd0f8b8..0ab3af6 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -65,7 +65,7 @@
   endif()
   find_program(CMAKE_${lang}_COMPILER NAMES ${CMAKE_${lang}_COMPILER_LIST} DOC "${lang} compiler")
   if(CMAKE_${lang}_COMPILER_INIT AND NOT CMAKE_${lang}_COMPILER)
-    set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_INIT}" CACHE FILEPATH "${lang} compiler" FORCE)
+    set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${CMAKE_${lang}_COMPILER_INIT}")
   endif()
   unset(_${lang}_COMPILER_HINTS)
   unset(_languages)
diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake
index 8595b97..4bc42dd 100644
--- a/Modules/CMakeDetermineCompilerABI.cmake
+++ b/Modules/CMakeDetermineCompilerABI.cmake
@@ -28,13 +28,15 @@
     if(DEFINED CMAKE_${lang}_VERBOSE_FLAG)
       set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}")
     endif()
+    if(NOT "x${CMAKE_${lang}_COMPILER_ID}" STREQUAL "xMSVC")
+      # Avoid adding our own platform standard libraries for compilers
+      # from which we might detect implicit link libraries.
+      list(APPEND CMAKE_FLAGS "-DCMAKE_${lang}_STANDARD_LIBRARIES=")
+    endif()
     try_compile(CMAKE_${lang}_ABI_COMPILED
       ${CMAKE_BINARY_DIR} ${src}
-      CMAKE_FLAGS "${CMAKE_FLAGS}"
-                  "-DCMAKE_${lang}_STANDARD_LIBRARIES="
-                  # We need ignore these warnings because some platforms need
-                  # CMAKE_${lang}_STANDARD_LIBRARIES to link properly and we
-                  # don't care when we are just determining the ABI.
+      CMAKE_FLAGS ${CMAKE_FLAGS}
+                  # Ignore unused flags when we are just determining the ABI.
                   "--no-warn-unused-cli"
       OUTPUT_VARIABLE OUTPUT
       COPY_FILE "${BIN}"
@@ -50,7 +52,7 @@
       message(STATUS "Detecting ${lang} compiler ABI info - done")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n")
-      file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
+      file(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
       foreach(info ${ABI_STRINGS})
         if("${info}" MATCHES "INFO:sizeof_dptr\\[0*([^]]*)\\]")
           set(ABI_SIZEOF_DPTR "${CMAKE_MATCH_1}")
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake
index 025d296..613f4b3 100644
--- a/Modules/CMakeDetermineCompilerId.cmake
+++ b/Modules/CMakeDetermineCompilerId.cmake
@@ -142,7 +142,17 @@
     set(id_platform ${CMAKE_VS_PLATFORM_NAME})
     set(id_lang "${lang}")
     set(id_cl cl.exe)
-    if(lang STREQUAL Fortran)
+    if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+      set(v NsightTegra)
+      set(ext vcxproj)
+      if(lang STREQUAL CXX)
+        set(id_gcc g++)
+        set(id_clang clang++)
+      else()
+        set(id_gcc gcc)
+        set(id_clang clang)
+      endif()
+    elseif(lang STREQUAL Fortran)
       set(v Intel)
       set(ext vfproj)
       set(id_cl ifort.exe)
@@ -161,13 +171,34 @@
       set(id_platform ia64)
     endif()
     if(CMAKE_VS_PLATFORM_TOOLSET)
-      set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
-      if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
-        set(id_cl icl.exe)
+      if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+        set(id_toolset "<NdkToolchainVersion>${CMAKE_VS_PLATFORM_TOOLSET}</NdkToolchainVersion>")
+      else()
+        set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
+        if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "Intel")
+          set(id_cl icl.exe)
+        endif()
       endif()
     else()
       set(id_toolset "")
     endif()
+    if(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+      set(id_system "<ApplicationType>Windows Phone</ApplicationType>")
+    elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+      set(id_system "<ApplicationType>Windows Store</ApplicationType>")
+    else()
+      set(id_system "")
+    endif()
+    if(id_system AND CMAKE_SYSTEM_VERSION)
+      set(id_system_version "<ApplicationTypeRevision>${CMAKE_SYSTEM_VERSION}</ApplicationTypeRevision>")
+    else()
+      set(id_system_version "")
+    endif()
+    if(id_platform STREQUAL ARM)
+      set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>")
+    else()
+      set(id_WindowsSDKDesktopARMSupport "")
+    endif()
     if(CMAKE_VS_WINCE_VERSION)
       set(id_entrypoint "mainACRTStartup")
       if("${vs_version}" VERSION_LESS 9)
@@ -230,11 +261,20 @@
     else()
       set(id_deployment_target "")
     endif()
+    set(id_product_type "com.apple.product-type.tool")
     if(CMAKE_OSX_SYSROOT)
       set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
+      if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]")
+        set(id_product_type "com.apple.product-type.bundle.unit-test")
+      endif()
     else()
       set(id_sdkroot "")
     endif()
+    if(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY)
+      set(id_code_sign_identity "CODE_SIGN_IDENTITY = \"${CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY}\";")
+    else()
+      set(id_code_sign_identity "")
+    endif()
     if(NOT ${XCODE_VERSION} VERSION_LESS 3)
       set(v 3)
       set(ext xcodeproj)
@@ -267,7 +307,7 @@
     #      ...
     #      /path/to/cc ...CompilerId${lang}/...
     # to extract the compiler front-end for the language.
-    if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]")
+    if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}(/CompilerId${lang}.xctest)?/(\\./)?CompilerId${lang}[ \t\n\\\"]")
       set(_comp "${CMAKE_MATCH_2}")
       if(EXISTS "${_comp}")
         set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
@@ -335,7 +375,13 @@
     # binary dir.
     file(GLOB files
       RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
-      ${CMAKE_${lang}_COMPILER_ID_DIR}/*)
+
+      # normal case
+      ${CMAKE_${lang}_COMPILER_ID_DIR}/*
+
+      # com.apple.package-type.bundle.unit-test
+      ${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/*
+      )
     list(REMOVE_ITEM files "${src}")
     set(COMPILER_${lang}_PRODUCED_FILES "")
     foreach(file ${files})
@@ -373,7 +419,7 @@
     set(SIMULATE_ID)
     set(SIMULATE_VERSION)
     file(STRINGS ${file}
-      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:")
+      CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 6 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
     set(COMPILER_ID_TWICE)
     foreach(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
       if("${info}" MATCHES "INFO:compiler\\[([^]\"]*)\\]")
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 1c0941a..fe292ea 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -47,7 +47,7 @@
   if(CMAKE_UNAME)
     exec_program(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME)
     exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
-    if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin")
+    if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux|CYGWIN.*|Darwin|^GNU$")
       exec_program(uname ARGS -m OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_PROCESSOR
         RETURN_VALUE val)
       if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 0752e04..8ac3364 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -20,8 +20,9 @@
 #
 # ::
 #
-#     cmake_expand_imported_targets(expandedLibs LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
-#                                                CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
+#     cmake_expand_imported_targets(expandedLibs
+#       LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}
+#       CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}" )
 
 
 #=============================================================================
@@ -71,7 +72,11 @@
       set(_CCSR_NEW_REQ_LIBS )
       set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
       foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
-         get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+         if(TARGET "${_CURRENT_LIB}")
+           get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+         else()
+           set(_importedConfigs "")
+         endif()
          if (_importedConfigs)
 #            message(STATUS "Detected imported target ${_CURRENT_LIB}")
             # Ok, so this is an imported target.
@@ -123,7 +128,11 @@
    # all remaining imported target names (there shouldn't be any left anyway).
    set(_CCSR_NEW_REQ_LIBS )
    foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
-      get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+      if(TARGET "${_CURRENT_LIB}")
+        get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+      else()
+        set(_importedConfigs "")
+      endif()
       if (NOT _importedConfigs)
          list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
 #         message(STATUS "final: appending ${_CURRENT_LIB}")
diff --git a/Modules/CMakeFindBinUtils.cmake b/Modules/CMakeFindBinUtils.cmake
index 829b6ff..e0ba131 100644
--- a/Modules/CMakeFindBinUtils.cmake
+++ b/Modules/CMakeFindBinUtils.cmake
@@ -35,7 +35,8 @@
    OR "${CMAKE_Fortran_SIMULATE_ID}" STREQUAL "MSVC"
    OR "${CMAKE_C_COMPILER_ID}" STREQUAL "MSVC"
    OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC"
-   OR "${CMAKE_GENERATOR}" MATCHES "Visual Studio")
+   OR ("${CMAKE_GENERATOR}" MATCHES "Visual Studio"
+       AND NOT CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android"))
 
   find_program(CMAKE_LINKER NAMES link HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
@@ -66,9 +67,7 @@
 
 endif()
 
-
-# on Apple there really should be install_name_tool
-if(APPLE)
+if(CMAKE_PLATFORM_HAS_INSTALLNAME)
   find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
 
   if(NOT CMAKE_INSTALL_NAME_TOOL)
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index 9f97ee5..fc3058d 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -7,15 +7,24 @@
 # This file is executed by cmake when invoked with --find-package.  It
 # expects that the following variables are set using -D:
 #
-# ::
-#
-#    NAME = name of the package
-#    COMPILER_ID = the CMake compiler ID for which the result is, i.e. GNU/Intel/Clang/MSVC, etc.
-#    LANGUAGE = language for which the result will be used, i.e. C/CXX/Fortan/ASM
-#    MODE = EXIST : only check for existence of the given package
-#           COMPILE : print the flags needed for compiling an object file which uses the given package
-#           LINK : print the flags needed for linking when using the given package
-#    QUIET = if TRUE, don't print anything
+# ``NAME``
+#   name of the package
+# ``COMPILER_ID``
+#   the CMake compiler ID for which the result is,
+#   i.e. GNU/Intel/Clang/MSVC, etc.
+# ``LANGUAGE``
+#   language for which the result will be used,
+#   i.e. C/CXX/Fortan/ASM
+# ``MODE``
+#   ``EXIST``
+#     only check for existence of the given package
+#   ``COMPILE``
+#     print the flags needed for compiling an object file which uses
+#     the given package
+#   ``LINK``
+#     print the flags needed for linking when using the given package
+# ``QUIET``
+#   if TRUE, don't print anything
 
 #=============================================================================
 # Copyright 2006-2011 Alexander Neundorf, <neundorf@kde.org>
diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 473bbe5..206ea7a 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -2,29 +2,37 @@
 # CMakePackageConfigHelpers
 # -------------------------
 #
-# CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
+# Helpers functions for creating config files that can be included by other
+# projects to find and use a package.
 #
+# Adds the :command:`configure_package_config_file()` and
+# :command:`write_basic_package_version_file()` commands.
 #
+# Generating a Package Configuration File
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 #
-# ::
+# .. command:: configure_package_config_file
 #
-#     CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
-#                                                    [PATH_VARS <var1> <var2> ... <varN>]
-#                                                    [NO_SET_AND_CHECK_MACRO]
-#                                                    [NO_CHECK_REQUIRED_COMPONENTS_MACRO])
+#  Create a config file for a project::
 #
+#    configure_package_config_file(<input> <output>
+#      INSTALL_DESTINATION <path>
+#      [PATH_VARS <var1> <var2> ... <varN>]
+#      [NO_SET_AND_CHECK_MACRO]
+#      [NO_CHECK_REQUIRED_COMPONENTS_MACRO]
+#      [INSTALL_PREFIX <path>]
+#      )
 #
+# ``configure_package_config_file()`` should be used instead of the plain
+# :command:`configure_file()` command when creating the ``<Name>Config.cmake``
+# or ``<Name>-config.cmake`` file for installing a project or library.  It helps
+# making the resulting package relocatable by avoiding hardcoded paths in the
+# installed ``Config.cmake`` file.
 #
-# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
-# configure_file() command when creating the <Name>Config.cmake or
-# <Name>-config.cmake file for installing a project or library.  It
-# helps making the resulting package relocatable by avoiding hardcoded
-# paths in the installed Config.cmake file.
+# In a ``FooConfig.cmake`` file there may be code like this to make the install
+# destinations know to the using project:
 #
-# In a FooConfig.cmake file there may be code like this to make the
-# install destinations know to the using project:
-#
-# ::
+# .. code-block:: cmake
 #
 #    set(FOO_INCLUDE_DIR   "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
 #    set(FOO_DATA_DIR   "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
@@ -32,141 +40,154 @@
 #    ...logic to determine installedPrefix from the own location...
 #    set(FOO_CONFIG_DIR  "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
 #
-# All 4 options shown above are not sufficient, since the first 3
-# hardcode the absolute directory locations, and the 4th case works only
-# if the logic to determine the installedPrefix is correct, and if
-# CONFIG_INSTALL_DIR contains a relative path, which in general cannot
-# be guaranteed.  This has the effect that the resulting FooConfig.cmake
-# file would work poorly under Windows and OSX, where users are used to
-# choose the install location of a binary package at install time,
-# independent from how CMAKE_INSTALL_PREFIX was set at build/cmake time.
+# All 4 options shown above are not sufficient, since the first 3 hardcode the
+# absolute directory locations, and the 4th case works only if the logic to
+# determine the ``installedPrefix`` is correct, and if ``CONFIG_INSTALL_DIR``
+# contains a relative path, which in general cannot be guaranteed.  This has the
+# effect that the resulting ``FooConfig.cmake`` file would work poorly under
+# Windows and OSX, where users are used to choose the install location of a
+# binary package at install time, independent from how
+# :variable:`CMAKE_INSTALL_PREFIX` was set at build/cmake time.
 #
-# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps.  If used correctly, it
-# makes the resulting FooConfig.cmake file relocatable.  Usage:
+# Using ``configure_package_config_file`` helps.  If used correctly, it makes
+# the resulting ``FooConfig.cmake`` file relocatable.  Usage:
 #
-# ::
-#
-#    1. write a FooConfig.cmake.in file as you are used to
-#    2. insert a line containing only the string "@PACKAGE_INIT@"
-#    3. instead of set(FOO_DIR "@SOME_INSTALL_DIR@"), use set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")
-#       (this must be after the @PACKAGE_INIT@ line)
-#    4. instead of using the normal configure_file(), use CONFIGURE_PACKAGE_CONFIG_FILE()
+# 1. write a ``FooConfig.cmake.in`` file as you are used to
+# 2. insert a line containing only the string ``@PACKAGE_INIT@``
+# 3. instead of ``set(FOO_DIR "@SOME_INSTALL_DIR@")``, use
+#    ``set(FOO_DIR "@PACKAGE_SOME_INSTALL_DIR@")`` (this must be after the
+#    ``@PACKAGE_INIT@`` line)
+# 4. instead of using the normal :command:`configure_file()`, use
+#    ``configure_package_config_file()``
 #
 #
 #
-# The <input> and <output> arguments are the input and output file, the
-# same way as in configure_file().
+# The ``<input>`` and ``<output>`` arguments are the input and output file, the
+# same way as in :command:`configure_file()`.
 #
-# The <path> given to INSTALL_DESTINATION must be the destination where
-# the FooConfig.cmake file will be installed to.  This can either be a
-# relative or absolute path, both work.
+# The ``<path>`` given to ``INSTALL_DESTINATION`` must be the destination where
+# the ``FooConfig.cmake`` file will be installed to.  This path can either be
+# absolute, or relative to the ``INSTALL_PREFIX`` path.
 #
-# The variables <var1> to <varN> given as PATH_VARS are the variables
-# which contain install destinations.  For each of them the macro will
-# create a helper variable PACKAGE_<var...>.  These helper variables
-# must be used in the FooConfig.cmake.in file for setting the installed
-# location.  They are calculated by CONFIGURE_PACKAGE_CONFIG_FILE() so
-# that they are always relative to the installed location of the
-# package.  This works both for relative and also for absolute
-# locations.  For absolute locations it works only if the absolute
-# location is a subdirectory of CMAKE_INSTALL_PREFIX.
+# The variables ``<var1>`` to ``<varN>`` given as ``PATH_VARS`` are the
+# variables which contain install destinations.  For each of them the macro will
+# create a helper variable ``PACKAGE_<var...>``.  These helper variables must be
+# used in the ``FooConfig.cmake.in`` file for setting the installed location.
+# They are calculated by ``configure_package_config_file`` so that they are
+# always relative to the installed location of the package.  This works both for
+# relative and also for absolute locations.  For absolute locations it works
+# only if the absolute location is a subdirectory of ``INSTALL_PREFIX``.
 #
-# By default configure_package_config_file() also generates two helper
-# macros, set_and_check() and check_required_components() into the
-# FooConfig.cmake file.
+# If the ``INSTALL_PREFIX`` argument is passed, this is used as base path to
+# calculate all the relative paths.  The ``<path>`` argument must be an absolute
+# path.  If this argument is not passed, the :variable:`CMAKE_INSTALL_PREFIX`
+# variable will be used instead.  The default value is good when generating a
+# FooConfig.cmake file to use your package from the install tree.  When
+# generating a FooConfig.cmake file to use your package from the build tree this
+# option should be used.
 #
-# set_and_check() should be used instead of the normal set() command for
-# setting directories and file locations.  Additionally to setting the
-# variable it also checks that the referenced file or directory actually
-# exists and fails with a FATAL_ERROR otherwise.  This makes sure that
-# the created FooConfig.cmake file does not contain wrong references.
-# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated
-# into the FooConfig.cmake file.
+# By default ``configure_package_config_file`` also generates two helper macros,
+# ``set_and_check()`` and ``check_required_components()`` into the
+# ``FooConfig.cmake`` file.
 #
-# check_required_components(<package_name>) should be called at the end
-# of the FooConfig.cmake file if the package supports components.  This
-# macro checks whether all requested, non-optional components have been
-# found, and if this is not the case, sets the Foo_FOUND variable to
-# FALSE, so that the package is considered to be not found.  It does
-# that by testing the Foo_<Component>_FOUND variables for all requested
-# required components.  When using the NO_CHECK_REQUIRED_COMPONENTS
-# option, this macro is not generated into the FooConfig.cmake file.
+# ``set_and_check()`` should be used instead of the normal ``set()`` command for
+# setting directories and file locations.  Additionally to setting the variable
+# it also checks that the referenced file or directory actually exists and fails
+# with a ``FATAL_ERROR`` otherwise.  This makes sure that the created
+# ``FooConfig.cmake`` file does not contain wrong references.
+# When using the ``NO_SET_AND_CHECK_MACRO``, this macro is not generated
+# into the ``FooConfig.cmake`` file.
+#
+# ``check_required_components(<package_name>)`` should be called at the end of
+# the ``FooConfig.cmake`` file if the package supports components.  This macro
+# checks whether all requested, non-optional components have been found, and if
+# this is not the case, sets the ``Foo_FOUND`` variable to ``FALSE``, so that
+# the package is considered to be not found.  It does that by testing the
+# ``Foo_<Component>_FOUND`` variables for all requested required components.
+# When using the ``NO_CHECK_REQUIRED_COMPONENTS_MACRO`` option, this macro is
+# not generated into the ``FooConfig.cmake`` file.
 #
 # For an example see below the documentation for
-# WRITE_BASIC_PACKAGE_VERSION_FILE().
+# :command:`write_basic_package_version_file()`.
+#
+# Generating a Package Version File
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#
+# .. command:: write_basic_package_version_file
+#
+#  Create a version file for a project::
+#
+#    write_basic_package_version_file(<filename>
+#      [VERSION <major.minor.patch>]
+#      COMPATIBILITY <AnyNewerVersion|SameMajorVersion|ExactVersion> )
 #
 #
+# Writes a file for use as ``<package>ConfigVersion.cmake`` file to
+# ``<filename>``.  See the documentation of :command:`find_package()` for
+# details on this.
 #
-# ::
+# ``<filename>`` is the output filename, it should be in the build tree.
+# ``<major.minor.patch>`` is the version number of the project to be installed.
 #
-#   WRITE_BASIC_PACKAGE_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion|ExactVersion) )
+# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable is used.
+# If this hasn't been set, it errors out.
 #
+# The ``COMPATIBILITY`` mode ``AnyNewerVersion`` means that the installed
+# package version will be considered compatible if it is newer or exactly the
+# same as the requested version.  This mode should be used for packages which
+# are fully backward compatible, also across major versions.
+# If ``SameMajorVersion`` is used instead, then the behaviour differs from
+# ``AnyNewerVersion`` in that the major version number must be the same as
+# requested, e.g.  version 2.0 will not be considered compatible if 1.0 is
+# requested.  This mode should be used for packages which guarantee backward
+# compatibility within the same major version.
+# If ``ExactVersion`` is used, then the package is only considered compatible if
+# the requested version matches exactly its own version number (not considering
+# the tweak version).  For example, version 1.2.3 of a package is only
+# considered compatible to requested version 1.2.3.  This mode is for packages
+# without compatibility guarantees.
+# If your project has more elaborated version matching rules, you will need to
+# write your own custom ``ConfigVersion.cmake`` file instead of using this
+# macro.
 #
-#
-# Writes a file for use as <package>ConfigVersion.cmake file to
-# <filename>.  See the documentation of find_package() for details on
-# this.
-#
-# ::
-#
-#     filename is the output filename, it should be in the build tree.
-#     major.minor.patch is the version number of the project to be installed
-#
-# If no ``VERSION`` is given, the :variable:`PROJECT_VERSION` variable
-# is used.  If this hasn't been set, it errors out.
-#
-# The COMPATIBILITY mode AnyNewerVersion means that the installed
-# package version will be considered compatible if it is newer or
-# exactly the same as the requested version.  This mode should be used
-# for packages which are fully backward compatible, also across major
-# versions.  If SameMajorVersion is used instead, then the behaviour
-# differs from AnyNewerVersion in that the major version number must be
-# the same as requested, e.g.  version 2.0 will not be considered
-# compatible if 1.0 is requested.  This mode should be used for packages
-# which guarantee backward compatibility within the same major version.
-# If ExactVersion is used, then the package is only considered
-# compatible if the requested version matches exactly its own version
-# number (not considering the tweak version).  For example, version
-# 1.2.3 of a package is only considered compatible to requested version
-# 1.2.3.  This mode is for packages without compatibility guarantees.
-# If your project has more elaborated version matching rules, you will
-# need to write your own custom ConfigVersion.cmake file instead of
-# using this macro.
-#
-# Internally, this macro executes configure_file() to create the
-# resulting version file.  Depending on the COMPATIBLITY, either the
-# file BasicConfigVersion-SameMajorVersion.cmake.in or
-# BasicConfigVersion-AnyNewerVersion.cmake.in is used.  Please note that
+# Internally, this macro executes :command:`configure_file()` to create the
+# resulting version file.  Depending on the ``COMPATIBLITY``, either the file
+# ``BasicConfigVersion-SameMajorVersion.cmake.in`` or
+# ``BasicConfigVersion-AnyNewerVersion.cmake.in`` is used.  Please note that
 # these two files are internal to CMake and you should not call
-# configure_file() on them yourself, but they can be used as starting
-# point to create more sophisticted custom ConfigVersion.cmake files.
+# :command:`configure_file()` on them yourself, but they can be used as starting
+# point to create more sophisticted custom ``ConfigVersion.cmake`` files.
 #
+# Example Generating Package Files
+# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 #
+# Example using both :command:`configure_package_config_file` and
+# ``write_basic_package_version_file()``:
 #
-# Example using both configure_package_config_file() and
-# write_basic_package_version_file(): CMakeLists.txt:
+# ``CMakeLists.txt``:
 #
-# ::
+# .. code-block:: cmake
 #
 #    set(INCLUDE_INSTALL_DIR include/ ... CACHE )
 #    set(LIB_INSTALL_DIR lib/ ... CACHE )
 #    set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
 #    ...
 #    include(CMakePackageConfigHelpers)
-#    configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
-#                                  INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
-#                                  PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
-#    write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
-#                                     VERSION 1.2.3
-#                                     COMPATIBILITY SameMajorVersion )
-#    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+#    configure_package_config_file(FooConfig.cmake.in
+#      ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
+#      INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
+#      PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
+#    write_basic_package_version_file(
+#      ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+#      VERSION 1.2.3
+#      COMPATIBILITY SameMajorVersion )
+#    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
+#                  ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
 #            DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
 #
+# ``FooConfig.cmake.in``:
 #
-#
-# With a FooConfig.cmake.in:
-#
-# ::
+# .. code-block:: cmake
 #
 #    set(FOO_VERSION x.y.z)
 #    ...
@@ -175,10 +196,6 @@
 #    set_and_check(FOO_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
 #    set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_SYSCONFIG_INSTALL_DIR@")
 #
-#
-#
-# ::
-#
 #    check_required_components(Foo)
 
 
@@ -203,11 +220,9 @@
   write_basic_config_version_file(${ARGN})
 endmacro()
 
-set(cfpch_dir ${CMAKE_CURRENT_LIST_DIR})
-
 function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
   set(options NO_SET_AND_CHECK_MACRO NO_CHECK_REQUIRED_COMPONENTS_MACRO)
-  set(oneValueArgs INSTALL_DESTINATION )
+  set(oneValueArgs INSTALL_DESTINATION INSTALL_PREFIX)
   set(multiValueArgs PATH_VARS )
 
   cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
@@ -220,20 +235,30 @@
     message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_PACKAGE_CONFIG_FILE()")
   endif()
 
+  if(DEFINED CCF_INSTALL_PREFIX)
+    if(IS_ABSOLUTE "${CCF_INSTALL_PREFIX}")
+      set(installPrefix "${CCF_INSTALL_PREFIX}")
+    else()
+      message(FATAL_ERROR "INSTALL_PREFIX must be an absolute path")
+    endif()
+  else()
+    set(installPrefix "${CMAKE_INSTALL_PREFIX}")
+  endif()
+
   if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
     set(absInstallDir "${CCF_INSTALL_DESTINATION}")
   else()
-    set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
+    set(absInstallDir "${installPrefix}/${CCF_INSTALL_DESTINATION}")
   endif()
 
-  file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
+  file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${installPrefix}" )
 
   foreach(var ${CCF_PATH_VARS})
     if(NOT DEFINED ${var})
       message(FATAL_ERROR "Variable ${var} does not exist")
     else()
       if(IS_ABSOLUTE "${${var}}")
-        string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
+        string(REPLACE "${installPrefix}" "\${PACKAGE_PREFIX_DIR}"
                         PACKAGE_${var} "${${var}}")
       else()
         set(PACKAGE_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
@@ -259,7 +284,7 @@
 get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH)
 get_filename_component(_realOrig \"${absInstallDir}\" REALPATH)
 if(_realCurr STREQUAL _realOrig)
-  set(PACKAGE_PREFIX_DIR \"${CMAKE_INSTALL_PREFIX}\")
+  set(PACKAGE_PREFIX_DIR \"${installPrefix}\")
 endif()
 unset(_realOrig)
 unset(_realCurr)
diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake
index 4248176..8553f38 100644
--- a/Modules/CMakeParseArguments.cmake
+++ b/Modules/CMakeParseArguments.cmake
@@ -45,7 +45,8 @@
 #      set(options OPTIONAL FAST)
 #      set(oneValueArgs DESTINATION RENAME)
 #      set(multiValueArgs TARGETS CONFIGURATIONS)
-#      cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
+#      cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}"
+#                            "${multiValueArgs}" ${ARGN} )
 #      ...
 #
 #
diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake
index ad3b0d5..474fa41 100644
--- a/Modules/CMakePrintHelpers.cmake
+++ b/Modules/CMakePrintHelpers.cmake
@@ -15,11 +15,10 @@
 #
 # This macro prints the values of the properties of the given targets,
 # source files, directories, tests or cache entries.  Exactly one of the
-# scope keywords must be used.  Example:
+# scope keywords must be used.  Example::
 #
-# ::
-#
-#    cmake_print_properties(TARGETS foo bar PROPERTIES LOCATION INTERFACE_INCLUDE_DIRS)
+#    cmake_print_properties(TARGETS foo bar PROPERTIES
+#                           LOCATION INTERFACE_INCLUDE_DIRS)
 #
 # This will print the LOCATION and INTERFACE_INCLUDE_DIRS properties for
 # both targets foo and bar.
@@ -29,17 +28,13 @@
 # CMAKE_PRINT_VARIABLES(var1 var2 ..  varN)
 #
 # This macro will print the name of each variable followed by its value.
-# Example:
+# Example::
 #
-# ::
+#   cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION DOES_NOT_EXIST)
 #
-#    cmake_print_variables(CMAKE_C_COMPILER CMAKE_MAJOR_VERSION THIS_ONE_DOES_NOT_EXIST)
+# Gives::
 #
-# Gives:
-#
-# ::
-#
-#    -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; THIS_ONE_DOES_NOT_EXIST=""
+#   -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ; DOES_NOT_EXIST=""
 
 #=============================================================================
 # Copyright 2013 Alexander Neundorf, <neundorf@kde.org>
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake
index 89547af..35259c4 100644
--- a/Modules/CPack.cmake
+++ b/Modules/CPack.cmake
@@ -418,35 +418,41 @@
       if(APPLE)
         option(CPACK_BINARY_BUNDLE       "Enable to build OSX bundles"      OFF)
         option(CPACK_BINARY_DRAGNDROP    "Enable to build OSX Drag And Drop package" OFF)
-        option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
         option(CPACK_BINARY_OSXX11       "Enable to build OSX X11 packages"      OFF)
+        option(CPACK_BINARY_PACKAGEMAKER "Enable to build PackageMaker packages" OFF)
       else()
         option(CPACK_BINARY_TZ  "Enable to build TZ packages"     ON)
       endif()
-      option(CPACK_BINARY_STGZ "Enable to build STGZ packages"    ON)
-      option(CPACK_BINARY_TGZ  "Enable to build TGZ packages"     ON)
-      option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages"    OFF)
       option(CPACK_BINARY_DEB  "Enable to build Debian packages"  OFF)
-      option(CPACK_BINARY_RPM  "Enable to build RPM packages"     OFF)
       option(CPACK_BINARY_NSIS "Enable to build NSIS packages"    OFF)
+      option(CPACK_BINARY_RPM  "Enable to build RPM packages"     OFF)
+      option(CPACK_BINARY_STGZ "Enable to build STGZ packages"    ON)
+      option(CPACK_BINARY_TBZ2 "Enable to build TBZ2 packages"    OFF)
+      option(CPACK_BINARY_TGZ  "Enable to build TGZ packages"     ON)
+      option(CPACK_BINARY_TXZ  "Enable to build TXZ packages"     OFF)
     endif()
   else()
+    option(CPACK_BINARY_7Z   "Enable to build 7-Zip packages" OFF)
     option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
     option(CPACK_BINARY_WIX  "Enable to build WiX packages" OFF)
     option(CPACK_BINARY_ZIP  "Enable to build ZIP packages" OFF)
   endif()
+  option(CPACK_BINARY_IFW "Enable to build IFW packages" OFF)
 
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_7Z           7Z)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_BUNDLE       Bundle)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DRAGNDROP    DragNDrop)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PACKAGEMAKER PackageMaker)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_OSXX11       OSXX11)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_CYGWIN       CygwinBinary)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DEB          DEB)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_DRAGNDROP    DragNDrop)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_IFW          IFW)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_NSIS         NSIS)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_OSXX11       OSXX11)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_PACKAGEMAKER PackageMaker)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_RPM          RPM)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_STGZ         STGZ)
-  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TXZ          TXZ)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_WIX          WIX)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)
@@ -461,27 +467,51 @@
     else()
       option(CPACK_SOURCE_TBZ2 "Enable to build TBZ2 source packages" ON)
       option(CPACK_SOURCE_TGZ  "Enable to build TGZ source packages"  ON)
+      option(CPACK_SOURCE_TXZ  "Enable to build TXZ source packages"  ON)
       option(CPACK_SOURCE_TZ   "Enable to build TZ source packages"   ON)
       option(CPACK_SOURCE_ZIP  "Enable to build ZIP source packages"  OFF)
     endif()
   else()
+    option(CPACK_SOURCE_7Z  "Enable to build 7-Zip source packages" ON)
     option(CPACK_SOURCE_ZIP "Enable to build ZIP source packages" ON)
   endif()
 
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_7Z      7Z)
   cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_CYGWIN  CygwinSource)
-  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TGZ     TGZ)
   cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TBZ2    TBZ2)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TGZ     TGZ)
+  cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TXZ     TXZ)
   cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_TZ      TZ)
   cpack_optional_append(CPACK_SOURCE_GENERATOR  CPACK_SOURCE_ZIP     ZIP)
 endif()
 
 # mark the above options as advanced
-mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
-                 CPACK_BINARY_STGZ   CPACK_BINARY_TGZ          CPACK_BINARY_TBZ2
-                 CPACK_BINARY_DEB    CPACK_BINARY_RPM          CPACK_BINARY_TZ
-                 CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
-                 CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
-                 CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
+mark_as_advanced(
+  CPACK_BINARY_7Z
+  CPACK_BINARY_BUNDLE
+  CPACK_BINARY_CYGWIN
+  CPACK_BINARY_DEB
+  CPACK_BINARY_DRAGNDROP
+  CPACK_BINARY_IFW
+  CPACK_BINARY_NSIS
+  CPACK_BINARY_OSXX11
+  CPACK_BINARY_PACKAGEMAKER
+  CPACK_BINARY_RPM
+  CPACK_BINARY_STGZ
+  CPACK_BINARY_TBZ2
+  CPACK_BINARY_TGZ
+  CPACK_BINARY_TXZ
+  CPACK_BINARY_TZ
+  CPACK_BINARY_WIX
+  CPACK_BINARY_ZIP
+  CPACK_SOURCE_7Z
+  CPACK_SOURCE_CYGWIN
+  CPACK_SOURCE_TBZ2
+  CPACK_SOURCE_TGZ
+  CPACK_SOURCE_TXZ
+  CPACK_SOURCE_TZ
+  CPACK_SOURCE_ZIP
+  )
 
 # Set some other variables
 cpack_set_if_not_set(CPACK_INSTALL_CMAKE_PROJECTS
diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake
index 1433d9e..5524a3f 100644
--- a/Modules/CPackComponent.cmake
+++ b/Modules/CPackComponent.cmake
@@ -458,6 +458,9 @@
   cpack_append_string_variable_set_command(
     CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_DESCRIPTION
     CPACK_ADDGRP_STR)
+  cpack_append_string_variable_set_command(
+    CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_PARENT_GROUP
+    CPACK_ADDGRP_STR)
   cpack_append_option_set_command(
     CPACK_COMPONENT_GROUP_${CPACK_ADDGRP_UNAME}_EXPANDED
     CPACK_ADDGRP_STR)
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake
new file mode 100644
index 0000000..4b8dc1e
--- /dev/null
+++ b/Modules/CPackIFW.cmake
@@ -0,0 +1,517 @@
+#.rst:
+# CPackIFW
+# --------
+#
+# .. _QtIFW: http://qt-project.org/doc/qtinstallerframework/index.html
+#
+# This module looks for the location of the command line utilities supplied with
+# the Qt Installer Framework (QtIFW_).
+#
+# The module also defines several commands to control the behavior of the
+# CPack ``IFW`` generator.
+#
+#
+# Overview
+# ^^^^^^^^
+#
+# CPack ``IFW`` generator helps you create online and offline
+# binary cross-platform installers with a graphical user interface.
+#
+# CPack IFW generator prepare project installation and generate configuration
+# and meta information for QtIFW_ tools.
+#
+# The QtIFW_ provides a set of tools and utilities to create
+# installers for the supported desktop Qt platforms: Linux, Microsoft Windows,
+# and Mac OS X.
+#
+# To use CPack ``IFW`` generator you must also install QtIFW_.
+# If you are not using the default path for the installation, please set
+# the path to the variable ``QTIFWDIR``.
+#
+# Variables
+# ^^^^^^^^^
+#
+# You can use the following variables to change behavior of CPack ``IFW`` generator.
+#
+# Package
+# """""""
+#
+# .. variable:: CPACK_IFW_PACKAGE_TITLE
+#
+#  Name of the installer as displayed on the title bar.
+#  By default used :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY`
+#
+# .. variable:: CPACK_IFW_PACKAGE_PUBLISHER
+#
+#  Publisher of the software (as shown in the Windows Control Panel).
+#  By default used :variable:`CPACK_PACKAGE_VENDOR`
+#
+# .. variable:: CPACK_IFW_PRODUCT_URL
+#
+#  URL to a page that contains product information on your web site.
+#
+# .. variable:: CPACK_IFW_PACKAGE_ICON
+#
+#  Filename for a custom installer icon. The actual file is '.icns' (Mac OS X),
+#  '.ico' (Windows). No functionality on Unix.
+#
+# .. variable:: CPACK_IFW_PACKAGE_WINDOW_ICON
+#
+#  Filename for a custom window icon in PNG format for the Installer application.
+#
+# .. variable:: CPACK_IFW_PACKAGE_LOGO
+#
+#  Filename for a logo used as QWizard::LogoPixmap.
+#
+# .. variable:: CPACK_IFW_TARGET_DIRECTORY
+#
+#  Default target directory for installation.
+#  By default used "@ApplicationsDir@/:variable:`CPACK_PACKAGE_INSTALL_DIRECTORY`"
+#
+#  You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_ADMIN_TARGET_DIRECTORY
+#
+#  Default target directory for installation with administrator rights.
+#
+#  You can use predefined variables.
+#
+# .. variable:: CPACK_IFW_PACKAGE_GROUP
+#
+#  The group, which will be used to configure the root package
+#
+# .. variable:: CPACK_IFW_PACKAGE_NAME
+#
+#  The root package name, which will be used if configuration group is not
+#  specified
+#
+# .. variable:: CPACK_IFW_REPOSITORIES_ALL
+#
+#  The list of remote repositories.
+#
+#  The default value of this variable is computed by CPack and contains
+#  all repositories added with command :command:`cpack_ifw_add_repository`
+#
+# .. variable:: CPACK_IFW_DOWNLOAD_ALL
+#
+#  If this is ``ON`` all components will be downloaded.
+#  By default is ``OFF`` or used value
+#  from :variable:`CPACK_DOWNLOAD_ALL` if set
+#
+# Components
+# """"""""""
+#
+# .. variable:: CPACK_IFW_RESOLVE_DUPLICATE_NAMES
+#
+#  Resolve duplicate names when installing components with groups.
+#
+# .. variable:: CPACK_IFW_PACKAGES_DIRECTORIES
+#
+#  Additional prepared packages dirs that will be used to resolve
+#  dependent components.
+#
+# Tools
+# """"""""
+#
+# .. variable:: CPACK_IFW_BINARYCREATOR_EXECUTABLE
+#
+#  The path to "binarycreator" command line client.
+#
+#  This variable is cached and can be configured user if need.
+#
+# .. variable:: CPACK_IFW_REPOGEN_EXECUTABLE
+#
+#  The path to "repogen" command line client.
+#
+#  This variable is cached and can be configured user if need.
+#
+# Commands
+# ^^^^^^^^^
+#
+# The module defines the following commands:
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+#   cpack_ifw_configure_component(<compname> [COMMON]
+#                       [NAME <name>]
+#                       [VERSION <version>]
+#                       [SCRIPT <script>]
+#                       [PRIORITY <priority>]
+#                       [DEPENDS <com_id> ...]
+#                       [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component command.
+#
+# ``COMMON`` if set, then the component will be packaged and installed as part
+# of a group to which he belongs.
+#
+# ``VERSION`` is version of component.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``SCRIPT`` is relative or absolute path to operations script
+# for this component.
+#
+# ``NAME`` is used to create domain-like identification for this component.
+# By default used origin component name.
+#
+# ``PRIORITY`` is priority of the component in the tree.
+#
+# ``DEPENDS`` list of dependency component identifiers in QtIFW_ style.
+#
+# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
+# component. You can specify more then one license.
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_configure_component_group
+#
+# Sets the arguments specific to the CPack IFW generator.
+#
+# ::
+#
+#   cpack_ifw_configure_component_group(<grpname>
+#                       [VERSION <version>]
+#                       [NAME <name>]
+#                       [SCRIPT <script>]
+#                       [PRIORITY <priority>]
+#                       [LICENSES <display_name> <file_path> ...])
+#
+# This command should be called after cpack_add_component_group command.
+#
+# ``VERSION`` is version of component group.
+# By default used :variable:`CPACK_PACKAGE_VERSION`.
+#
+# ``NAME`` is used to create domain-like identification for this component group.
+# By default used origin component group name.
+#
+# ``SCRIPT`` is relative or absolute path to operations script
+# for this component group.
+#
+# ``PRIORITY`` is priority of the component group in the tree.
+#
+# ``LICENSES`` pair of <display_name> and <file_path> of license text for this
+# component group. You can specify more then one license.
+#
+# --------------------------------------------------------------------------
+#
+# .. command:: cpack_ifw_add_repository
+#
+# Add QtIFW_ specific remote repository.
+#
+# ::
+#
+#   cpack_ifw_add_repository(<reponame> [DISABLED]
+#                       URL <url>
+#                       [USERNAME <username>]
+#                       [PASSWORD <password>]
+#                       [DISPLAY_NAME <display_name>])
+#
+# This macro will also add the <reponame> repository
+# to a variable :variable:`CPACK_IFW_REPOSITORIES_ALL`
+#
+# ``DISABLED`` if set, then the repository will be disabled by default.
+#
+# ``URL`` is points to a list of available components.
+#
+# ``USERNAME`` is used as user on a protected repository.
+#
+# ``PASSWORD`` is password to use on a protected repository.
+#
+# ``DISPLAY_NAME`` is string to display instead of the URL.
+#
+# Example usage
+# ^^^^^^^^^^^^^
+#
+# .. code-block:: cmake
+#
+#    set(CPACK_PACKAGE_NAME "MyPackage")
+#    set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyPackage Installation Example")
+#    set(CPACK_PACKAGE_VERSION "1.0.0") # Version of installer
+#
+#    include(CPack)
+#    include(CPackIFW)
+#
+#    cpack_add_component(myapp
+#        DISPLAY_NAME "MyApp"
+#        DESCRIPTION "My Application")
+#    cpack_ifw_configure_component(myapp
+#        VERSION "1.2.3" # Version of component
+#        SCRIPT "operations.qs")
+#    cpack_add_component(mybigplugin
+#        DISPLAY_NAME "MyBigPlugin"
+#        DESCRIPTION "My Big Downloadable Plugin"
+#        DOWNLOADED)
+#    cpack_ifw_add_repository(myrepo
+#        URL "http://example.com/ifw/repo/myapp"
+#        DISPLAY_NAME "My Application Repository")
+#
+#
+# Online installer
+# ^^^^^^^^^^^^^^^^
+#
+# By defaul CPack IFW generator make offline installer. This means that all
+# components will be packaged into a binary file.
+#
+# To make a component downloaded, you must set the ``DOWNLOADED`` option in
+# :command:`cpack_add_component`.
+#
+# Then you would use the command :command:`cpack_configure_downloads`.
+# If you set ``ALL`` option all components will be downloaded.
+#
+# You also can use command :command:`cpack_ifw_add_repository` and
+# variable :variable:`CPACK_IFW_DOWNLOAD_ALL` for more specific configuration.
+#
+# CPack IFW generator create "repository" dir in current binary dir. You
+# would copy content of this dir to specified ``site`` (``url``).
+#
+# See Also
+# ^^^^^^^^
+#
+# Qt Installer Framework Manual:
+#
+#  Index page
+#   http://qt-project.org/doc/qtinstallerframework/index.html
+#
+#  Component Scripting
+#   http://qt-project.org/doc/qtinstallerframework/scripting.html
+#
+#  Predefined Variables
+#   http://qt-project.org/doc/qtinstallerframework/scripting.html#predefined-variables
+#
+# Download Qt Installer Framework for you platform from Qt Project site:
+#  http://download.qt-project.org/official_releases/qt-installer-framework/
+#
+
+#=============================================================================
+# Copyright 2014 Kitware, Inc.
+# Copyright 2014 Konstantin Podsvirov <konstantin@podsvirov.pro>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+#=============================================================================
+# Search Qt Installer Framework tools
+#=============================================================================
+
+# Default path
+
+set(_CPACK_IFW_PATHS
+  "${QTIFWDIR}"
+  "$ENV{QTIFWDIR}"
+  "${QTDIR}"
+  "$ENV{QTIFWDIR}")
+if(WIN32)
+  list(APPEND _CPACK_IFW_PATHS
+    "$ENV{HOMEDRIVE}/Qt"
+    "C:/Qt")
+else()
+  list(APPEND _CPACK_IFW_PATHS
+    "$ENV{HOME}/Qt"
+    "/opt/Qt")
+endif()
+
+set(_CPACK_IFW_SUFFIXES
+  "bin"
+  "QtIFW-1.7.0/bin"
+  "QtIFW-1.6.0/bin"
+  "QtIFW-1.5.0/bin"
+  "QtIFW-1.4.0/bin"
+  "QtIFW-1.3.0/bin")
+
+# Look for 'binarycreator'
+
+find_program(CPACK_IFW_BINARYCREATOR_EXECUTABLE
+  NAMES binarycreator
+  PATHS ${_CPACK_IFW_PATHS}
+  PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+  DOC "QtIFW binarycreator command line client")
+
+mark_as_advanced(CPACK_IFW_BINARYCREATOR_EXECUTABLE)
+
+# Look for 'repogen'
+
+find_program(CPACK_IFW_REPOGEN_EXECUTABLE
+  NAMES repogen
+  PATHS ${_CPACK_IFW_PATHS}
+  PATH_SUFFIXES ${_CPACK_IFW_SUFFIXES}
+  DOC "QtIFW repogen command line client"
+  )
+mark_as_advanced(CPACK_IFW_REPOGEN_EXECUTABLE)
+
+#
+## Next code is included only once
+#
+
+if(NOT CPackIFW_CMake_INCLUDED)
+set(CPackIFW_CMake_INCLUDED 1)
+
+#=============================================================================
+# Macro definition
+#=============================================================================
+
+# Macro definition based on CPackComponent
+
+if(NOT CPackComponent_CMake_INCLUDED)
+    include(CPackComponent)
+endif()
+
+if(NOT __CMAKE_PARSE_ARGUMENTS_INCLUDED)
+    include(CMakeParseArguments)
+endif()
+
+# Resolve full filename for script file
+macro(_cpack_ifw_resolve_script _variable)
+  set(_ifw_script_macro ${_variable})
+  set(_ifw_script_file ${${_ifw_script_macro}})
+  if(DEFINED ${_ifw_script_macro})
+    get_filename_component(${_ifw_script_macro} ${_ifw_script_file} ABSOLUTE)
+    set(_ifw_script_file ${${_ifw_script_macro}})
+    if(NOT EXISTS ${_ifw_script_file})
+      message(WARNING "CPack IFW: script file \"${_ifw_script_file}\" is not exists")
+      set(${_ifw_script_macro})
+    endif()
+  endif()
+endmacro()
+
+# Resolve full path to lisense file
+macro(_cpack_ifw_resolve_lisenses _variable)
+  if(${_variable})
+    set(_ifw_license_file FALSE)
+    set(_ifw_licenses_fix)
+    foreach(_ifw_licenses_arg ${${_variable}})
+      if(_ifw_license_file)
+        get_filename_component(_ifw_licenses_arg "${_ifw_licenses_arg}" ABSOLUTE)
+        set(_ifw_license_file FALSE)
+      else()
+        set(_ifw_license_file TRUE)
+      endif()
+      list(APPEND _ifw_licenses_fix "${_ifw_licenses_arg}")
+    endforeach(_ifw_licenses_arg)
+    set(${_variable} "${_ifw_licenses_fix}")
+  endif()
+endmacro()
+
+# Macro for configure component
+macro(cpack_ifw_configure_component compname)
+
+  string(TOUPPER ${compname} _CPACK_IFWCOMP_UNAME)
+
+  set(_IFW_OPT COMMON)
+  set(_IFW_ARGS VERSION SCRIPT NAME PRIORITY)
+  set(_IFW_MULTI_ARGS DEPENDS LICENSES)
+  cmake_parse_arguments(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+  _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_SCRIPT)
+  _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_LICENSES)
+
+  set(_CPACK_IFWCOMP_STR "\n# Configuration for IFW component \"${compname}\"\n")
+
+  foreach(_IFW_ARG_NAME ${_IFW_OPT})
+  cpack_append_option_set_command(
+    CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWCOMP_STR)
+  endforeach()
+
+  foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+  cpack_append_string_variable_set_command(
+    CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWCOMP_STR)
+  endforeach()
+
+  foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+  cpack_append_variable_set_command(
+    CPACK_IFW_COMPONENT_${_CPACK_IFWCOMP_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWCOMP_STR)
+  endforeach()
+
+  if(CPack_CMake_INCLUDED)
+    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWCOMP_STR}")
+  endif()
+
+endmacro()
+
+# Macro for configure group
+macro(cpack_ifw_configure_component_group grpname)
+
+  string(TOUPPER ${grpname} _CPACK_IFWGRP_UNAME)
+
+  set(_IFW_OPT)
+  set(_IFW_ARGS NAME VERSION SCRIPT PRIORITY)
+  set(_IFW_MULTI_ARGS LICENSES)
+  cmake_parse_arguments(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+  _cpack_ifw_resolve_script(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_SCRIPT)
+  _cpack_ifw_resolve_lisenses(CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_LICENSES)
+
+  set(_CPACK_IFWGRP_STR "\n# Configuration for IFW component group \"${grpname}\"\n")
+
+  foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+  cpack_append_string_variable_set_command(
+    CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWGRP_STR)
+  endforeach()
+
+  foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+  cpack_append_variable_set_command(
+    CPACK_IFW_COMPONENT_GROUP_${_CPACK_IFWGRP_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWGRP_STR)
+  endforeach()
+
+  if(CPack_CMake_INCLUDED)
+    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWGRP_STR}")
+  endif()
+endmacro()
+
+# Macro for adding repository
+macro(cpack_ifw_add_repository reponame)
+
+  string(TOUPPER ${reponame} _CPACK_IFWREPO_UNAME)
+
+  set(_IFW_OPT DISABLED)
+  set(_IFW_ARGS URL USERNAME PASSWORD DISPLAY_NAME)
+  set(_IFW_MULTI_ARGS)
+  cmake_parse_arguments(CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME} "${_IFW_OPT}" "${_IFW_ARGS}" "${_IFW_MULTI_ARGS}" ${ARGN})
+
+  set(_CPACK_IFWREPO_STR "\n# Configuration for IFW repository \"${reponame}\"\n")
+
+  foreach(_IFW_ARG_NAME ${_IFW_OPT})
+  cpack_append_option_set_command(
+    CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWREPO_STR)
+  endforeach()
+
+  foreach(_IFW_ARG_NAME ${_IFW_ARGS})
+  cpack_append_string_variable_set_command(
+    CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWREPO_STR)
+  endforeach()
+
+  foreach(_IFW_ARG_NAME ${_IFW_MULTI_ARGS})
+  cpack_append_variable_set_command(
+    CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_${_IFW_ARG_NAME}
+    _CPACK_IFWREPO_STR)
+  endforeach()
+
+  list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})
+  set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n")
+
+  if(CPack_CMake_INCLUDED)
+    file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}")
+  endif()
+
+endmacro()
+
+endif() # NOT CPackIFW_CMake_INCLUDED
diff --git a/Modules/CheckCCompilerFlag.cmake b/Modules/CheckCCompilerFlag.cmake
index efdac20..53f3454 100644
--- a/Modules/CheckCCompilerFlag.cmake
+++ b/Modules/CheckCCompilerFlag.cmake
@@ -10,6 +10,7 @@
 #
 #   <flag> - the compiler flag
 #   <var>  - variable to store the result
+#            Will be created as an internal cache variable.
 #
 # This internally calls the check_c_source_compiles macro and sets
 # CMAKE_REQUIRED_DEFINITIONS to <flag>.  See help for
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 8721d55..6e80fb5 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.cmake
@@ -10,6 +10,7 @@
 #
 #   <code>       - source code to try to compile, must define 'main'
 #   <var>        - variable to store whether the source code compiled
+#                  Will be created as an internal cache variable.
 #   <fail-regex> - fail if test output matches this regex
 #
 # The following variables may be set before calling this macro to modify
@@ -39,7 +40,7 @@
 
 
 macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
-  if("${VAR}" MATCHES "^${VAR}$")
+  if(NOT DEFINED "${VAR}")
     set(_FAIL_REGEX)
     set(_key)
     foreach(arg ${ARGN})
diff --git a/Modules/CheckCSourceRuns.cmake b/Modules/CheckCSourceRuns.cmake
index a4fa57e..0ce423c 100644
--- a/Modules/CheckCSourceRuns.cmake
+++ b/Modules/CheckCSourceRuns.cmake
@@ -11,6 +11,7 @@
 #   <code>   - source code to try to compile
 #   <var>    - variable to store the result
 #              (1 for success, empty for failure)
+#              Will be created as an internal cache variable.
 #
 # The following variables may be set before calling this macro to modify
 # the way the check is run:
@@ -39,7 +40,7 @@
 
 
 macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
-  if("${VAR}" MATCHES "^${VAR}$")
+  if(NOT DEFINED "${VAR}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     if(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index 6ce64a1..6d52ec6 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -10,6 +10,7 @@
 #
 #   <code>       - source code to try to compile, must define 'main'
 #   <var>        - variable to store whether the source code compiled
+#                  Will be created as an internal cache variable.
 #   <fail-regex> - fail if test output matches this regex
 #
 # The following variables may be set before calling this macro to modify
@@ -39,7 +40,7 @@
 
 
 macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
-  if("${VAR}" MATCHES "^${VAR}$")
+  if(NOT DEFINED "${VAR}")
     set(_FAIL_REGEX)
     set(_key)
     foreach(arg ${ARGN})
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake
index c655863..3c06d75 100644
--- a/Modules/CheckCXXSourceRuns.cmake
+++ b/Modules/CheckCXXSourceRuns.cmake
@@ -11,6 +11,7 @@
 #   <code>   - source code to try to compile
 #   <var>    - variable to store the result
 #              (1 for success, empty for failure)
+#              Will be created as an internal cache variable.
 #
 # The following variables may be set before calling this macro to modify
 # the way the check is run:
@@ -39,7 +40,7 @@
 
 
 macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
-  if("${VAR}" MATCHES "^${VAR}$")
+  if(NOT DEFINED "${VAR}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS
       "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
     if(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckFortranFunctionExists.cmake b/Modules/CheckFortranFunctionExists.cmake
index 0b12289..bd52f61 100644
--- a/Modules/CheckFortranFunctionExists.cmake
+++ b/Modules/CheckFortranFunctionExists.cmake
@@ -10,6 +10,7 @@
 #
 #   FUNCTION - the name of the Fortran function
 #   VARIABLE - variable to store the result
+#              Will be created as an internal cache variable.
 #
 #
 #
diff --git a/Modules/CheckFortranSourceCompiles.cmake b/Modules/CheckFortranSourceCompiles.cmake
new file mode 100644
index 0000000..f90d05b
--- /dev/null
+++ b/Modules/CheckFortranSourceCompiles.cmake
@@ -0,0 +1,111 @@
+#.rst:
+# CheckFortranSourceCompiles
+# --------------------------
+#
+# Check if given Fortran source compiles and links into an executable::
+#
+#   CHECK_Fortran_SOURCE_COMPILES(<code> <var> [FAIL_REGEX <fail-regex>])
+#
+# The arguments are:
+#
+# ``<code>``
+#   Source code to try to compile.  It must define a PROGRAM entry point.
+# ``<var>``
+#   Variable to store whether the source code compiled.
+#   Will be created as an internal cache variable.
+# ``<fail-regex>``
+#   Fail if test output matches this regex.
+#
+# The following variables may be set before calling this macro to modify
+# the way the check is run::
+#
+#   CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#   CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#   CMAKE_REQUIRED_INCLUDES = list of include directories
+#   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#   CMAKE_REQUIRED_QUIET = execute quietly without messages
+
+#=============================================================================
+# Copyright 2005-2009 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+
+
+macro(CHECK_Fortran_SOURCE_COMPILES SOURCE VAR)
+  if(NOT DEFINED "${VAR}")
+    set(_FAIL_REGEX)
+    set(_key)
+    foreach(arg ${ARGN})
+      if("${arg}" MATCHES "^(FAIL_REGEX)$")
+        set(_key "${arg}")
+      elseif(_key)
+        list(APPEND _${_key} "${arg}")
+      else()
+        message(FATAL_ERROR "Unknown argument:\n  ${arg}\n")
+      endif()
+    endforeach()
+    set(MACRO_CHECK_FUNCTION_DEFINITIONS
+      "-D${VAR} ${CMAKE_REQUIRED_FLAGS}")
+    if(CMAKE_REQUIRED_LIBRARIES)
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES
+        LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
+    else()
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES)
+    endif()
+    if(CMAKE_REQUIRED_INCLUDES)
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES
+        "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}")
+    else()
+      set(CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES)
+    endif()
+    file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F"
+      "${SOURCE}\n")
+
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Performing Test ${VAR}")
+    endif()
+    try_compile(${VAR}
+      ${CMAKE_BINARY_DIR}
+      ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.F
+      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+      ${CHECK_Fortran_SOURCE_COMPILES_ADD_LIBRARIES}
+      CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}
+      "${CHECK_Fortran_SOURCE_COMPILES_ADD_INCLUDES}"
+      OUTPUT_VARIABLE OUTPUT)
+
+    foreach(_regex ${_FAIL_REGEX})
+      if("${OUTPUT}" MATCHES "${_regex}")
+        set(${VAR} 0)
+      endif()
+    endforeach()
+
+    if(${VAR})
+      set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+        "Performing Fortran SOURCE FILE Test ${VAR} succeded with the following output:\n"
+        "${OUTPUT}\n"
+        "Source file was:\n${SOURCE}\n")
+    else()
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Failed")
+      endif()
+      set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
+      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+        "Performing Fortran SOURCE FILE Test ${VAR} failed with the following output:\n"
+        "${OUTPUT}\n"
+        "Source file was:\n${SOURCE}\n")
+    endif()
+  endif()
+endmacro()
diff --git a/Modules/CheckFunctionExists.cmake b/Modules/CheckFunctionExists.cmake
index bfd1836..d277c32 100644
--- a/Modules/CheckFunctionExists.cmake
+++ b/Modules/CheckFunctionExists.cmake
@@ -10,6 +10,7 @@
 # store the result in a <variable>.  This does not verify that any
 # system header file declares the function, only that it can be found at
 # link time (consider using CheckSymbolExists).
+# <variable> will be created as an internal cache variable.
 #
 # The following variables may be set before calling this macro to modify
 # the way the check is run:
@@ -38,7 +39,7 @@
 
 
 macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS
       "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
     if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake
index ea73267..402b37c 100644
--- a/Modules/CheckIncludeFile.cmake
+++ b/Modules/CheckIncludeFile.cmake
@@ -10,6 +10,7 @@
 #
 #   INCLUDE  - name of include file
 #   VARIABLE - variable to return result
+#              Will be created as an internal cache variable.
 #
 #
 #
@@ -40,7 +41,7 @@
 #  License text for the above reference.)
 
 macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}")
     if(CMAKE_REQUIRED_INCLUDES)
       set(CHECK_INCLUDE_FILE_C_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
     else()
diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake
index 39abeff..eae1730 100644
--- a/Modules/CheckIncludeFileCXX.cmake
+++ b/Modules/CheckIncludeFileCXX.cmake
@@ -14,6 +14,7 @@
 #
 #   INCLUDE  - name of include file
 #   VARIABLE - variable to return result
+#              Will be created as an internal cache variable.
 #
 #
 #
@@ -44,7 +45,7 @@
 #  License text for the above reference.)
 
 macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
     if(CMAKE_REQUIRED_INCLUDES)
       set(CHECK_INCLUDE_FILE_CXX_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
     else()
diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake
index 6aa0f2b..2494862 100644
--- a/Modules/CheckIncludeFiles.cmake
+++ b/Modules/CheckIncludeFiles.cmake
@@ -12,6 +12,7 @@
 #
 #   INCLUDE  - list of files to include
 #   VARIABLE - variable to return result
+#              Will be created as an internal cache variable.
 #
 #
 #
@@ -39,7 +40,7 @@
 #  License text for the above reference.)
 
 macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}")
     set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
     if(CMAKE_REQUIRED_INCLUDES)
       set(CHECK_INCLUDE_FILES_INCLUDE_DIRS "-DINCLUDE_DIRECTORIES=${CMAKE_REQUIRED_INCLUDES}")
@@ -53,7 +54,7 @@
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n")
     endforeach()
     set(CMAKE_CONFIGURABLE_FILE_CONTENT
-      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(){return 0;}\n")
+      "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n")
     configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
       "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY)
 
diff --git a/Modules/CheckLibraryExists.cmake b/Modules/CheckLibraryExists.cmake
index 2b41379..95c595a 100644
--- a/Modules/CheckLibraryExists.cmake
+++ b/Modules/CheckLibraryExists.cmake
@@ -12,6 +12,7 @@
 #   FUNCTION - the name of the function
 #   LOCATION - location where the library should be found
 #   VARIABLE - variable to store the result
+#              Will be created as an internal cache variable.
 #
 #
 #
@@ -41,7 +42,7 @@
 
 
 macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}")
     set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
       "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
     if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake
index fe00074..e203d4c 100644
--- a/Modules/CheckPrototypeDefinition.cmake
+++ b/Modules/CheckPrototypeDefinition.cmake
@@ -13,6 +13,7 @@
 #   RETURN - The return value of the function.
 #   HEADER - The header files required.
 #   VARIABLE - The variable to store the result.
+#              Will be created as an internal cache variable.
 #
 # Example:
 #
@@ -56,7 +57,7 @@
 
 function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIABLE)
 
-  if ("${_VARIABLE}" MATCHES "^${_VARIABLE}$")
+  if (NOT DEFINED ${_VARIABLE})
     set(CHECK_PROTOTYPE_DEFINITION_CONTENT "/* */\n")
 
     set(CHECK_PROTOTYPE_DEFINITION_FLAGS ${CMAKE_REQUIRED_FLAGS})
diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake
index 880a688..c8949cf 100644
--- a/Modules/CheckStructHasMember.cmake
+++ b/Modules/CheckStructHasMember.cmake
@@ -70,7 +70,7 @@
 int main()
 {
    ${_STRUCT}* tmp;
-   tmp->${_MEMBER};
+   (void) tmp->${_MEMBER};
    return 0;
 }
 ")
diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake
index bf2e797..79c5ba7 100644
--- a/Modules/CheckSymbolExists.cmake
+++ b/Modules/CheckSymbolExists.cmake
@@ -9,6 +9,7 @@
 # Check that the <symbol> is available after including given header
 # <files> and store the result in a <variable>.  Specify the list of
 # files in one argument as a semicolon-separated list.
+# <variable> will be created as an internal cache variable.
 #
 # If the header files define the symbol as a macro it is considered
 # available and assumed to work.  If the header files declare the symbol
@@ -50,7 +51,7 @@
 endmacro()
 
 macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
     set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n")
     set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS})
     if(CMAKE_REQUIRED_LIBRARIES)
diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake
index 8ce6b88..73ad86e 100644
--- a/Modules/CheckTypeSize.cmake
+++ b/Modules/CheckTypeSize.cmake
@@ -19,6 +19,9 @@
 #    "0"    = type has arch-dependent size (see below)
 #    ""     = type does not exist
 #
+# Both ``HAVE_${VARIABLE}`` and ``${VARIABLE}`` will be created as internal
+# cache variables.
+#
 # Furthermore, the variable "${VARIABLE}_CODE" holds C preprocessor code
 # to define the macro "${VARIABLE}" to the size of the type, or leave
 # the macro undefined if the type does not exist.
diff --git a/Modules/CheckVariableExists.cmake b/Modules/CheckVariableExists.cmake
index 3a7ef13..f3e05e4 100644
--- a/Modules/CheckVariableExists.cmake
+++ b/Modules/CheckVariableExists.cmake
@@ -14,7 +14,7 @@
 #
 #   VAR      - the name of the variable
 #   VARIABLE - variable to store the result
-#
+#              Will be created as an internal cache variable.
 #
 #
 # This macro is only for C variables.
@@ -45,7 +45,7 @@
 
 
 macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
-  if("${VARIABLE}" MATCHES "^${VARIABLE}$")
+  if(NOT DEFINED "${VARIABLE}")
     set(MACRO_CHECK_VARIABLE_DEFINITIONS
       "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
     if(NOT CMAKE_REQUIRED_QUIET)
diff --git a/Modules/Compiler/ADSP-DetermineCompiler.cmake b/Modules/Compiler/ADSP-DetermineCompiler.cmake
index 0b5af0d..0340f69 100644
--- a/Modules/Compiler/ADSP-DetermineCompiler.cmake
+++ b/Modules/Compiler/ADSP-DetermineCompiler.cmake
@@ -4,7 +4,7 @@
 set(_compiler_id_version_compute "
 #if defined(__VISUALDSPVERSION__)
   /* __VISUALDSPVERSION__ = 0xVVRRPP00 */
-# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24)
-# define @PREFIX@COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF)
-# define @PREFIX@COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8  & 0xFF)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__VISUALDSPVERSION__>>24)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__VISUALDSPVERSION__>>16 & 0xFF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__VISUALDSPVERSION__>>8  & 0xFF)
 #endif")
diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
index d293b7b..397f95c 100644
--- a/Modules/Compiler/AppleClang-DetermineCompiler.cmake
+++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake
@@ -4,4 +4,4 @@
 include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake")
 
 set(_compiler_id_version_compute "${_compiler_id_version_compute}
-# define @PREFIX@COMPILER_VERSION_TWEAK DEC(__apple_build_version__)")
+# define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)")
diff --git a/Modules/Compiler/Borland-DetermineCompiler.cmake b/Modules/Compiler/Borland-DetermineCompiler.cmake
index 2e8a948..ef3083b 100644
--- a/Modules/Compiler/Borland-DetermineCompiler.cmake
+++ b/Modules/Compiler/Borland-DetermineCompiler.cmake
@@ -3,5 +3,5 @@
 
 set(_compiler_id_version_compute "
   /* __BORLANDC__ = 0xVRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
-# define @PREFIX@COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__BORLANDC__>>8)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__BORLANDC__ & 0xFF)")
diff --git a/Modules/Compiler/Clang-CXX.cmake b/Modules/Compiler/Clang-CXX.cmake
index bdb6d69..5dd7b4a 100644
--- a/Modules/Compiler/Clang-CXX.cmake
+++ b/Modules/Compiler/Clang-CXX.cmake
@@ -23,9 +23,12 @@
   set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++0x")
 endif()
 
-if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
-  set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++1y")
-  set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
+if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.5)
+  set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
+  set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
+elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
+  set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++1y")
+  set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++1y")
 endif()
 
 set(CMAKE_CXX_STANDARD_DEFAULT 98)
diff --git a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
index 9a37a63..08c1230 100644
--- a/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
+++ b/Modules/Compiler/Clang-DetermineCompilerInternal.cmake
@@ -1,11 +1,15 @@
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__clang_major__)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__clang_minor__)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__clang_patchlevel__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__clang_major__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__clang_minor__)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__clang_patchlevel__)
+# if defined(_MSC_VER)
+   /* _MSC_VER = VVRR */
+#  define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+#  define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
 # if defined(_MSC_VER)
 #  define @PREFIX@SIMULATE_ID \"MSVC\"
-   /* _MSC_VER = VVRR */
-#  define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
 # endif")
diff --git a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
index e4def4d..2265e5e 100644
--- a/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Comeau-CXX-DetermineCompiler.cmake
@@ -3,5 +3,5 @@
 
 set(_compiler_id_version_compute "
   /* __COMO_VERSION__ = VRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__COMO_VERSION__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__COMO_VERSION__ % 100)")
diff --git a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
index 56fedb1..02e99dc 100644
--- a/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/Compaq-C-DetermineCompiler.cmake
@@ -3,6 +3,6 @@
 
 set(_compiler_id_version_compute "
   /* __DECC_VER = VVRRTPPPP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECC_VER/100000  % 100)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECC_VER         % 10000)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECC_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECC_VER/100000  % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECC_VER         % 10000)")
diff --git a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
index 5855c24..c7d0565 100644
--- a/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/Compaq-CXX-DetermineCompiler.cmake
@@ -3,6 +3,6 @@
 
 set(_compiler_id_version_compute "
   /* __DECCXX_VER = VVRRTPPPP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000  % 100)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__DECCXX_VER         % 10000)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__DECCXX_VER/10000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__DECCXX_VER/100000  % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__DECCXX_VER         % 10000)")
diff --git a/Modules/Compiler/Cray-DetermineCompiler.cmake b/Modules/Compiler/Cray-DetermineCompiler.cmake
index 6e4eaf9..881b82c 100644
--- a/Modules/Compiler/Cray-DetermineCompiler.cmake
+++ b/Modules/Compiler/Cray-DetermineCompiler.cmake
@@ -2,5 +2,5 @@
 set(_compiler_id_pp_test "defined(_CRAYC)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_RELEASE)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_RELEASE)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_RELEASE_MINOR)")
diff --git a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
index f52d79b..2feedac 100644
--- a/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
+++ b/Modules/Compiler/Embarcadero-DetermineCompiler.cmake
@@ -2,6 +2,6 @@
 set(_compiler_id_pp_test "defined(__BORLANDC__) && defined(__CODEGEARC_VERSION__)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR HEX(__CODEGEARC_VERSION__>>24 & 0x00FF)
-# define @PREFIX@COMPILER_VERSION_MINOR HEX(__CODEGEARC_VERSION__>>16 & 0x00FF)
-# define @PREFIX@COMPILER_VERSION_PATCH HEX(__CODEGEARC_VERSION__     & 0xFFFF)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__CODEGEARC_VERSION__>>24 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__CODEGEARC_VERSION__>>16 & 0x00FF)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__CODEGEARC_VERSION__     & 0xFFFF)")
diff --git a/Modules/Compiler/Fujitsu-DetermineCompiler.cmake b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
new file mode 100644
index 0000000..73ee38c
--- /dev/null
+++ b/Modules/Compiler/Fujitsu-DetermineCompiler.cmake
@@ -0,0 +1,2 @@
+
+set(_compiler_id_pp_test "defined(__FUJITSU) || defined(__FCC_VERSION) || defined(__fcc_version)")
diff --git a/Modules/Compiler/GNU-DetermineCompiler.cmake b/Modules/Compiler/GNU-DetermineCompiler.cmake
index f0c25dd..261f148 100644
--- a/Modules/Compiler/GNU-DetermineCompiler.cmake
+++ b/Modules/Compiler/GNU-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__GNUC__)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__GNUC__)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__GNUC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__GNUC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__GNUC_MINOR__)
 # if defined(__GNUC_PATCHLEVEL__)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__GNUC_PATCHLEVEL__)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__GNUC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/HP-C-DetermineCompiler.cmake b/Modules/Compiler/HP-C-DetermineCompiler.cmake
index 024a658..4269799 100644
--- a/Modules/Compiler/HP-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/HP-C-DetermineCompiler.cmake
@@ -3,6 +3,6 @@
 
 set(_compiler_id_version_compute "
   /* __HP_cc = VVRRPP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_cc/10000)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_cc/100 % 100)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_cc     % 100)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_cc/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_cc/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_cc     % 100)")
diff --git a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
index 6999492..3d4d7e4 100644
--- a/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/HP-CXX-DetermineCompiler.cmake
@@ -3,6 +3,6 @@
 
 set(_compiler_id_version_compute "
   /* __HP_aCC = VVRRPP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__HP_aCC/10000)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__HP_aCC/100 % 100)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__HP_aCC     % 100)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__HP_aCC/10000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__HP_aCC/100 % 100)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__HP_aCC     % 100)")
diff --git a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
index 6169ab4..899e284 100644
--- a/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-C-DetermineVersionInternal.cmake
@@ -1,6 +1,6 @@
 
 set(_compiler_id_version_compute "
   /* __IBMC__ = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMC__/100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMC__/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMC__    % 10)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMC__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMC__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMC__    % 10)")
diff --git a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
index f673d72..73aa2b4 100644
--- a/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
+++ b/Modules/Compiler/IBMCPP-CXX-DetermineVersionInternal.cmake
@@ -1,6 +1,6 @@
 
 set(_compiler_id_version_compute "
   /* __IBMCPP__ = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__IBMCPP__/100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__IBMCPP__/10 % 10)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__IBMCPP__    % 10)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__IBMCPP__/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__IBMCPP__/10 % 10)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__IBMCPP__    % 10)")
diff --git a/Modules/Compiler/Intel-DetermineCompiler.cmake b/Modules/Compiler/Intel-DetermineCompiler.cmake
index 6fada1c..d7e4532 100644
--- a/Modules/Compiler/Intel-DetermineCompiler.cmake
+++ b/Modules/Compiler/Intel-DetermineCompiler.cmake
@@ -3,20 +3,24 @@
 
 set(_compiler_id_version_compute "
   /* __INTEL_COMPILER = VRP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__INTEL_COMPILER/100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__INTEL_COMPILER/10 % 10)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__INTEL_COMPILER/100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__INTEL_COMPILER/10 % 10)
 # if defined(__INTEL_COMPILER_UPDATE)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER_UPDATE)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER_UPDATE)
 # else
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__INTEL_COMPILER   % 10)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__INTEL_COMPILER   % 10)
 # endif
 # if defined(__INTEL_COMPILER_BUILD_DATE)
   /* __INTEL_COMPILER_BUILD_DATE = YYYYMMDD */
-#  define @PREFIX@COMPILER_VERSION_TWEAK DEC(__INTEL_COMPILER_BUILD_DATE)
+#  define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__INTEL_COMPILER_BUILD_DATE)
 # endif
 # if defined(_MSC_VER)
-#  define @PREFIX@SIMULATE_ID \"MSVC\"
    /* _MSC_VER = VVRR */
-#  define @PREFIX@SIMULATE_VERSION_MAJOR DEC(_MSC_VER / 100)
-#  define @PREFIX@SIMULATE_VERSION_MINOR DEC(_MSC_VER % 100)
+#  define @PREFIX@SIMULATE_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+#  define @PREFIX@SIMULATE_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
+# endif")
+
+set(_compiler_id_simulate "
+# if defined(_MSC_VER)
+#  define @PREFIX@SIMULATE_ID \"MSVC\"
 # endif")
diff --git a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
index 31eb345..9e48553 100644
--- a/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
+++ b/Modules/Compiler/MIPSpro-DetermineCompiler.cmake
@@ -4,12 +4,12 @@
 set(_compiler_id_version_compute "
 # if defined(_SGI_COMPILER_VERSION)
   /* _SGI_COMPILER_VERSION = VRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR DEC(_SGI_COMPILER_VERSION/100)
-#  define @PREFIX@COMPILER_VERSION_MINOR DEC(_SGI_COMPILER_VERSION/10 % 10)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(_SGI_COMPILER_VERSION    % 10)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_SGI_COMPILER_VERSION/100)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_SGI_COMPILER_VERSION/10 % 10)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_SGI_COMPILER_VERSION    % 10)
 # else
   /* _COMPILER_VERSION = VRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR DEC(_COMPILER_VERSION/100)
-#  define @PREFIX@COMPILER_VERSION_MINOR DEC(_COMPILER_VERSION/10 % 10)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(_COMPILER_VERSION    % 10)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_COMPILER_VERSION/100)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_COMPILER_VERSION/10 % 10)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_COMPILER_VERSION    % 10)
 # endif")
diff --git a/Modules/Compiler/MSVC-DetermineCompiler.cmake b/Modules/Compiler/MSVC-DetermineCompiler.cmake
index d462d07..313de89 100644
--- a/Modules/Compiler/MSVC-DetermineCompiler.cmake
+++ b/Modules/Compiler/MSVC-DetermineCompiler.cmake
@@ -3,17 +3,17 @@
 
 set(_compiler_id_version_compute "
   /* _MSC_VER = VVRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(_MSC_VER / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(_MSC_VER % 100)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(_MSC_VER / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(_MSC_VER % 100)
 # if defined(_MSC_FULL_VER)
 #  if _MSC_VER >= 1400
     /* _MSC_FULL_VER = VVRRPPPPP */
-#   define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 100000)
+#   define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 100000)
 #  else
     /* _MSC_FULL_VER = VVRRPPPP */
-#   define @PREFIX@COMPILER_VERSION_PATCH DEC(_MSC_FULL_VER % 10000)
+#   define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(_MSC_FULL_VER % 10000)
 #  endif
 # endif
 # if defined(_MSC_BUILD)
-#  define @PREFIX@COMPILER_VERSION_TWEAK DEC(_MSC_BUILD)
+#  define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(_MSC_BUILD)
 # endif")
diff --git a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
index 6d416c1..2ed116c 100644
--- a/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
+++ b/Modules/Compiler/OpenWatcom-DetermineCompiler.cmake
@@ -3,8 +3,8 @@
 
 set(_compiler_id_version_compute "
    /* __WATCOMC__ = VVRP + 1100 */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@((__WATCOMC__ - 1100) / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
 # if (__WATCOMC__ % 10) > 0
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
 # endif")
diff --git a/Modules/Compiler/PGI-DetermineCompiler.cmake b/Modules/Compiler/PGI-DetermineCompiler.cmake
index 8e68bd6..8d3dc9c 100644
--- a/Modules/Compiler/PGI-DetermineCompiler.cmake
+++ b/Modules/Compiler/PGI-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__PGI)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PGIC__)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PGIC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PGIC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PGIC_MINOR__)
 # if defined(__PGIC_PATCHLEVEL__)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PGIC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/PathScale-DetermineCompiler.cmake b/Modules/Compiler/PathScale-DetermineCompiler.cmake
index 3335e26..4eb81de 100644
--- a/Modules/Compiler/PathScale-DetermineCompiler.cmake
+++ b/Modules/Compiler/PathScale-DetermineCompiler.cmake
@@ -2,8 +2,8 @@
 set(_compiler_id_pp_test "defined(__PATHCC__)")
 
 set(_compiler_id_version_compute "
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__PATHCC__)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__PATHCC__)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__PATHCC_MINOR__)
 # if defined(__PATHCC_PATCHLEVEL__)
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__PATHCC_PATCHLEVEL__)
 # endif")
diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake
new file mode 100644
index 0000000..ae4a2f4
--- /dev/null
+++ b/Modules/Compiler/QCC-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/QCC)
+__compiler_qcc(C)
diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake
new file mode 100644
index 0000000..a676bbe
--- /dev/null
+++ b/Modules/Compiler/QCC-CXX.cmake
@@ -0,0 +1,12 @@
+include(Compiler/QCC)
+__compiler_qcc(CXX)
+
+# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the
+# default for the driver is not c++.
+set(CMAKE_CXX_COMPILE_OBJECT
+  "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+
+set(CMAKE_CXX_LINK_EXECUTABLE
+  "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
new file mode 100644
index 0000000..76477e4
--- /dev/null
+++ b/Modules/Compiler/QCC.cmake
@@ -0,0 +1,24 @@
+
+#=============================================================================
+# Copyright 2002-2014 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+include(Compiler/GNU)
+
+macro(__compiler_qcc lang)
+  __compiler_gnu(${lang})
+
+  # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
+  set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
+
+  set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
+  set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
+endmacro()
diff --git a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
index 8fe60d9..1d7dd78 100644
--- a/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/SDCC-C-DetermineCompiler.cmake
@@ -5,6 +5,6 @@
 
 set(_compiler_id_version_compute "
   /* SDCC = VRP */
-#  define COMPILER_VERSION_MAJOR DEC(SDCC/100)
-#  define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10)
-#  define COMPILER_VERSION_PATCH DEC(SDCC    % 10)")
+#  define COMPILER_VERSION_MAJOR @MACRO_DEC@(SDCC/100)
+#  define COMPILER_VERSION_MINOR @MACRO_DEC@(SDCC/10 % 10)
+#  define COMPILER_VERSION_PATCH @MACRO_DEC@(SDCC    % 10)")
diff --git a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
index 7db1a97..e9d7457 100644
--- a/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
+++ b/Modules/Compiler/SunPro-C-DetermineCompiler.cmake
@@ -4,12 +4,12 @@
 set(_compiler_id_version_compute "
 # if __SUNPRO_C >= 0x5100
    /* __SUNPRO_C = 0xVRRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>12)
-#  define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xFF)
-#  define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C    & 0xF)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>12)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xFF)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C    & 0xF)
 # else
    /* __SUNPRO_CC = 0xVRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_C>>8)
-#  define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_C>>4 & 0xF)
-#  define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_C    & 0xF)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_C>>8)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_C>>4 & 0xF)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_C    & 0xF)
 # endif")
diff --git a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
index 0a48cc6..5c23a95 100644
--- a/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
+++ b/Modules/Compiler/SunPro-CXX-DetermineCompiler.cmake
@@ -4,12 +4,12 @@
 set(_compiler_id_version_compute "
 # if __SUNPRO_CC >= 0x5100
    /* __SUNPRO_CC = 0xVRRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>12)
-#  define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xFF)
-#  define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>12)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xFF)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC    & 0xF)
 # else
    /* __SUNPRO_CC = 0xVRP */
-#  define @PREFIX@COMPILER_VERSION_MAJOR HEX(__SUNPRO_CC>>8)
-#  define @PREFIX@COMPILER_VERSION_MINOR HEX(__SUNPRO_CC>>4 & 0xF)
-#  define @PREFIX@COMPILER_VERSION_PATCH HEX(__SUNPRO_CC    & 0xF)
+#  define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_HEX@(__SUNPRO_CC>>8)
+#  define @PREFIX@COMPILER_VERSION_MINOR @MACRO_HEX@(__SUNPRO_CC>>4 & 0xF)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_HEX@(__SUNPRO_CC    & 0xF)
 # endif")
diff --git a/Modules/Compiler/TI-DetermineCompiler.cmake b/Modules/Compiler/TI-DetermineCompiler.cmake
index 1856c9b..19aa9e3 100644
--- a/Modules/Compiler/TI-DetermineCompiler.cmake
+++ b/Modules/Compiler/TI-DetermineCompiler.cmake
@@ -3,6 +3,6 @@
 
 set(_compiler_id_version_compute "
   /* __TI_COMPILER_VERSION__ = VVVRRRPPP */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000   % 1000)
-# define @PREFIX@COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__        % 1000)")
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000000)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@(__TI_COMPILER_VERSION__/1000   % 1000)
+# define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__TI_COMPILER_VERSION__        % 1000)")
diff --git a/Modules/Compiler/Watcom-DetermineCompiler.cmake b/Modules/Compiler/Watcom-DetermineCompiler.cmake
index cc59abf..153e350 100644
--- a/Modules/Compiler/Watcom-DetermineCompiler.cmake
+++ b/Modules/Compiler/Watcom-DetermineCompiler.cmake
@@ -3,8 +3,8 @@
 
 set(_compiler_id_version_compute "
    /* __WATCOMC__ = VVRR */
-# define @PREFIX@COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define @PREFIX@COMPILER_VERSION_MINOR DEC((__WATCOMC__ / 10) % 10)
+# define @PREFIX@COMPILER_VERSION_MAJOR @MACRO_DEC@(__WATCOMC__ / 100)
+# define @PREFIX@COMPILER_VERSION_MINOR @MACRO_DEC@((__WATCOMC__ / 10) % 10)
 # if (__WATCOMC__ % 10) > 0
-#  define @PREFIX@COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+#  define @PREFIX@COMPILER_VERSION_PATCH @MACRO_DEC@(__WATCOMC__ % 10)
 # endif")
diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in
index 1a7a539..a17d03d 100644
--- a/Modules/CompilerId/VS-10.vcxproj.in
+++ b/Modules/CompilerId/VS-10.vcxproj.in
@@ -10,6 +10,9 @@
     <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
     <RootNamespace>CompilerId@id_lang@</RootNamespace>
     <Keyword>Win32Proj</Keyword>
+    @id_system@
+    @id_system_version@
+    @id_WindowsSDKDesktopARMSupport@
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
diff --git a/Modules/CompilerId/VS-NsightTegra.vcxproj.in b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
new file mode 100644
index 0000000..b7389eb
--- /dev/null
+++ b/Modules/CompilerId/VS-NsightTegra.vcxproj.in
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <PropertyGroup Label="NsightTegraProject">
+    <NsightTegraProjectRevisionNumber>6</NsightTegraProjectRevisionNumber>
+  </PropertyGroup>
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|@id_platform@">
+      <Configuration>Debug</Configuration>
+      <Platform>@id_platform@</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{CAE07175-D007-4FC3-BFE8-47B392814159}</ProjectGuid>
+    <RootNamespace>CompilerId@id_lang@</RootNamespace>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'" Label="Configuration">
+    <ConfigurationType>StaticLibrary</ConfigurationType>
+    @id_toolset@
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">.\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">$(Configuration)\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|@id_platform@'">
+    <ClCompile>
+      <PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+    </Link>
+    <PostBuildEvent>
+      <Command>
+if "$(ToolchainName)"=="gcc" (
+  for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_gcc@.exe) do (
+    @echo CMAKE_@id_lang@_COMPILER=%%i
+    goto :done
+    )
+)
+if "$(ToolchainName)"=="clang" (
+  for %%i in ($(ToolchainPrebuiltRoot)\bin\*@id_clang@.exe) do (
+    @echo CMAKE_@id_lang@_COMPILER=%%i
+    goto :done
+  )
+)
+:done
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="@id_src@" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+</Project>
diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in
index eabfc6b..aebae27 100644
--- a/Modules/CompilerId/Xcode-3.pbxproj.in
+++ b/Modules/CompilerId/Xcode-3.pbxproj.in
@@ -29,7 +29,7 @@
 			);
 			name = CompilerId@id_lang@;
 			productName = CompilerId@id_lang@;
-			productType = "com.apple.product-type.tool";
+			productType = "@id_product_type@";
 		};
 		08FB7793FE84155DC02AAC07 = {
 			isa = PBXProject;
@@ -81,6 +81,7 @@
 			buildSettings = {
 				ARCHS = "$(ARCHS_STANDARD_32_BIT)";
 				ONLY_ACTIVE_ARCH = YES;
+				@id_code_sign_identity@
 				CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)";
 				SYMROOT = .;
 				@id_toolset@
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 68fadf6..37a0a40 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -37,6 +37,9 @@
 MakeCommand: @MAKECOMMAND@
 DefaultCTestConfigurationType: @DEFAULT_CTEST_CONFIGURATION_TYPE@
 
+# version control
+UpdateVersionOnly: @CTEST_UPDATE_VERSION_ONLY@
+
 # CVS options
 # Default is "-d -P -A"
 CVSCommand: @CVSCOMMAND@
@@ -71,6 +74,8 @@
 PurifyCommand: @PURIFYCOMMAND@
 ValgrindCommand: @VALGRIND_COMMAND@
 ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
+MemoryCheckType: @MEMORYCHECK_TYPE@
+MemoryCheckSanitizerOptions: @MEMORYCHECK_SANITIZER_OPTIONS@
 MemoryCheckCommand: @MEMORYCHECK_COMMAND@
 MemoryCheckCommandOptions: @MEMORYCHECK_COMMAND_OPTIONS@
 MemoryCheckSuppressionFile: @MEMORYCHECK_SUPPRESSIONS_FILE@
diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake
index 9b31567..b1a2370 100644
--- a/Modules/DeployQt4.cmake
+++ b/Modules/DeployQt4.cmake
@@ -37,7 +37,8 @@
 #
 # ::
 #
-#   FIXUP_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
+#   FIXUP_QT4_EXECUTABLE(<executable>
+#     [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf>])
 #
 # Copies Qt plugins, writes a Qt configuration file (if needed) and
 # fixes up a Qt4 executable using BundleUtilities so it is standalone
@@ -63,7 +64,8 @@
 #
 # ::
 #
-#   INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var <plugins_dir> <component> <configurations>)
+#   INSTALL_QT4_PLUGIN_PATH(plugin executable copy installed_plugin_path_var
+#                           <plugins_dir> <component> <configurations>)
 #
 # Install (or copy) a resolved <plugin> to the default plugins directory
 # (or <plugins_dir>) relative to <executable> and store the result in
@@ -77,7 +79,8 @@
 #
 # ::
 #
-#   INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var <plugins_dir> <component>)
+#   INSTALL_QT4_PLUGIN(plugin executable copy installed_plugin_path_var
+#                      <plugins_dir> <component>)
 #
 # Install (or copy) an unresolved <plugin> to the default plugins
 # directory (or <plugins_dir>) relative to <executable> and store the
@@ -86,7 +89,8 @@
 #
 # ::
 #
-#   INSTALL_QT4_EXECUTABLE(<executable> [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
+#   INSTALL_QT4_EXECUTABLE(<executable>
+#     [<qtplugins> <libs> <dirs> <plugins_dir> <request_qt_conf> <component>])
 #
 # Installs Qt plugins, writes a Qt configuration file (if needed) and
 # fixes up a Qt4 executable using BundleUtilities so it is standalone
diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake
index 73a4990..79bb064 100644
--- a/Modules/ExternalData.cmake
+++ b/Modules/ExternalData.cmake
@@ -76,7 +76,7 @@
 #  SHA512      .sha512   US Secure Hash Algorithms, RFC 4634
 #
 # Note that the hashes are used only for unique data identification and
-# download verification.  This is not security software.
+# download verification.
 #
 # Example usage:
 #
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 0d35cca..d6a6b72 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -26,7 +26,7 @@
 #    [CVS_MODULE mod]            # Module to checkout from CVS repo
 #    [CVS_TAG tag]               # Tag to checkout from CVS repo
 #    [SVN_REPOSITORY url]        # URL of Subversion repo
-#    [SVN_REVISION rev]          # Revision to checkout from Subversion repo
+#    [SVN_REVISION -r<rev>]      # Revision to checkout from Subversion repo
 #    [SVN_USERNAME john ]        # Username for Subversion checkout and update
 #    [SVN_PASSWORD doe ]         # Password for Subversion checkout and update
 #    [SVN_TRUST_CERT 1 ]         # Trust the Subversion server site certificate
@@ -49,6 +49,7 @@
 #    [CONFIGURE_COMMAND cmd...]  # Build tree configuration command
 #    [CMAKE_COMMAND /.../cmake]  # Specify alternative cmake executable
 #    [CMAKE_GENERATOR gen]       # Specify generator for native build
+#    [CMAKE_GENERATOR_PLATFORM p] # Generator-specific platform name
 #    [CMAKE_GENERATOR_TOOLSET t] # Generator-specific toolset name
 #    [CMAKE_ARGS args...]        # Arguments to CMake command line
 #    [CMAKE_CACHE_ARGS args...]  # Initial cache arguments, of the form -Dvar:string=on
@@ -239,7 +240,7 @@
     set(is_value 1)
 
     if(arg MATCHES "^[A-Z][A-Z0-9_][A-Z0-9_]+$" AND
-        NOT ((arg STREQUAL "${key}") AND (key STREQUAL "COMMAND")) AND
+        NOT (("x${arg}x" STREQUAL "x${key}x") AND ("x${key}x" STREQUAL "xCOMMANDx")) AND
         NOT arg MATCHES "^(TRUE|FALSE)$")
       if(_ep_keywords_${f} AND arg MATCHES "${_ep_keywords_${f}}")
         set(is_value 0)
@@ -627,11 +628,6 @@
     set(show_progress "SHOW_PROGRESS")
   endif()
 
-  if("${hash}" MATCHES "${_ep_hash_regex}")
-    set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2})
-  else()
-    set(hash_args "# no EXPECTED_HASH")
-  endif()
   # check for curl globals in the project
   if(DEFINED CMAKE_TLS_VERIFY)
     set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})")
@@ -667,7 +663,6 @@
   \"${remote}\"
   \"${local}\"
   ${show_progress}
-  ${hash_args}
   ${timeout_args}
   STATUS status
   LOG log)
@@ -711,6 +706,7 @@
     file(REMOVE \"\${file}\")
     execute_process(COMMAND \${CMAKE_COMMAND} -P \"${download_script}\")
   endif()
+  math(EXPR attempt \"\${attempt} + 1\")
 endwhile()
 
 if(\${succeeded})
@@ -737,7 +733,7 @@
 function(_ep_write_extractfile_script script_filename name filename directory)
   set(args "")
 
-  if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$")
+  if(filename MATCHES "(\\.|=)(7z|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
     set(args xfz)
   endif()
 
@@ -746,7 +742,7 @@
   endif()
 
   if(args STREQUAL "")
-    message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz and .zip")
+    message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .7z, .tar, .tar.bz2, .tar.gz, .tar.xz, .tbz2, .tgz, .txz and .zip")
     return()
   endif()
 
@@ -1540,11 +1536,11 @@
         if("x${fname}" STREQUAL "x")
           string(REGEX MATCH "[^/\\?]*$" fname "${url}")
         endif()
-        if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
-          string(REGEX MATCH "([^/\\?]+(\\.|=)(bz2|tar|tgz|tar\\.gz|zip))/.*$" match_result "${url}")
+        if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
+          string(REGEX MATCH "([^/\\?]+(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip))/.*$" match_result "${url}")
           set(fname "${CMAKE_MATCH_1}")
         endif()
-        if(NOT "${fname}" MATCHES "(\\.|=)(bz2|tar|tgz|tar\\.gz|zip)$")
+        if(NOT "${fname}" MATCHES "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$")
           message(FATAL_ERROR "Could not extract tarball filename from url:\n  ${url}")
         endif()
         string(REPLACE ";" "-" fname "${fname}")
@@ -1757,9 +1753,13 @@
     endif()
 
     get_target_property(cmake_generator ${name} _EP_CMAKE_GENERATOR)
+    get_target_property(cmake_generator_platform ${name} _EP_CMAKE_GENERATOR_PLATFORM)
     get_target_property(cmake_generator_toolset ${name} _EP_CMAKE_GENERATOR_TOOLSET)
     if(cmake_generator)
       list(APPEND cmd "-G${cmake_generator}")
+      if(cmake_generator_platform)
+        list(APPEND cmd "-A${cmake_generator_platform}")
+      endif()
       if(cmake_generator_toolset)
         list(APPEND cmd "-T${cmake_generator_toolset}")
       endif()
@@ -1769,6 +1769,12 @@
       else()
         list(APPEND cmd "-G${CMAKE_GENERATOR}")
       endif()
+      if(cmake_generator_platform)
+        message(FATAL_ERROR "Option CMAKE_GENERATOR_PLATFORM not allowed without CMAKE_GENERATOR.")
+      endif()
+      if(CMAKE_GENERATOR_PLATFORM)
+        list(APPEND cmd "-A${CMAKE_GENERATOR_PLATFORM}")
+      endif()
       if(cmake_generator_toolset)
         message(FATAL_ERROR "Option CMAKE_GENERATOR_TOOLSET not allowed without CMAKE_GENERATOR.")
       endif()
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 12ea384..37bc6b5 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -55,21 +55,32 @@
 # The WHAT option is the only mandatory option.  Here you specify what
 # information will be printed:
 #
-# ::
-#
-#     ALL: print everything
-#     ENABLED_FEATURES: the list of all features which are enabled
-#     DISABLED_FEATURES: the list of all features which are disabled
-#     PACKAGES_FOUND: the list of all packages which have been found
-#     PACKAGES_NOT_FOUND: the list of all packages which have not been found
-#     OPTIONAL_PACKAGES_FOUND: only those packages which have been found which have the type OPTIONAL
-#     OPTIONAL_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type OPTIONAL
-#     RECOMMENDED_PACKAGES_FOUND: only those packages which have been found which have the type RECOMMENDED
-#     RECOMMENDED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RECOMMENDED
-#     REQUIRED_PACKAGES_FOUND: only those packages which have been found which have the type REQUIRED
-#     REQUIRED_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type REQUIRED
-#     RUNTIME_PACKAGES_FOUND: only those packages which have been found which have the type RUNTIME
-#     RUNTIME_PACKAGES_NOT_FOUND: only those packages which have not been found which have the type RUNTIME
+# ``ALL``
+#  print everything
+# ``ENABLED_FEATURES``
+#  the list of all features which are enabled
+# ``DISABLED_FEATURES``
+#  the list of all features which are disabled
+# ``PACKAGES_FOUND``
+#  the list of all packages which have been found
+# ``PACKAGES_NOT_FOUND``
+#  the list of all packages which have not been found
+# ``OPTIONAL_PACKAGES_FOUND``
+#  only those packages which have been found which have the type OPTIONAL
+# ``OPTIONAL_PACKAGES_NOT_FOUND``
+#  only those packages which have not been found which have the type OPTIONAL
+# ``RECOMMENDED_PACKAGES_FOUND``
+#  only those packages which have been found which have the type RECOMMENDED
+# ``RECOMMENDED_PACKAGES_NOT_FOUND``
+#  only those packages which have not been found which have the type RECOMMENDED
+# ``REQUIRED_PACKAGES_FOUND``
+#  only those packages which have been found which have the type REQUIRED
+# ``REQUIRED_PACKAGES_NOT_FOUND``
+#  only those packages which have not been found which have the type REQUIRED
+# ``RUNTIME_PACKAGES_FOUND``
+#  only those packages which have been found which have the type RUNTIME
+# ``RUNTIME_PACKAGES_NOT_FOUND``
+#  only those packages which have not been found which have the type RUNTIME
 #
 # With the exception of the ``ALL`` value, these values can be combined
 # in order to customize the output. For example:
@@ -118,10 +129,11 @@
 #
 # ::
 #
-#     SET_PACKAGE_PROPERTIES(<name> PROPERTIES [ URL <url> ]
-#                                              [ DESCRIPTION <description> ]
-#                                              [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
-#                                              [ PURPOSE <purpose> ]
+#     SET_PACKAGE_PROPERTIES(<name> PROPERTIES
+#                            [ URL <url> ]
+#                            [ DESCRIPTION <description> ]
+#                            [ TYPE (RUNTIME|OPTIONAL|RECOMMENDED|REQUIRED) ]
+#                            [ PURPOSE <purpose> ]
 #                           )
 #
 #
@@ -171,26 +183,30 @@
 # ::
 #
 #    find_package(LibXml2)
-#    set_package_properties(LibXml2 PROPERTIES DESCRIPTION "A XML processing library."
-#                                              URL "http://xmlsoft.org/")
+#    set_package_properties(LibXml2 PROPERTIES
+#                           DESCRIPTION "A XML processing library."
+#                           URL "http://xmlsoft.org/")
 #
 #
 #
 # ::
 #
-#    set_package_properties(LibXml2 PROPERTIES TYPE RECOMMENDED
-#                                              PURPOSE "Enables HTML-import in MyWordProcessor")
+#    set_package_properties(LibXml2 PROPERTIES
+#                           TYPE RECOMMENDED
+#                           PURPOSE "Enables HTML-import in MyWordProcessor")
 #    ...
-#    set_package_properties(LibXml2 PROPERTIES TYPE OPTIONAL
-#                                              PURPOSE "Enables odt-export in MyWordProcessor")
+#    set_package_properties(LibXml2 PROPERTIES
+#                           TYPE OPTIONAL
+#                           PURPOSE "Enables odt-export in MyWordProcessor")
 #
 #
 #
 # ::
 #
 #    find_package(DBUS)
-#    set_package_properties(DBUS PROPERTIES TYPE RUNTIME
-#                                              PURPOSE "Necessary to disable the screensaver during a presentation" )
+#    set_package_properties(DBUS PROPERTIES
+#      TYPE RUNTIME
+#      PURPOSE "Necessary to disable the screensaver during a presentation" )
 #
 #
 #
diff --git a/Modules/FindBacktrace.cmake b/Modules/FindBacktrace.cmake
index 5620661..cb4f60a 100644
--- a/Modules/FindBacktrace.cmake
+++ b/Modules/FindBacktrace.cmake
@@ -5,18 +5,24 @@
 # Find provider for backtrace(3).
 #
 # Checks if OS supports backtrace(3) via either libc or custom library.
-# This module defines the following variables::
+# This module defines the following variables:
 #
-#  Backtrace_HEADER       - The header file needed for backtrace(3). Cached.
-#                           Could be forcibly set by user.
-#  Backtrace_INCLUDE_DIRS - The include directories needed to use backtrace(3) header.
-#  Backtrace_LIBRARIES    - The libraries (linker flags) needed to use backtrace(3), if any.
-#  Backtrace_FOUND        - Is set if and only if backtrace(3) support detected.
+# ``Backtrace_HEADER``
+#   The header file needed for backtrace(3). Cached.
+#   Could be forcibly set by user.
+# ``Backtrace_INCLUDE_DIRS``
+#   The include directories needed to use backtrace(3) header.
+# ``Backtrace_LIBRARIES``
+#   The libraries (linker flags) needed to use backtrace(3), if any.
+# ``Backtrace_FOUND``
+#   Is set if and only if backtrace(3) support detected.
 #
-# The following cache variables are also available to set or use::
+# The following cache variables are also available to set or use:
 #
-#  Backtrace_LIBRARY     - The external library providing backtrace, if any.
-#  Backtrace_INCLUDE_DIR - The directory holding the backtrace(3) header.
+# ``Backtrace_LIBRARY``
+#   The external library providing backtrace, if any.
+# ``Backtrace_INCLUDE_DIR``
+#   The directory holding the backtrace(3) header.
 #
 # Typical usage is to generate of header file using configure_file() with the
 # contents like the following::
@@ -44,7 +50,7 @@
 
 include(CMakePushCheckState)
 include(CheckSymbolExists)
-include(FindPackageHandleStandardArgs)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 
 # List of variables to be provided to find_package_handle_standard_args()
 set(_Backtrace_STD_ARGS Backtrace_INCLUDE_DIR)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index dfd4460..3642b3e 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -375,14 +375,16 @@
 # Guesses Boost's compiler prefix used in built library names
 # Returns the guess by setting the variable pointed to by _ret
 function(_Boost_GUESS_COMPILER_PREFIX _ret)
-  if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"
-      OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
-      OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+  if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel"
+      OR CMAKE_CXX_COMPILER MATCHES "icl"
+      OR CMAKE_CXX_COMPILER MATCHES "icpc")
     if(WIN32)
       set (_boost_COMPILER "-iw")
     else()
       set (_boost_COMPILER "-il")
     endif()
+  elseif (MSVC14)
+    set(_boost_COMPILER "-vc140")
   elseif (MSVC12)
     set(_boost_COMPILER "-vc120")
   elseif (MSVC11)
@@ -401,7 +403,7 @@
     set(_boost_COMPILER "-vc6") # yes, this is correct
   elseif (BORLAND)
     set(_boost_COMPILER "-bcb")
-  elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "SunPro")
+  elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
     set(_boost_COMPILER "-sw")
   elseif (MINGW)
     if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index d9809ad..3dd975c 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -452,7 +452,17 @@
 if(CMAKE_GENERATOR MATCHES "Visual Studio")
   set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC")
 else()
-  set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC")
+  # Using cc which is symlink to clang may let NVCC think it is GCC and issue
+  # unhandled -dumpspecs option to clang. Also in case neither
+  # CMAKE_C_COMPILER is defined (project does not use C language) nor
+  # CUDA_HOST_COMPILER is specified manually we should skip -ccbin and let
+  # nvcc use its own default C compiler.
+  if(DEFINED CMAKE_C_COMPILER AND NOT DEFINED CUDA_HOST_COMPILER)
+    get_filename_component(c_compiler_realpath "${CMAKE_C_COMPILER}" REALPATH)
+  else()
+    set(c_compiler_realpath "")
+  endif()
+  set(CUDA_HOST_COMPILER "${c_compiler_realpath}" CACHE FILEPATH "Host side compiler used by NVCC")
 endif()
 
 # Propagate the host flags to the host compiler via -Xcompiler
@@ -693,18 +703,6 @@
 else()
   set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY})
 endif()
-if(APPLE)
-  # We need to add the path to cudart to the linker using rpath, since the
-  # library name for the cuda libraries is prepended with @rpath.
-  if(CUDA_BUILD_EMULATION AND CUDA_CUDARTEMU_LIBRARY)
-    get_filename_component(_cuda_path_to_cudart "${CUDA_CUDARTEMU_LIBRARY}" PATH)
-  else()
-    get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH)
-  endif()
-  if(_cuda_path_to_cudart)
-    list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}")
-  endif()
-endif()
 
 # 1.1 toolkit on linux doesn't appear to have a separate library on
 # some platforms.
@@ -884,15 +882,15 @@
   set( ${_options} )
   set( _found_options FALSE )
   foreach(arg ${ARGN})
-    if(arg STREQUAL "OPTIONS")
+    if("x${arg}" STREQUAL "xOPTIONS")
       set( _found_options TRUE )
     elseif(
-        arg STREQUAL "WIN32" OR
-        arg STREQUAL "MACOSX_BUNDLE" OR
-        arg STREQUAL "EXCLUDE_FROM_ALL" OR
-        arg STREQUAL "STATIC" OR
-        arg STREQUAL "SHARED" OR
-        arg STREQUAL "MODULE"
+        "x${arg}" STREQUAL "xWIN32" OR
+        "x${arg}" STREQUAL "xMACOSX_BUNDLE" OR
+        "x${arg}" STREQUAL "xEXCLUDE_FROM_ALL" OR
+        "x${arg}" STREQUAL "xSTATIC" OR
+        "x${arg}" STREQUAL "xSHARED" OR
+        "x${arg}" STREQUAL "xMODULE"
         )
       list(APPEND ${_cmake_options} ${arg})
     else()
@@ -1422,7 +1420,7 @@
     # If -ccbin, --compiler-bindir has been specified, don't do anything.  Otherwise add it here.
     list( FIND nvcc_flags "-ccbin" ccbin_found0 )
     list( FIND nvcc_flags "--compiler-bindir" ccbin_found1 )
-    if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+    if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
       list(APPEND nvcc_flags -ccbin "\"${CUDA_HOST_COMPILER}\"")
     endif()
     # Create a list of flags specified by CUDA_NVCC_FLAGS_${CONFIG}
diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake
index f0aac84..abdd307 100644
--- a/Modules/FindCUDA/run_nvcc.cmake
+++ b/Modules/FindCUDA/run_nvcc.cmake
@@ -62,7 +62,7 @@
 set(CUDA_make2cmake "@CUDA_make2cmake@") # path
 set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path
 set(build_cubin @build_cubin@) # bool
-set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool
+set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # path
 # We won't actually use these variables for now, but we need to set this, in
 # order to force this file to be run again if it changes.
 set(generated_file_path "@generated_file_path@") # path
@@ -106,7 +106,7 @@
 # Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority
 list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 )
 list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 )
-if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 )
+if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 AND CUDA_HOST_COMPILER )
   if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN)
     set(CCBIN -ccbin "${CCBIN}")
   else()
@@ -126,7 +126,7 @@
 # and other return variables are present after executing the process.
 macro(cuda_execute_process status command)
   set(_command ${command})
-  if(NOT _command STREQUAL "COMMAND")
+  if(NOT "x${_command}" STREQUAL "xCOMMAND")
     message(FATAL_ERROR "Malformed call to cuda_execute_process.  Missing COMMAND as second argument. (command = ${command})")
   endif()
   if(verbose)
diff --git a/Modules/FindCurses.cmake b/Modules/FindCurses.cmake
index 9b633c7..0184c39 100644
--- a/Modules/FindCurses.cmake
+++ b/Modules/FindCurses.cmake
@@ -2,28 +2,43 @@
 # FindCurses
 # ----------
 #
-# Find the curses include file and library
+# Find the curses or ncurses include file and library.
 #
+# Result Variables
+# ^^^^^^^^^^^^^^^^
 #
+# This module defines the following variables:
 #
-# ::
+# ``CURSES_FOUND``
+#   True if Curses is found.
+# ``CURSES_INCLUDE_DIRS``
+#   The include directories needed to use Curses.
+# ``CURSES_LIBRARIES``
+#   The libraries needed to use Curses.
+# ``CURSES_HAVE_CURSES_H``
+#   True if curses.h is available.
+# ``CURSES_HAVE_NCURSES_H``
+#   True if ncurses.h is available.
+# ``CURSES_HAVE_NCURSES_NCURSES_H``
+#   True if ``ncurses/ncurses.h`` is available.
+# ``CURSES_HAVE_NCURSES_CURSES_H``
+#   True if ``ncurses/curses.h`` is available.
 #
-#   CURSES_FOUND - system has Curses
-#   CURSES_INCLUDE_DIR - the Curses include directory
-#   CURSES_LIBRARIES - The libraries needed to use Curses
-#   CURSES_HAVE_CURSES_H - true if curses.h is available
-#   CURSES_HAVE_NCURSES_H - true if ncurses.h is available
-#   CURSES_HAVE_NCURSES_NCURSES_H - true if ncurses/ncurses.h is available
-#   CURSES_HAVE_NCURSES_CURSES_H - true if ncurses/curses.h is available
-#   CURSES_LIBRARY - set for backwards compatibility with 2.4 CMake
+# Set ``CURSES_NEED_NCURSES`` to ``TRUE`` before the
+# ``find_package(Curses)`` call if NCurses functionality is required.
 #
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
 #
+# The following variable are provided for backward compatibility:
 #
-# Set CURSES_NEED_NCURSES to TRUE before the find_package() command if
-# NCurses functionality is required.
+# ``CURSES_INCLUDE_DIR``
+#   Path to Curses include.  Use ``CURSES_INCLUDE_DIRS`` instead.
+# ``CURSES_LIBRARY``
+#   Path to Curses library.  Use ``CURSES_LIBRARIES`` instead.
 
 #=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
+# Copyright 2001-2014 Kitware, Inc.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -84,59 +99,27 @@
 
 endif()
 
-
-if(NOT CURSES_USE_NCURSES)
-  find_file(CURSES_HAVE_CURSES_H curses.h )
-  find_path(CURSES_CURSES_H_PATH curses.h )
-  get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
-  get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
-
-  # for compatibility with older FindCurses.cmake this has to be in the cache
-  # FORCE must not be used since this would break builds which preload a cache wqith these variables set
-  set(CURSES_INCLUDE_PATH "${CURSES_CURSES_H_PATH}"
-    CACHE FILEPATH "The curses include path")
-  set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}"
-    CACHE FILEPATH "The curses library")
-else()
-# we need to find ncurses
+if(CURSES_USE_NCURSES)
   get_filename_component(_cursesLibDir "${CURSES_NCURSES_LIBRARY}" PATH)
   get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
 
-  find_file(CURSES_HAVE_NCURSES_H         ncurses.h)
-  find_file(CURSES_HAVE_NCURSES_NCURSES_H ncurses/ncurses.h)
-  find_file(CURSES_HAVE_NCURSES_CURSES_H  ncurses/curses.h)
-  find_file(CURSES_HAVE_CURSES_H          curses.h
-    HINTS "${_cursesParentDir}/include")
-
-  find_path(CURSES_NCURSES_INCLUDE_PATH ncurses.h ncurses/ncurses.h
-    ncurses/curses.h)
-  find_path(CURSES_NCURSES_INCLUDE_PATH curses.h
-    HINTS "${_cursesParentDir}/include")
-
-  # for compatibility with older FindCurses.cmake this has to be in the cache
-  # FORCE must not be used since this would break builds which preload
-  # however if the value of the variable has NOTFOUND in it, then
-  # it is OK to force, and we need to force in order to have it work.
-  # a cache wqith these variables set
-  # only put ncurses include and library into
-  # variables if they are found
-  if(NOT CURSES_NCURSES_INCLUDE_PATH AND CURSES_HAVE_NCURSES_NCURSES_H)
-    get_filename_component(CURSES_NCURSES_INCLUDE_PATH
-      "${CURSES_HAVE_NCURSES_NCURSES_H}" PATH)
+  # Use CURSES_NCURSES_INCLUDE_PATH if set, for compatibility.
+  if(CURSES_NCURSES_INCLUDE_PATH)
+    find_path(CURSES_INCLUDE_PATH
+      NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+      PATHS ${CURSES_NCURSES_INCLUDE_PATH}
+      NO_DEFAULT_PATH
+      )
   endif()
-  if(CURSES_NCURSES_INCLUDE_PATH AND CURSES_NCURSES_LIBRARY)
-    set( FORCE_IT )
-    if(CURSES_INCLUDE_PATH MATCHES NOTFOUND)
-      set(FORCE_IT FORCE)
-    endif()
-    set(CURSES_INCLUDE_PATH "${CURSES_NCURSES_INCLUDE_PATH}"
-      CACHE FILEPATH "The curses include path" ${FORCE_IT})
-    set( FORCE_IT)
-    if(CURSES_LIBRARY MATCHES NOTFOUND)
-      set(FORCE_IT FORCE)
-    endif()
-    set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}"
-      CACHE FILEPATH "The curses library" ${FORCE_IT})
+
+  find_path(CURSES_INCLUDE_PATH
+    NAMES ncurses/ncurses.h ncurses/curses.h ncurses.h curses.h
+    HINTS "${_cursesParentDir}/include"
+    )
+
+  # Previous versions of FindCurses provided these values.
+  if(NOT DEFINED CURSES_LIBRARY)
+    set(CURSES_LIBRARY "${CURSES_NCURSES_LIBRARY}")
   endif()
 
   CHECK_LIBRARY_EXISTS("${CURSES_NCURSES_LIBRARY}"
@@ -147,6 +130,52 @@
     CHECK_LIBRARY_EXISTS("${CURSES_EXTRA_LIBRARY}"
       cbreak "" CURSES_TINFO_HAS_CBREAK)
   endif()
+else()
+  get_filename_component(_cursesLibDir "${CURSES_CURSES_LIBRARY}" PATH)
+  get_filename_component(_cursesParentDir "${_cursesLibDir}" PATH)
+
+  find_path(CURSES_INCLUDE_PATH
+    NAMES curses.h
+    HINTS "${_cursesParentDir}/include"
+    )
+
+  # Previous versions of FindCurses provided these values.
+  if(NOT DEFINED CURSES_CURSES_H_PATH)
+    set(CURSES_CURSES_H_PATH "${CURSES_INCLUDE_PATH}")
+  endif()
+  if(NOT DEFINED CURSES_LIBRARY)
+    set(CURSES_LIBRARY "${CURSES_CURSES_LIBRARY}")
+  endif()
+endif()
+
+# Report whether each possible header name exists in the include directory.
+if(NOT DEFINED CURSES_HAVE_NCURSES_NCURSES_H)
+  if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+    set(CURSES_HAVE_NCURSES_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses/ncurses.h")
+  else()
+    set(CURSES_HAVE_NCURSES_NCURSES_H "CURSES_HAVE_NCURSES_NCURSES_H-NOTFOUND")
+  endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_CURSES_H)
+  if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+    set(CURSES_HAVE_NCURSES_CURSES_H "${CURSES_INCLUDE_PATH}/ncurses/curses.h")
+  else()
+    set(CURSES_HAVE_NCURSES_CURSES_H "CURSES_HAVE_NCURSES_CURSES_H-NOTFOUND")
+  endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_NCURSES_H)
+  if(EXISTS "${CURSES_INCLUDE_PATH}/ncurses.h")
+    set(CURSES_HAVE_NCURSES_H "${CURSES_INCLUDE_PATH}/ncurses.h")
+  else()
+    set(CURSES_HAVE_NCURSES_H "CURSES_HAVE_NCURSES_H-NOTFOUND")
+  endif()
+endif()
+if(NOT DEFINED CURSES_HAVE_CURSES_H)
+  if(EXISTS "${CURSES_INCLUDE_PATH}/curses.h")
+    set(CURSES_HAVE_CURSES_H "${CURSES_INCLUDE_PATH}/curses.h")
+  else()
+    set(CURSES_HAVE_CURSES_H "CURSES_HAVE_CURSES_H-NOTFOUND")
+  endif()
 endif()
 
 if (NOT CURSES_TINFO_HAS_CBREAK)
@@ -157,11 +186,10 @@
 find_library(CURSES_FORM_LIBRARY form HINTS "${_cursesLibDir}")
 find_library(CURSES_FORM_LIBRARY form )
 
-# for compatibility with older FindCurses.cmake this has to be in the cache
-# FORCE must not be used since this would break builds which preload a cache
-# qith these variables set
-set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}"
-  CACHE FILEPATH "The curses form library")
+# Previous versions of FindCurses provided these values.
+if(NOT DEFINED FORM_LIBRARY)
+  set(FORM_LIBRARY "${CURSES_FORM_LIBRARY}")
+endif()
 
 # Need to provide the *_LIBRARIES
 set(CURSES_LIBRARIES ${CURSES_LIBRARY})
@@ -174,8 +202,9 @@
   set(CURSES_LIBRARIES ${CURSES_LIBRARIES} ${CURSES_FORM_LIBRARY})
 endif()
 
-# Proper name is *_INCLUDE_DIR
-set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH})
+# Provide the *_INCLUDE_DIRS result.
+set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
+set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
 
 # handle the QUIETLY and REQUIRED arguments and set CURSES_FOUND to TRUE if
 # all listed variables are TRUE
@@ -185,18 +214,7 @@
 
 mark_as_advanced(
   CURSES_INCLUDE_PATH
-  CURSES_LIBRARY
-  CURSES_CURSES_INCLUDE_PATH
   CURSES_CURSES_LIBRARY
-  CURSES_NCURSES_INCLUDE_PATH
   CURSES_NCURSES_LIBRARY
   CURSES_EXTRA_LIBRARY
-  FORM_LIBRARY
-  CURSES_LIBRARIES
-  CURSES_INCLUDE_DIR
-  CURSES_CURSES_HAS_WSYNCUP
-  CURSES_NCURSES_HAS_WSYNCUP
-  CURSES_NCURSES_HAS_CBREAK
-  CURSES_TINFO_HAS_CBREAK
   )
-
diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake
index 497a80c..f42182f 100644
--- a/Modules/FindGLEW.cmake
+++ b/Modules/FindGLEW.cmake
@@ -4,6 +4,15 @@
 #
 # Find the OpenGL Extension Wrangler Library (GLEW)
 #
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the :prop_tgt:`IMPORTED` target ``GLEW::GLEW``,
+# if GLEW has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
 # This module defines the following variables:
 #
 # ::
@@ -35,4 +44,11 @@
 find_package_handle_standard_args(GLEW
                                   REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
 
+if(GLEW_FOUND AND NOT TARGET GLEW::GLEW)
+  add_library(GLEW::GLEW UNKNOWN IMPORTED)
+  set_target_properties(GLEW::GLEW PROPERTIES
+    IMPORTED_LOCATION "${GLEW_LIBRARY}"
+    INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
+endif()
+
 mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
diff --git a/Modules/FindGLUT.cmake b/Modules/FindGLUT.cmake
index be7c0cd..c9f7597 100644
--- a/Modules/FindGLUT.cmake
+++ b/Modules/FindGLUT.cmake
@@ -2,7 +2,20 @@
 # FindGLUT
 # --------
 #
-# try to find glut library and include files
+# try to find glut library and include files.
+#
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the :prop_tgt:`IMPORTED` targets:
+#
+# ``GLUT::GLUT``
+#  Defined if the system has GLUT.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module sets the following variables:
 #
 # ::
 #
@@ -42,13 +55,21 @@
 else ()
 
   if (APPLE)
-    # These values for Apple could probably do with improvement.
-    find_path( GLUT_INCLUDE_DIR glut.h
-      /System/Library/Frameworks/GLUT.framework/Versions/A/Headers
-      ${OPENGL_LIBRARY_DIR}
-      )
-    set(GLUT_glut_LIBRARY "-framework GLUT" CACHE STRING "GLUT library for OSX")
-    set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
+    find_path(GLUT_INCLUDE_DIR glut.h ${OPENGL_LIBRARY_DIR})
+    find_library(GLUT_glut_LIBRARY GLUT DOC "GLUT library for OSX")
+    find_library(GLUT_cocoa_LIBRARY Cocoa DOC "Cocoa framework for OSX")
+
+    if(GLUT_cocoa_LIBRARY AND NOT TARGET GLUT::Cocoa)
+      add_library(GLUT::Cocoa UNKNOWN IMPORTED)
+      # Cocoa should always be a Framework, but we check to make sure.
+      if(GLUT_cocoa_LIBRARY MATCHES "/([^/]+)\\.framework$")
+        set_target_properties(GLUT::Cocoa PROPERTIES
+          IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}/${CMAKE_MATCH_1}")
+      else()
+        set_target_properties(GLUT::Cocoa PROPERTIES
+          IMPORTED_LOCATION "${GLUT_cocoa_LIBRARY}")
+      endif()
+    endif()
   else ()
 
     if (BEOS)
@@ -66,6 +87,18 @@
         /usr/openwin/lib
         )
 
+      if(GLUT_Xi_LIBRARY AND NOT TARGET GLUT::Xi)
+        add_library(GLUT::Xi UNKNOWN IMPORTED)
+        set_target_properties(GLUT::Xi PROPERTIES
+          IMPORTED_LOCATION "${GLUT_Xi_LIBRARY}")
+      endif()
+
+      if(GLUT_Xmu_LIBRARY AND NOT TARGET GLUT::Xmu)
+        add_library(GLUT::Xmu UNKNOWN IMPORTED)
+        set_target_properties(GLUT::Xmu PROPERTIES
+          IMPORTED_LOCATION "${GLUT_Xmu_LIBRARY}")
+      endif()
+
     endif ()
 
     find_path( GLUT_INCLUDE_DIR GL/glut.h
@@ -102,6 +135,34 @@
     ${GLUT_cocoa_LIBRARY}
     )
 
+  if(NOT TARGET GLUT::GLUT)
+    add_library(GLUT::GLUT UNKNOWN IMPORTED)
+    set_target_properties(GLUT::GLUT PROPERTIES
+      INTERFACE_INCLUDE_DIRECTORIES "${GLUT_INCLUDE_DIR}")
+    if(GLUT_glut_LIBRARY MATCHES "/([^/]+)\\.framework$")
+      set_target_properties(GLUT::GLUT PROPERTIES
+        IMPORTED_LOCATION "${GLUT_glut_LIBRARY}/${CMAKE_MATCH_1}")
+    else()
+      set_target_properties(GLUT::GLUT PROPERTIES
+        IMPORTED_LOCATION "${GLUT_glut_LIBRARY}")
+    endif()
+
+    if(TARGET GLUT::Xmu)
+      set_property(TARGET GLUT::GLUT APPEND
+        PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xmu)
+    endif()
+
+    if(TARGET GLUT::Xi)
+      set_property(TARGET GLUT::GLUT APPEND
+        PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Xi)
+    endif()
+
+    if(TARGET GLUT::Cocoa)
+      set_property(TARGET GLUT::GLUT APPEND
+        PROPERTY INTERFACE_LINK_LIBRARIES GLUT::Cocoa)
+    endif()
+  endif()
+
   #The following deprecated settings are for backwards compatibility with CMake1.4
   set (GLUT_LIBRARY ${GLUT_LIBRARIES})
   set (GLUT_INCLUDE_PATH ${GLUT_INCLUDE_DIR})
diff --git a/Modules/FindGTK2.cmake b/Modules/FindGTK2.cmake
index eaa5e55..72bb8eb 100644
--- a/Modules/FindGTK2.cmake
+++ b/Modules/FindGTK2.cmake
@@ -527,7 +527,7 @@
             set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}_INCLUDE_DIR}")
         endif()
 
-        if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "GTK2_${_var}_INCLUDE_DIR")
+        if(GTK2_${_var}CONFIG_INCLUDE_DIR AND NOT "x${GTK2_${_var}CONFIG_INCLUDE_DIR}" STREQUAL "x${GTK2_${_var}_INCLUDE_DIR}")
             set_property(TARGET GTK2::${_basename} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${GTK2_${_var}CONFIG_INCLUDE_DIR}")
         endif()
 
@@ -540,7 +540,11 @@
         endif()
 
         if(_${_var}_OPTIONAL_INCLUDES)
-            _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_${_var}_OPTIONAL_INCLUDES})
+            foreach(_D ${_${_var}_OPTIONAL_INCLUDES})
+                if(_D)
+                    _GTK2_ADD_TARGET_INCLUDE_DIRS(${_var} ${_D})
+                endif()
+            endforeach()
         endif()
 
         if(GTK2_USE_IMPORTED_TARGETS)
diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake
index 7ab867b..16478cb 100644
--- a/Modules/FindGettext.cmake
+++ b/Modules/FindGettext.cmake
@@ -26,7 +26,7 @@
 #     ALL option is used, the translations will also be created when
 #     building the default target.
 #
-# GETTEXT_PROCESS_POT( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
+# GETTEXT_PROCESS_POT_FILE( <potfile> [ALL] [INSTALL_DESTINATION <destdir>]
 # LANGUAGES <lang1> <lang2> ...  )
 #
 # ::
diff --git a/Modules/FindHg.cmake b/Modules/FindHg.cmake
index c418afd..34d763e 100644
--- a/Modules/FindHg.cmake
+++ b/Modules/FindHg.cmake
@@ -66,7 +66,11 @@
   execute_process(COMMAND ${HG_EXECUTABLE} --version
                   OUTPUT_VARIABLE hg_version
                   ERROR_QUIET
+                  RESULT_VARIABLE hg_result
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
+  if(hg_result MATCHES "is not a valid Win32 application")
+    set_property(CACHE HG_EXECUTABLE PROPERTY VALUE "HG_EXECUTABLE-NOTFOUND")
+  endif()
   if(hg_version MATCHES "^Mercurial Distributed SCM \\(version ([0-9][^)]*)\\)")
     set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
   endif()
diff --git a/Modules/FindITK.cmake b/Modules/FindITK.cmake
deleted file mode 100644
index c9d39eb..0000000
--- a/Modules/FindITK.cmake
+++ /dev/null
@@ -1,61 +0,0 @@
-#.rst:
-# FindITK
-# -------
-#
-# Find an ITK installation or build tree.
-
-# When ITK is found, the ITKConfig.cmake file is sourced to setup the
-# location and configuration of ITK.  Please read this file, or
-# ITKConfig.cmake.in from the ITK source tree for the full list of
-# definitions.  Of particular interest is ITK_USE_FILE, a CMake source file
-# that can be included to set the include directories, library directories,
-# and preprocessor macros.  In addition to the variables read from
-# ITKConfig.cmake, this find module also defines
-#  ITK_DIR  - The directory containing ITKConfig.cmake.
-#             This is either the root of the build tree,
-#             or the lib/InsightToolkit directory.
-#             This is the only cache entry.
-#
-#  ITK_FOUND - Whether ITK was found.  If this is true,
-#              ITK_DIR is okay.
-#
-#  USE_ITK_FILE - The full path to the UseITK.cmake file.
-#                 This is provided for backward
-#                 compatibility.  Use ITK_USE_FILE
-#                 instead.
-
-#=============================================================================
-# Copyright 2001-2010 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
-# Use the Config mode of the find_package() command to find ITKConfig.
-# If this succeeds (possibly because ITK_DIR is already set), the
-# command will have already loaded ITKConfig.cmake and set ITK_FOUND.
-if(NOT ITK_FOUND)
-  set(_ITK_REQUIRED "")
-  if(ITK_FIND_REQUIRED)
-    set(_ITK_REQUIRED REQUIRED)
-  endif()
-  set(_ITK_QUIET "")
-  if(ITK_FIND_QUIETLY)
-    set(_ITK_QUIET QUIET)
-  endif()
-  find_package(ITK ${_ITK_REQUIRED} ${_ITK_QUIET} NO_MODULE
-    NAMES ITK InsightToolkit
-    CONFIGS ITKConfig.cmake
-    )
-endif()
-
-if(ITK_FOUND)
-  # Set USE_ITK_FILE for backward-compatibility.
-  set(USE_ITK_FILE ${ITK_USE_FILE})
-endif()
diff --git a/Modules/FindIce.cmake b/Modules/FindIce.cmake
new file mode 100644
index 0000000..55528b8
--- /dev/null
+++ b/Modules/FindIce.cmake
@@ -0,0 +1,393 @@
+#.rst:
+# FindIce
+# -------
+#
+# Find the ZeroC Internet Communication Engine (ICE) programs,
+# libraries and datafiles.
+#
+# This module supports multiple components.
+# Components can include any of: ``Freeze``, ``Glacier2``, ``Ice``,
+# ``IceBox``, ``IceDB``, ``IceGrid``, ``IcePatch``, ``IceSSL``,
+# ``IceStorm``, ``IceUtil``, ``IceXML``, or ``Slice``.
+#
+# This module reports information about the Ice installation in
+# several variables.  General variables::
+#
+#   Ice_VERSION - Ice release version
+#   Ice_FOUND - true if the main programs and libraries were found
+#   Ice_LIBRARIES - component libraries to be linked
+#   Ice_INCLUDE_DIRS - the directories containing the Ice headers
+#   Ice_SLICE_DIRS - the directories containing the Ice slice interface
+#                    definitions
+#
+# Ice programs are reported in::
+#
+#   Ice_SLICE2CPP_EXECUTABLE - path to slice2cpp executable
+#   Ice_SLICE2CS_EXECUTABLE - path to slice2cs executable
+#   Ice_SLICE2FREEZEJ_EXECUTABLE - path to slice2freezej executable
+#   Ice_SLICE2FREEZE_EXECUTABLE - path to slice2freeze executable
+#   Ice_SLICE2HTML_EXECUTABLE - path to slice2html executable
+#   Ice_SLICE2JAVA_EXECUTABLE - path to slice2java executable
+#   Ice_SLICE2PHP_EXECUTABLE - path to slice2php executable
+#   Ice_SLICE2PY_EXECUTABLE - path to slice2py executable
+#   Ice_SLICE2RB_EXECUTABLE - path to slice2rb executable
+#
+# Ice component libraries are reported in::
+#
+#   Ice_<C>_FOUND - ON if component was found
+#   Ice_<C>_LIBRARIES - libraries for component
+#
+# Note that ``<C>`` is the uppercased name of the component.
+#
+# This module reads hints about search results from::
+#
+#   Ice_HOME - the root of the Ice installation
+#
+# The environment variable :envvar:`ICE_HOME` may also be used; the
+# Ice_HOME variable takes precedence.
+#
+# The following cache variables may also be set::
+#
+#   Ice_<P>_EXECUTABLE - the path to executable <P>
+#   Ice_INCLUDE_DIR - the directory containing the Ice headers
+#   Ice_SLICE_DIR - the directory containing the Ice slice interface
+#                   definitions
+#   Ice_<C>_LIBRARY - the library for component <C>
+#
+# .. note::
+#
+#   In most cases none of the above variables will require setting,
+#   unless multiple Ice versions are available and a specific version
+#   is required.  On Windows, the most recent version of Ice will be
+#   found through the registry.  On Unix, the programs, headers and
+#   libraries will usually be in standard locations, but Ice_SLICE_DIRS
+#   might not be automatically detected (commonly known locations are
+#   searched).  All the other variables are defaulted using Ice_HOME,
+#   if set.  It's possible to set Ice_HOME and selectively specify
+#   alternative locations for the other components; this might be
+#   required for e.g. newer versions of Visual Studio if the
+#   heuristics are not sufficient to identify the correct programs and
+#   libraries for the specific Visual Studio version.
+#
+# Other variables one may set to control this module are::
+#
+#   Ice_DEBUG - Set to ON to enable debug output from FindIce.
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014 University of Dundee
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+# The Ice checks are contained in a function due to the large number
+# of temporary variables needed.
+function(_Ice_FIND)
+  # Released versions of Ice, including generic short forms
+  set(ice_versions
+      3
+      3.5
+      3.5.1
+      3.5.0
+      3.4
+      3.4.2
+      3.4.1
+      3.4.0
+      3.3
+      3.3.1
+      3.3.0)
+
+  # Set up search paths, taking compiler into account.  Search Ice_HOME,
+  # with ICE_HOME in the environment as a fallback if unset.
+  if(Ice_HOME)
+    list(APPEND ice_roots "${Ice_HOME}")
+  else()
+    if(NOT "$ENV{ICE_HOME}" STREQUAL "")
+      file(TO_CMAKE_PATH "$ENV{ICE_HOME}" NATIVE_PATH)
+      list(APPEND ice_roots "${NATIVE_PATH}")
+      set(Ice_HOME "${NATIVE_PATH}"
+          CACHE PATH "Location of the Ice installation" FORCE)
+    endif()
+  endif()
+
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    # 64-bit path suffix
+    set(_x64 "/x64")
+    # 64-bit library directory
+    set(_lib64 "lib64")
+  endif()
+
+  if(MSVC_VERSION)
+    # VS 8.0
+    if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
+      set(vcver "vc80")
+      set(vcyear "2005")
+    # VS 9.0
+    elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
+      set(vcver "vc90")
+      set(vcyear "2008")
+    # VS 10.0
+    elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
+      set(vcver "vc100")
+    # VS 11.0
+    elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
+      set(vcver "vc110")
+    # VS 12.0
+    elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
+      set(vcver "vc120")
+    # VS 14.0
+    elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 2000)
+      set(vcver "vc140")
+    endif()
+  endif()
+
+  # For compatibility with ZeroC Windows builds.
+  if(vcver)
+    # Earlier Ice (3.3) builds don't use vcnnn subdirectories, but are harmless to check.
+    list(APPEND ice_binary_suffixes "bin/${vcver}${_x64}" "bin/${vcver}")
+    list(APPEND ice_library_suffixes "lib/${vcver}${_x64}" "lib/${vcver}")
+  endif()
+  # Generic 64-bit and 32-bit directories
+  list(APPEND ice_binary_suffixes "bin${_x64}" "bin")
+  list(APPEND ice_library_suffixes "${_lib64}" "lib${_x64}" "lib")
+  list(APPEND ice_include_suffixes "include")
+  list(APPEND ice_slice_suffixes "slice")
+
+  # On Windows, look in the registry for install locations.  Different
+  # versions of Ice install support different compiler versions.
+  if(vcver)
+    foreach(ice_version ${ice_versions})
+      # Ice 3.3 releases use a Visual Studio year suffix and value is
+      # enclosed in double quotes, though only the leading quote is
+      # returned by get_filename_component.
+      unset(ice_location)
+      if(vcyear)
+        get_filename_component(ice_location
+                               "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version} for Visual Studio ${vcyear};InstallDir]"
+                               PATH)
+        if(ice_location AND NOT ("${ice_location}" STREQUAL "/registry" OR "${ice_location}" STREQUAL "/"))
+          string(REGEX REPLACE "^\"(.*)\"?$" "\\1" ice_location "${ice_location}")
+          get_filename_component(ice_location "${ice_location}" ABSOLUTE)
+        else()
+          unset(ice_location)
+        endif()
+      endif()
+      # Ice 3.4+ releases don't use a suffix
+      if(NOT ice_location OR "${ice_location}" STREQUAL "/registry")
+        get_filename_component(ice_location
+                               "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ZeroC\\Ice ${ice_version};InstallDir]"
+                               ABSOLUTE)
+      endif()
+
+      if(ice_location AND NOT "${ice_location}" STREQUAL "/registry")
+        list(APPEND ice_roots "${ice_location}")
+      endif()
+    endforeach()
+  else()
+    foreach(ice_version ${ice_versions})
+      # Prefer 64-bit variants if present (and using a 64-bit compiler)
+      list(APPEND ice_roots "/opt/Ice-${ice_version}")
+    endforeach()
+  endif()
+
+  set(ice_programs
+      slice2cpp
+      slice2cs
+      slice2freezej
+      slice2freeze
+      slice2html
+      slice2java
+      slice2php
+      slice2py
+      slice2rb)
+
+  # Find all Ice programs
+  foreach(program ${ice_programs})
+    string(TOUPPER "${program}" program_upcase)
+    set(cache_var "Ice_${program_upcase}_EXECUTABLE")
+    set(program_var "Ice_${program_upcase}_EXECUTABLE")
+    find_program("${cache_var}" "${program}"
+      HINTS ${ice_roots}
+      PATH_SUFFIXES ${ice_binary_suffixes}
+      DOC "Ice ${program} executable")
+    mark_as_advanced(cache_var)
+    set("${program_var}" "${${cache_var}}" PARENT_SCOPE)
+  endforeach()
+
+  # Get version.
+  if(Ice_SLICE2CPP_EXECUTABLE)
+    # Execute in C locale for safety
+    set(_Ice_SAVED_LC_ALL "$ENV{LC_ALL}")
+    set(ENV{LC_ALL} C)
+
+    execute_process(COMMAND ${Ice_SLICE2CPP_EXECUTABLE} --version
+      ERROR_VARIABLE Ice_VERSION_SLICE2CPP_FULL
+      ERROR_STRIP_TRAILING_WHITESPACE)
+
+    # restore the previous LC_ALL
+    set(ENV{LC_ALL} ${_Ice_SAVED_LC_ALL})
+
+    # Make short version
+    string(REGEX REPLACE "^(.*)\\.[^.]*$" "\\1" Ice_VERSION_SLICE2CPP_SHORT "${Ice_VERSION_SLICE2CPP_FULL}")
+    set(Ice_VERSION "${Ice_VERSION_SLICE2CPP_FULL}" PARENT_SCOPE)
+  endif()
+
+  if(NOT Ice_FIND_QUIETLY)
+    message(STATUS "Ice version: ${Ice_VERSION_SLICE2CPP_FULL}")
+  endif()
+
+  # Find include directory
+  find_path(Ice_INCLUDE_DIR
+            NAMES "Ice/Ice.h"
+            HINTS ${ice_roots}
+            PATH_SUFFIXES ${ice_include_suffixes}
+            DOC "Ice include directory")
+  set(Ice_INCLUDE_DIR "${Ice_INCLUDE_DIR}" PARENT_SCOPE)
+
+  # In common use on Linux, MacOS X (homebrew) and FreeBSD; prefer
+  # version-specific dir
+  list(APPEND ice_slice_paths
+       /usr/local/share /usr/share)
+  list(APPEND ice_slice_suffixes
+       "Ice-${Ice_VERSION_SLICE2CPP_FULL}/slice"
+       "Ice-${Ice_VERSION_SLICE2CPP_SHORT}/slice"
+       Ice)
+
+  # Find slice directory
+  find_path(Ice_SLICE_DIR
+            NAMES "Ice/Connection.ice"
+            HINTS ${ice_roots}
+                  ${ice_slice_paths}
+            PATH_SUFFIXES ${ice_slice_suffixes}
+            NO_DEFAULT_PATH
+            DOC "Ice slice directory")
+  set(Ice_SLICE_DIR "${Ice_SLICE_DIR}" PARENT_SCOPE)
+
+  # Find all Ice libraries
+  set(Ice_REQUIRED_LIBS_FOUND ON)
+  foreach(component ${Ice_FIND_COMPONENTS})
+    string(TOUPPER "${component}" component_upcase)
+    set(component_cache "Ice_${component_upcase}_LIBRARY")
+    set(component_found "${component_upcase}_FOUND")
+    find_library("${component_cache}" "${component}"
+      HINTS ${ice_roots}
+      PATH_SUFFIXES ${ice_library_suffixes}
+      DOC "Ice ${component} library")
+    mark_as_advanced("${component_cache}")
+    if("${component_cache}")
+      set("${component_found}" ON)
+      list(APPEND Ice_LIBRARY "${${component_cache}}")
+    endif()
+    mark_as_advanced("${component_found}")
+    set("${component_cache}" "${${component_cache}}" PARENT_SCOPE)
+    set("${component_found}" "${${component_found}}" PARENT_SCOPE)
+    if("${component_found}")
+      if ("Ice_FIND_REQUIRED_${component}")
+        list(APPEND Ice_LIBS_FOUND "${component} (required)")
+      else()
+        list(APPEND Ice_LIBS_FOUND "${component} (optional)")
+      endif()
+    else()
+      if ("Ice_FIND_REQUIRED_${component}")
+        set(Ice_REQUIRED_LIBS_FOUND OFF)
+        list(APPEND Ice_LIBS_NOTFOUND "${component} (required)")
+      else()
+        list(APPEND Ice_LIBS_NOTFOUND "${component} (optional)")
+      endif()
+    endif()
+  endforeach()
+  set(_Ice_REQUIRED_LIBS_FOUND "${Ice_REQUIRED_LIBS_FOUND}" PARENT_SCOPE)
+  set(Ice_LIBRARY "${Ice_LIBRARY}" PARENT_SCOPE)
+
+  if(NOT Ice_FIND_QUIETLY)
+    if(Ice_LIBS_FOUND)
+      message(STATUS "Found the following Ice libraries:")
+      foreach(found ${Ice_LIBS_FOUND})
+        message(STATUS "  ${found}")
+      endforeach()
+    endif()
+    if(Ice_LIBS_NOTFOUND)
+      message(STATUS "The following Ice libraries were not found:")
+      foreach(notfound ${Ice_LIBS_NOTFOUND})
+        message(STATUS "  ${notfound}")
+      endforeach()
+    endif()
+  endif()
+
+  if(Ice_DEBUG)
+    message(STATUS "--------FindIce.cmake search debug--------")
+    message(STATUS "ICE binary path search order: ${ice_roots}")
+    message(STATUS "ICE include path search order: ${ice_roots}")
+    message(STATUS "ICE slice path search order: ${ice_roots} ${ice_slice_paths}")
+    message(STATUS "ICE library path search order: ${ice_roots}")
+    message(STATUS "----------------")
+  endif()
+endfunction()
+
+_Ice_FIND()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ice
+                                  FOUND_VAR Ice_FOUND
+                                  REQUIRED_VARS Ice_SLICE2CPP_EXECUTABLE
+                                                Ice_INCLUDE_DIR
+                                                Ice_SLICE_DIR
+                                                Ice_LIBRARY
+                                                _Ice_REQUIRED_LIBS_FOUND
+                                  VERSION_VAR Ice_VERSION
+                                  FAIL_MESSAGE "Failed to find all Ice components")
+
+unset(_Ice_REQUIRED_LIBS_FOUND)
+
+if(Ice_FOUND)
+  set(Ice_INCLUDE_DIRS "${Ice_INCLUDE_DIR}")
+  set(Ice_SLICE_DIRS "${Ice_SLICE_DIR}")
+  set(Ice_LIBRARIES "${Ice_LIBRARY}")
+  foreach(_Ice_component ${Ice_FIND_COMPONENTS})
+    string(TOUPPER "${_Ice_component}" _Ice_component_upcase)
+    set(_Ice_component_cache "Ice_${_Ice_component_upcase}_LIBRARY")
+    set(_Ice_component_lib "Ice_${_Ice_component_upcase}_LIBRARIES")
+    set(_Ice_component_found "${_Ice_component_upcase}_FOUND")
+    if("${_Ice_component_found}")
+      set("${_Ice_component_lib}" "${${_Ice_component_cache}}")
+    endif()
+    unset(_Ice_component_upcase)
+    unset(_Ice_component_cache)
+    unset(_Ice_component_lib)
+    unset(_Ice_component_found)
+  endforeach()
+endif()
+
+if(Ice_DEBUG)
+  message(STATUS "--------FindIce.cmake results debug--------")
+  message(STATUS "Ice_VERSION number: ${Ice_VERSION}")
+  message(STATUS "Ice_HOME directory: ${Ice_HOME}")
+  message(STATUS "Ice_INCLUDE_DIR directory: ${Ice_INCLUDE_DIR}")
+  message(STATUS "Ice_SLICE_DIR directory: ${Ice_SLICE_DIR}")
+  message(STATUS "Ice_LIBRARIES: ${Ice_LIBRARIES}")
+  message(STATUS "slice2cpp executable: ${Ice_SLICE2CPP_EXECUTABLE}")
+  message(STATUS "slice2cs executable: ${Ice_SLICE2CS_EXECUTABLE}")
+  message(STATUS "slice2freezej executable: ${Ice_SLICE2FREEZEJ_EXECUTABLE}")
+  message(STATUS "slice2freeze executable: ${Ice_SLICE2FREEZE_EXECUTABLE}")
+  message(STATUS "slice2html executable: ${Ice_SLICE2HTML_EXECUTABLE}")
+  message(STATUS "slice2java executable: ${Ice_SLICE2JAVA_EXECUTABLE}")
+  message(STATUS "slice2php executable: ${Ice_SLICE2PHP_EXECUTABLE}")
+  message(STATUS "slice2py executable: ${Ice_SLICE2PY_EXECUTABLE}")
+  message(STATUS "slice2rb executable: ${Ice_SLICE2RB_EXECUTABLE}")
+  foreach(component ${Ice_FIND_COMPONENTS})
+    string(TOUPPER "${component}" component_upcase)
+    set(component_lib "Ice_${component_upcase}_LIBRARIES")
+    set(component_found "${component_upcase}_FOUND")
+    message(STATUS "${component} library found: ${${component_found}}")
+    message(STATUS "${component} library: ${${component_lib}}")
+  endforeach()
+  message(STATUS "----------------")
+endif()
diff --git a/Modules/FindImageMagick.cmake b/Modules/FindImageMagick.cmake
index 4f0e687..65458b7 100644
--- a/Modules/FindImageMagick.cmake
+++ b/Modules/FindImageMagick.cmake
@@ -95,34 +95,68 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
+find_package(PkgConfig QUIET)
+
 #---------------------------------------------------------------------
 # Helper functions
 #---------------------------------------------------------------------
 function(FIND_IMAGEMAGICK_API component header)
   set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
 
+  pkg_check_modules(PC_${component} QUIET ${component})
+
   find_path(ImageMagick_${component}_INCLUDE_DIR
     NAMES ${header}
+    HINTS
+      ${PC_${component}_INCLUDEDIR}
+      ${PC_${component}_INCLUDE_DIRS}
     PATHS
       ${ImageMagick_INCLUDE_DIRS}
       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
     PATH_SUFFIXES
       ImageMagick ImageMagick-6
-    DOC "Path to the ImageMagick include dir."
+    DOC "Path to the ImageMagick arch-independent include dir."
+    )
+  find_path(ImageMagick_${component}_ARCH_INCLUDE_DIR
+    NAMES magick/magick-baseconfig.h
+    HINTS
+      ${PC_${component}_INCLUDEDIR}
+      ${PC_${component}_INCLUDE_DIRS}
+    PATHS
+      ${ImageMagick_INCLUDE_DIRS}
+      "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/include"
+    PATH_SUFFIXES
+      ImageMagick ImageMagick-6
+    DOC "Path to the ImageMagick arch-specific include dir."
     )
   find_library(ImageMagick_${component}_LIBRARY
     NAMES ${ARGN}
+    HINTS
+      ${PC_${component}_LIBDIR}
+      ${PC_${component}_LIB_DIRS}
     PATHS
       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ImageMagick\\Current;BinPath]/lib"
     DOC "Path to the ImageMagick Magick++ library."
     )
 
+  # old version have only indep dir
   if(ImageMagick_${component}_INCLUDE_DIR AND ImageMagick_${component}_LIBRARY)
     set(ImageMagick_${component}_FOUND TRUE PARENT_SCOPE)
 
-    list(APPEND ImageMagick_INCLUDE_DIRS
+    # Construct per-component include directories.
+    set(ImageMagick_${component}_INCLUDE_DIRS
       ${ImageMagick_${component}_INCLUDE_DIR}
       )
+    if(ImageMagick_${component}_ARCH_INCLUDE_DIR)
+      list(APPEND ImageMagick_${component}_INCLUDE_DIRS
+        ${ImageMagick_${component}_ARCH_INCLUDE_DIR})
+    endif()
+    list(REMOVE_DUPLICATES ImageMagick_${component}_INCLUDE_DIRS)
+    set(ImageMagick_${component}_INCLUDE_DIRS
+      ${ImageMagick_${component}_INCLUDE_DIRS} PARENT_SCOPE)
+
+    # Add the per-component include directories to the full include dirs.
+    list(APPEND ImageMagick_INCLUDE_DIRS ${ImageMagick_${component}_INCLUDE_DIRS})
     list(REMOVE_DUPLICATES ImageMagick_INCLUDE_DIRS)
     set(ImageMagick_INCLUDE_DIRS ${ImageMagick_INCLUDE_DIRS} PARENT_SCOPE)
 
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 6a496af..3dcb0d0 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -55,7 +55,7 @@
         # endianess of the underlying system.
         set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb")
     elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
-        set(_java_libarch "ppc64le")
+        set(_java_libarch "ppc64" "ppc64le")
     elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
         set(_java_libarch "ppc64" "ppc")
     elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
diff --git a/Modules/FindJPEG.cmake b/Modules/FindJPEG.cmake
index 90e4485..86bb6e5 100644
--- a/Modules/FindJPEG.cmake
+++ b/Modules/FindJPEG.cmake
@@ -33,7 +33,7 @@
 
 find_path(JPEG_INCLUDE_DIR jpeglib.h)
 
-set(JPEG_NAMES ${JPEG_NAMES} jpeg)
+set(JPEG_NAMES ${JPEG_NAMES} jpeg libjpeg)
 find_library(JPEG_LIBRARY NAMES ${JPEG_NAMES} )
 
 # handle the QUIETLY and REQUIRED arguments and set JPEG_FOUND to TRUE if
diff --git a/Modules/FindKDE3.cmake b/Modules/FindKDE3.cmake
index ea898a6..dda4530 100644
--- a/Modules/FindKDE3.cmake
+++ b/Modules/FindKDE3.cmake
@@ -8,29 +8,29 @@
 #
 # This module defines the following variables:
 #
-# ::
-#
-#   KDE3_DEFINITIONS         - compiler definitions required for compiling KDE software
-#   KDE3_INCLUDE_DIR         - the KDE include directory
-#   KDE3_INCLUDE_DIRS        - the KDE and the Qt include directory, for use with include_directories()
-#   KDE3_LIB_DIR             - the directory where the KDE libraries are installed, for use with link_directories()
-#   QT_AND_KDECORE_LIBS      - this contains both the Qt and the kdecore library
-#   KDE3_DCOPIDL_EXECUTABLE  - the dcopidl executable
-#   KDE3_DCOPIDL2CPP_EXECUTABLE - the dcopidl2cpp executable
-#   KDE3_KCFGC_EXECUTABLE    - the kconfig_compiler executable
-#   KDE3_FOUND               - set to TRUE if all of the above has been found
-#
-#
+# ``KDE3_DEFINITIONS``
+#   compiler definitions required for compiling KDE software
+# ``KDE3_INCLUDE_DIR``
+#   the KDE include directory
+# ``KDE3_INCLUDE_DIRS``
+#   the KDE and the Qt include directory, for use with include_directories()
+# ``KDE3_LIB_DIR``
+#   the directory where the KDE libraries are installed, for use with link_directories()
+# ``QT_AND_KDECORE_LIBS``
+#   this contains both the Qt and the kdecore library
+# ``KDE3_DCOPIDL_EXECUTABLE``
+#   the dcopidl executable
+# ``KDE3_DCOPIDL2CPP_EXECUTABLE``
+#   the dcopidl2cpp executable
+# ``KDE3_KCFGC_EXECUTABLE``
+#   the kconfig_compiler executable
+# ``KDE3_FOUND``
+#   set to TRUE if all of the above has been found
 #
 # The following user adjustable options are provided:
 #
-# ::
-#
-#   KDE3_BUILD_TESTS - enable this to build KDE testcases
-#
-#
-#
-#
+# ``KDE3_BUILD_TESTS``
+#   enable this to build KDE testcases
 #
 # It also adds the following macros (from KDE3Macros.cmake) SRCS_VAR is
 # always the variable which contains the list of source files for your
@@ -101,7 +101,8 @@
 #
 # ::
 #
-#     Currently identical to add_executable(), may provide some advanced features in the future.
+#     Currently identical to add_executable(), may provide some advanced
+#     features in the future.
 #
 #
 #
@@ -110,7 +111,8 @@
 # ::
 #
 #     Create a KDE plugin (KPart, kioslave, etc.) from the given source files.
-#     If WITH_PREFIX is given, the resulting plugin will have the prefix "lib", otherwise it won't.
+#     If WITH_PREFIX is given, the resulting plugin will have the prefix "lib",
+#     otherwise it won't.
 #     It creates and installs an appropriate libtool la-file.
 #
 #
@@ -120,7 +122,8 @@
 # ::
 #
 #     Create a KDE application in the form of a module loadable via kdeinit.
-#     A library named kdeinit_<name> will be created and a small executable which links to it.
+#     A library named kdeinit_<name> will be created and a small executable
+#     which links to it.
 #
 #
 #
diff --git a/Modules/FindLATEX.cmake b/Modules/FindLATEX.cmake
index 62eedd6..e353d38 100644
--- a/Modules/FindLATEX.cmake
+++ b/Modules/FindLATEX.cmake
@@ -104,7 +104,7 @@
 
 if (WIN32)
   find_program(PS2PDF_CONVERTER
-    NAMES ps2pdf14.bat ps2pdf
+    NAMES ps2pdf14.bat ps2pdf14 ps2pdf
     PATHS ${GHOSTSCRIPT_LIBRARY_PATH}
           ${MIKTEX_BINARY_PATH}
   )
diff --git a/Modules/FindLua.cmake b/Modules/FindLua.cmake
index cc35e54..731f5f2 100644
--- a/Modules/FindLua.cmake
+++ b/Modules/FindLua.cmake
@@ -56,7 +56,7 @@
 
     if (Lua_FIND_VERSION_EXACT)
         if (Lua_FIND_VERSION_COUNT GREATER 1)
-            set(lua_append_versions ${Lua_FIND_VERSION_MAJOR} ${Lua_FIND_VERSION_MINOR})
+            set(lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR})
         endif ()
     elseif (Lua_FIND_VERSION)
         # once there is a different major version supported this should become a loop
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index 6e15f3b..3be5e3c 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -522,6 +522,7 @@
 # Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
 find_program(MPIEXEC
   NAMES ${_MPI_EXEC_NAMES}
+  HINTS ${MPI_HOME} $ENV{MPI_HOME}
   PATHS ${_MPI_PREFIX_PATH}
   PATH_SUFFIXES bin
   DOC "Executable for running MPI programs.")
@@ -584,7 +585,9 @@
 
     find_program(MPI_${lang}_COMPILER
       NAMES  ${_MPI_${lang}_COMPILER_NAMES}
-      PATHS  "${MPI_HOME}/bin" "$ENV{MPI_HOME}/bin" ${_MPI_PREFIX_PATH})
+      HINTS  ${_MPI_BASE_DIR}/bin
+      PATHS  ${_MPI_PREFIX_PATH}
+      )
     interrogate_mpi_compiler(${lang} ${try_libs})
     mark_as_advanced(MPI_${lang}_COMPILER)
 
diff --git a/Modules/FindOpenCL.cmake b/Modules/FindOpenCL.cmake
index b5eed9a..4d3ed84 100644
--- a/Modules/FindOpenCL.cmake
+++ b/Modules/FindOpenCL.cmake
@@ -70,14 +70,15 @@
 find_path(OpenCL_INCLUDE_DIR
   NAMES
     CL/cl.h OpenCL/cl.h
-  PATHS ENV
-    "PROGRAMFILES(X86)"
-    AMDAPPSDKROOT
-    INTELOCLSDKROOT
-    NVSDKCOMPUTE_ROOT
-    CUDA_PATH
-    ATISTREAMSDKROOT
+  PATHS
+    ENV "PROGRAMFILES(X86)"
+    ENV AMDAPPSDKROOT
+    ENV INTELOCLSDKROOT
+    ENV NVSDKCOMPUTE_ROOT
+    ENV CUDA_PATH
+    ENV ATISTREAMSDKROOT
   PATH_SUFFIXES
+    include
     OpenCL/common/inc
     "AMD APP/include")
 
@@ -87,13 +88,13 @@
   if(CMAKE_SIZEOF_VOID_P EQUAL 4)
     find_library(OpenCL_LIBRARY
       NAMES OpenCL
-      PATHS ENV
-        "PROGRAMFILES(X86)"
-        AMDAPPSDKROOT
-        INTELOCLSDKROOT
-        CUDA_PATH
-        NVSDKCOMPUTE_ROOT
-        ATISTREAMSDKROOT
+      PATHS
+        ENV "PROGRAMFILES(X86)"
+        ENV AMDAPPSDKROOT
+        ENV INTELOCLSDKROOT
+        ENV CUDA_PATH
+        ENV NVSDKCOMPUTE_ROOT
+        ENV ATISTREAMSDKROOT
       PATH_SUFFIXES
         "AMD APP/lib/x86"
         lib/x86
@@ -102,13 +103,13 @@
   elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
     find_library(OpenCL_LIBRARY
       NAMES OpenCL
-      PATHS ENV
-        "PROGRAMFILES(X86)"
-        AMDAPPSDKROOT
-        INTELOCLSDKROOT
-        CUDA_PATH
-        NVSDKCOMPUTE_ROOT
-        ATISTREAMSDKROOT
+      PATHS
+        ENV "PROGRAMFILES(X86)"
+        ENV AMDAPPSDKROOT
+        ENV INTELOCLSDKROOT
+        ENV CUDA_PATH
+        ENV NVSDKCOMPUTE_ROOT
+        ENV ATISTREAMSDKROOT
       PATH_SUFFIXES
         "AMD APP/lib/x86_64"
         lib/x86_64
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake
index 30972ae..801b4f8 100644
--- a/Modules/FindOpenMP.cmake
+++ b/Modules/FindOpenMP.cmake
@@ -16,6 +16,7 @@
 #
 #    OpenMP_C_FLAGS - flags to add to the C compiler for OpenMP support
 #    OpenMP_CXX_FLAGS - flags to add to the CXX compiler for OpenMP support
+#    OpenMP_Fortran_FLAGS - flags to add to the Fortran compiler for OpenMP support
 #    OPENMP_FOUND - true if openmp is detected
 #
 #
@@ -27,6 +28,7 @@
 # Copyright 2009 Kitware, Inc.
 # Copyright 2008-2009 André Rigland Brodtkorb <Andre.Brodtkorb@ifi.uio.no>
 # Copyright 2012 Rolf Eike Beer <eike@sf-mail.de>
+# Copyright 2014 Nicolas Bock <nicolasbock@gmail.com>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -68,8 +70,11 @@
   set(OMP_FLAG_HP "+Oopenmp")
   if(WIN32)
     set(OMP_FLAG_Intel "-Qopenmp")
-  else()
+  elseif(CMAKE_${LANG}_COMPILER_ID STREQUAL "Intel" AND
+         "${CMAKE_${LANG}_COMPILER_VERSION}" VERSION_LESS "15.0.0.20140528")
     set(OMP_FLAG_Intel "-openmp")
+  else()
+    set(OMP_FLAG_Intel "-qopenmp")
   endif()
   set(OMP_FLAG_MIPSpro "-mp")
   set(OMP_FLAG_MSVC "/openmp")
@@ -103,6 +108,17 @@
 }
 ")
 
+# same in Fortran
+set(OpenMP_Fortran_TEST_SOURCE
+  "
+program test
+use omp_lib
+integer :: n
+n = omp_get_num_threads()
+end program test
+  "
+  )
+
 # check c compiler
 if(CMAKE_C_COMPILER_LOADED)
   # if these are set then do not try to find them again,
@@ -173,6 +189,40 @@
   unset(OpenMP_CXX_TEST_SOURCE)
 endif()
 
+# check Fortran compiler
+if(CMAKE_Fortran_COMPILER_LOADED)
+  # if these are set then do not try to find them again,
+  # by avoiding any try_compiles for the flags
+  if(OpenMP_Fortran_FLAGS)
+    unset(OpenMP_Fortran_FLAG_CANDIDATES)
+  else()
+    _OPENMP_FLAG_CANDIDATES("Fortran")
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranSourceCompiles.cmake)
+  endif()
+
+  foreach(FLAG IN LISTS OpenMP_Fortran_FLAG_CANDIDATES)
+    set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
+    set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+    unset(OpenMP_FLAG_DETECTED CACHE)
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Try OpenMP Fortran flag = [${FLAG}]")
+    endif()
+    check_fortran_source_compiles("${OpenMP_Fortran_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
+    set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
+    if(OpenMP_FLAG_DETECTED)
+      set(OpenMP_Fortran_FLAGS_INTERNAL "${FLAG}")
+      break()
+    endif()
+  endforeach()
+
+  set(OpenMP_Fortran_FLAGS "${OpenMP_Fortran_FLAGS_INTERNAL}"
+    CACHE STRING "Fortran compiler flags for OpenMP parallization")
+
+  list(APPEND _OPENMP_REQUIRED_VARS OpenMP_Fortran_FLAGS)
+  unset(OpenMP_Fortran_FLAG_CANDIDATES)
+  unset(OpenMP_Fortran_TEST_SOURCE)
+endif()
+
 set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
 
 if(_OPENMP_REQUIRED_VARS)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 7bbd753..5a800e4 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -40,13 +40,14 @@
 # OSG and it's various components.  CMAKE_PREFIX_PATH can also be used
 # for this (see find_library() CMake documentation).
 #
-# ::
-#
-#     <MODULE>_DIR (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
-#     OSG_DIR
-#     OSGDIR
-#     OSG_ROOT
-#
+# ``<MODULE>_DIR``
+#   (where MODULE is of the form "OSGVOLUME" and there is a FindosgVolume.cmake file)
+# ``OSG_DIR``
+#   ..
+# ``OSGDIR``
+#   ..
+# ``OSG_ROOT``
+#   ..
 #
 #
 # [CMake 2.8.10]: The CMake variable OSG_DIR can now be used as well to
@@ -203,8 +204,11 @@
     find_package(${_osg_module} ${_osg_quiet})
 
     string(TOUPPER ${_osg_module} _osg_module_UC)
-    list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
-    list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+    # append to list if module was found OR is required
+    if( ${_osg_module_UC}_FOUND OR OpenSceneGraph_FIND_REQUIRED )
+      list(APPEND OPENSCENEGRAPH_INCLUDE_DIR ${${_osg_module_UC}_INCLUDE_DIR})
+      list(APPEND OPENSCENEGRAPH_LIBRARIES ${${_osg_module_UC}_LIBRARIES})
+    endif()
 
     if(OpenSceneGraph_MARK_AS_ADVANCED)
         OSG_MARK_AS_ADVANCED(${_osg_module})
diff --git a/Modules/FindPNG.cmake b/Modules/FindPNG.cmake
index fa04bf0..7cf3f22 100644
--- a/Modules/FindPNG.cmake
+++ b/Modules/FindPNG.cmake
@@ -10,19 +10,22 @@
 #
 # It defines the following variables
 #
-# ::
-#
-#   PNG_INCLUDE_DIRS, where to find png.h, etc.
-#   PNG_LIBRARIES, the libraries to link against to use PNG.
-#   PNG_DEFINITIONS - You should add_definitons(${PNG_DEFINITIONS}) before compiling code that includes png library files.
-#   PNG_FOUND, If false, do not try to use PNG.
-#   PNG_VERSION_STRING - the version of the PNG library found (since CMake 2.8.8)
+# ``PNG_INCLUDE_DIRS``
+#   where to find png.h, etc.
+# ``PNG_LIBRARIES``
+#   the libraries to link against to use PNG.
+# ``PNG_DEFINITIONS``
+#   You should add_definitons(${PNG_DEFINITIONS}) before compiling code
+#   that includes png library files.
+# ``PNG_FOUND``
+#   If false, do not try to use PNG.
+# ``PNG_VERSION_STRING``
+#   the version of the PNG library found (since CMake 2.8.8)
 #
 # Also defined, but not for general use are
 #
-# ::
-#
-#   PNG_LIBRARY, where to find the PNG library.
+# ``PNG_LIBRARY``
+#   where to find the PNG library.
 #
 # For backward compatiblity the variable PNG_INCLUDE_DIR is also set.
 # It has the same value as PNG_INCLUDE_DIRS.
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index d030418..6bcf1e7 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -20,7 +20,8 @@
 #
 # ::
 #
-#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name> (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
+#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(<name>
+#       (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
 #
 # If the variables <var1> to <varN> are all valid, then
 # <UPPERCASED_NAME>_FOUND will be set to TRUE.  If DEFAULT_MSG is given
@@ -32,14 +33,13 @@
 #
 # ::
 #
-#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [FOUND_VAR <resultVar>]
-#                                            [REQUIRED_VARS <var1>...<varN>]
-#                                            [VERSION_VAR   <versionvar>]
-#                                            [HANDLE_COMPONENTS]
-#                                            [CONFIG_MODE]
-#                                            [FAIL_MESSAGE "Custom failure message"] )
-#
-#
+#     FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME
+#       [FOUND_VAR <resultVar>]
+#       [REQUIRED_VARS <var1>...<varN>]
+#       [VERSION_VAR   <versionvar>]
+#       [HANDLE_COMPONENTS]
+#       [CONFIG_MODE]
+#       [FAIL_MESSAGE "Custom failure message"] )
 #
 # In this mode, the name of the result-variable can be set either to
 # either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the
@@ -75,7 +75,8 @@
 #
 # ::
 #
-#     find_package_handle_standard_args(LibXml2  DEFAULT_MSG  LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
+#     find_package_handle_standard_args(LibXml2  DEFAULT_MSG
+#       LIBXML2_LIBRARY LIBXML2_INCLUDE_DIR)
 #
 #
 #
@@ -90,9 +91,10 @@
 #
 # ::
 #
-#     find_package_handle_standard_args(LibXslt FOUND_VAR LibXslt_FOUND
-#                                              REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
-#                                              VERSION_VAR LibXslt_VERSION_STRING)
+#     find_package_handle_standard_args(LibXslt
+#       FOUND_VAR LibXslt_FOUND
+#       REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
+#       VERSION_VAR LibXslt_VERSION_STRING)
 #
 # In this case, LibXslt is considered to be found if the variable(s)
 # listed after REQUIRED_VAR are all valid, i.e.  LibXslt_LIBRARIES and
@@ -201,7 +203,7 @@
 
 # now that we collected all arguments, process them
 
-  if("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG")
+  if("x${FPHSA_FAIL_MESSAGE}" STREQUAL "xDEFAULT_MSG")
     set(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}")
   endif()
 
@@ -284,18 +286,47 @@
   # version handling:
   set(VERSION_MSG "")
   set(VERSION_OK TRUE)
-  set(VERSION ${${FPHSA_VERSION_VAR}} )
-  if (${_NAME}_FIND_VERSION)
+  set(VERSION ${${FPHSA_VERSION_VAR}})
 
-    if(VERSION)
+  # check with DEFINED here as the requested or found version may be "0"
+  if (DEFINED ${_NAME}_FIND_VERSION)
+    if(DEFINED ${FPHSA_VERSION_VAR})
 
       if(${_NAME}_FIND_VERSION_EXACT)       # exact version required
-        if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
-          set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
-          set(VERSION_OK FALSE)
+        # count the dots in the version string
+        string(REGEX REPLACE "[^.]" "" _VERSION_DOTS "${VERSION}")
+        # add one dot because there is one dot more than there are components
+        string(LENGTH "${_VERSION_DOTS}." _VERSION_DOTS)
+        if (_VERSION_DOTS GREATER ${_NAME}_FIND_VERSION_COUNT)
+          # Because of the C++ implementation of find_package() ${_NAME}_FIND_VERSION_COUNT
+          # is at most 4 here. Therefore a simple lookup table is used.
+          if (${_NAME}_FIND_VERSION_COUNT EQUAL 1)
+            set(_VERSION_REGEX "[^.]*")
+          elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 2)
+            set(_VERSION_REGEX "[^.]*\\.[^.]*")
+          elseif (${_NAME}_FIND_VERSION_COUNT EQUAL 3)
+            set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*")
+          else ()
+            set(_VERSION_REGEX "[^.]*\\.[^.]*\\.[^.]*\\.[^.]*")
+          endif ()
+          string(REGEX REPLACE "^(${_VERSION_REGEX})\\..*" "\\1" _VERSION_HEAD "${VERSION}")
+          unset(_VERSION_REGEX)
+          if (NOT ${_NAME}_FIND_VERSION VERSION_EQUAL _VERSION_HEAD)
+            set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+            set(VERSION_OK FALSE)
+          else ()
+            set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+          endif ()
+          unset(_VERSION_HEAD)
         else ()
-          set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+          if (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}")
+            set(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"")
+            set(VERSION_OK FALSE)
+          else ()
+            set(VERSION_MSG "(found suitable exact version \"${VERSION}\")")
+          endif ()
         endif ()
+        unset(_VERSION_DOTS)
 
       else()     # minimum version specified:
         if ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}")
diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake
index f13dea8..97666c8 100644
--- a/Modules/FindPostgreSQL.cmake
+++ b/Modules/FindPostgreSQL.cmake
@@ -145,12 +145,22 @@
 )
 get_filename_component(PostgreSQL_LIBRARY_DIR ${PostgreSQL_LIBRARY} PATH)
 
-if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h")
-  file(STRINGS "${PostgreSQL_INCLUDE_DIR}/pg_config.h" pgsql_version_str
-       REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
-
-  string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*" "\\1"
-         PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+if (PostgreSQL_INCLUDE_DIR)
+  # Some platforms include multiple pg_config.hs for multi-lib configurations
+  # This is a temporary workaround.  A better solution would be to compile
+  # a dummy c file and extract the value of the symbol.
+  file(GLOB _PG_CONFIG_HEADERS "${PostgreSQL_INCLUDE_DIR}/pg_config*.h")
+  foreach(_PG_CONFIG_HEADER ${_PG_CONFIG_HEADERS})
+    if(EXISTS "${_PG_CONFIG_HEADER}")
+      file(STRINGS "${_PG_CONFIG_HEADER}" pgsql_version_str
+           REGEX "^#define[\t ]+PG_VERSION[\t ]+\".*\"")
+      if(pgsql_version_str)
+        string(REGEX REPLACE "^#define[\t ]+PG_VERSION[\t ]+\"([^\"]*)\".*"
+               "\\1" PostgreSQL_VERSION_STRING "${pgsql_version_str}")
+        break()
+      endif()
+    endif()
+  endforeach()
   unset(pgsql_version_str)
 endif()
 
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index 9b120a6..72ca6ed 100644
--- a/Modules/FindProtobuf.cmake
+++ b/Modules/FindProtobuf.cmake
@@ -183,7 +183,7 @@
              "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h"
       COMMAND  ${PROTOBUF_PROTOC_EXECUTABLE}
       ARGS --cpp_out  ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL}
-      DEPENDS ${ABS_FIL}
+      DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE}
       COMMENT "Running C++ protocol buffer compiler on ${FIL}"
       VERBATIM )
   endforeach()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index c930042..2c39de5 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -111,12 +111,14 @@
 #
 # ::
 #
-#   macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname [basename] [classname])
+#   macro QT4_ADD_DBUS_ADAPTOR(outfiles xmlfile parentheader parentclassname
+#                              [basename] [classname])
 #         create a dbus adaptor (header and implementation file) from the xml file
 #         describing the interface, and add it to the list of sources. The adaptor
 #         forwards the calls to a parent class, defined in parentheader and named
 #         parentclassname. The name of the generated files will be
-#         <basename>adaptor.{cpp,h} where basename defaults to the basename of the xml file.
+#         <basename>adaptor.{cpp,h} where basename defaults to the basename of the
+#         xml file.
 #         If <classname> is provided, then it will be used as the classname of the
 #         adaptor itself.
 #
@@ -128,7 +130,8 @@
 #         If the optional argument interfacename is omitted, the name of the
 #         interface file is constructed from the basename of the header with
 #         the suffix .xml appended.
-#         Options may be given to qdbuscpp2xml, such as those found when executing "qdbuscpp2xml --help"
+#         Options may be given to qdbuscpp2xml, such as those found when
+#         executing "qdbuscpp2xml --help"
 #
 #
 # ::
@@ -170,10 +173,11 @@
 #         want to use QT4_WRAP_CPP() (which is reliable and mature), you can insert
 #         #include "foo.moc"
 #         in foo.cpp and then give foo.cpp as argument to QT4_AUTOMOC(). This will the
-#         scan all listed files at cmake-time for such included moc files and if it finds
-#         them cause a rule to be generated to run moc at build time on the
+#         scan all listed files at cmake-time for such included moc files and if it
+#         finds them cause a rule to be generated to run moc at build time on the
 #         accompanying header file foo.h.
-#         If a source file has the SKIP_AUTOMOC property set it will be ignored by this macro.
+#         If a source file has the SKIP_AUTOMOC property set it will be ignored by
+#         this macro.
 #         If the <tgt> is specified, the INTERFACE_INCLUDE_DIRECTORIES and
 #         INTERFACE_COMPILE_DEFINITIONS from the <tgt> are passed to moc.
 #
@@ -181,16 +185,17 @@
 # ::
 #
 #  function QT4_USE_MODULES( target [link_type] modules...)
-#         This function is obsolete. Use target_link_libraries with IMPORTED targets instead.
+#         This function is obsolete. Use target_link_libraries with IMPORTED targets
+#         instead.
 #         Make <target> use the <modules> from Qt. Using a Qt module means
 #         to link to the library, add the relevant include directories for the module,
 #         and add the relevant compiler defines for using the module.
 #         Modules are roughly equivalent to components of Qt4, so usage would be
 #         something like:
 #          qt4_use_modules(myexe Core Gui Declarative)
-#         to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument can
-#         be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the same argument
-#         to the target_link_libraries call.
+#         to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument
+#         can be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the
+#         same argument to the target_link_libraries call.
 #
 #
 # IMPORTED Targets
@@ -518,7 +523,8 @@
 set(_QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac)
 _qt4_find_qmake("${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION)
 
-if (QT_QMAKE_EXECUTABLE AND QTVERSION)
+if (QT_QMAKE_EXECUTABLE AND
+  QTVERSION VERSION_GREATER 3 AND QTVERSION VERSION_LESS 5)
 
   if (Qt5Core_FOUND)
     # Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
@@ -1192,14 +1198,14 @@
   set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
 
   set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
-  set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer )
+  set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer )
   set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
   set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
   set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
   set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
   set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
   set( QT_ICONENGINES_PLUGINS qsvgicon )
-  set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff  )
+  set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga )
   set( QT_INPUTMETHODS_PLUGINS qimsw_multi )
   set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
   if(APPLE)
@@ -1213,7 +1219,7 @@
   set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} )
   set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
   set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} )
-  set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
+  set( QT_QTGUI_PLUGINS qtaccessiblewidgets ${QT_IMAGEFORMATS_PLUGINS} ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
   set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
   set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
   set( QT_QTSVG_PLUGINS qsvg qsvgicon )
diff --git a/Modules/FindRuby.cmake b/Modules/FindRuby.cmake
index aafdc09..b5ac703 100644
--- a/Modules/FindRuby.cmake
+++ b/Modules/FindRuby.cmake
@@ -14,19 +14,21 @@
 # It also determines what the name of the library is.  This code sets
 # the following variables:
 #
-# ::
+# ``RUBY_EXECUTABLE``
+#   full path to the ruby binary
+# ``RUBY_INCLUDE_DIRS``
+#   include dirs to be used when using the ruby library
+# ``RUBY_LIBRARY``
+#   full path to the ruby library
+# ``RUBY_VERSION``
+#   the version of ruby which was found, e.g. "1.8.7"
+# ``RUBY_FOUND``
+#   set to true if ruby ws found successfully
 #
-#   RUBY_EXECUTABLE   = full path to the ruby binary
-#   RUBY_INCLUDE_DIRS = include dirs to be used when using the ruby library
-#   RUBY_LIBRARY      = full path to the ruby library
-#   RUBY_VERSION      = the version of ruby which was found, e.g. "1.8.7"
-#   RUBY_FOUND        = set to true if ruby ws found successfully
+# Also:
 #
-#
-#
-# ::
-#
-#   RUBY_INCLUDE_PATH = same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
+# ``RUBY_INCLUDE_PATH``
+#   same as RUBY_INCLUDE_DIRS, only provided for compatibility reasons, don't use it
 
 #=============================================================================
 # Copyright 2004-2009 Kitware, Inc.
diff --git a/Modules/FindSWIG.cmake b/Modules/FindSWIG.cmake
index 8bd4048..818d1f2 100644
--- a/Modules/FindSWIG.cmake
+++ b/Modules/FindSWIG.cmake
@@ -25,6 +25,7 @@
 #=============================================================================
 # Copyright 2004-2009 Kitware, Inc.
 # Copyright 2011 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+# Copyright 2014 Sylvain Joubert <joubert.sy@gmail.com>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -36,7 +37,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(SWIG_EXECUTABLE NAMES swig2.0 swig)
+find_program(SWIG_EXECUTABLE NAMES swig3.0 swig2.0 swig)
 
 if(SWIG_EXECUTABLE)
   execute_process(COMMAND ${SWIG_EXECUTABLE} -swiglib
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 4076521..4fdecb4 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -21,7 +21,8 @@
 #
 # ::
 #
-#   SQUISH_INSTALL_DIR              The Squish installation directory (containing bin, lib, etc)
+#   SQUISH_INSTALL_DIR              The Squish installation directory
+#                                   (containing bin, lib, etc)
 #   SQUISH_SERVER_EXECUTABLE        The squishserver executable
 #   SQUISH_CLIENT_EXECUTABLE        The squishrunner executable
 #
@@ -47,21 +48,26 @@
 #
 # The arguments have the following meaning:
 #
-# ::
-#
-#    cmakeTestName: this will be used as the first argument for add_test()
-#    AUT targetName: the name of the cmake target which will be used as AUT, i.e. the
-#                    executable which will be tested.
-#    SUITE suiteName: this is either the full path to the squish suite, or just the
-#                     last directory of the suite, i.e. the suite name. In this case
-#                     the CMakeLists.txt which calls squish_add_test() must be located
-#                     in the parent directory of the suite directory.
-#    TEST squishTestName: the name of the squish test, i.e. the name of the subdirectory
-#                         of the test inside the suite directory.
-#    SETTINGSGROUP group: if specified, the given settings group will be used for executing the test.
-#                         If not specified, the groupname will be "CTest_<username>"
-#    PRE_COMMAND command:  if specified, the given command will be executed before starting the squish test.
-#    POST_COMMAND command: same as PRE_COMMAND, but after the squish test has been executed.
+# ``cmakeTestName``
+#   this will be used as the first argument for add_test()
+# ``AUT targetName``
+#   the name of the cmake target which will be used as AUT, i.e. the
+#   executable which will be tested.
+# ``SUITE suiteName``
+#   this is either the full path to the squish suite, or just the
+#   last directory of the suite, i.e. the suite name. In this case
+#   the CMakeLists.txt which calls squish_add_test() must be located
+#   in the parent directory of the suite directory.
+# ``TEST squishTestName``
+#   the name of the squish test, i.e. the name of the subdirectory
+#   of the test inside the suite directory.
+# ``SETTINGSGROUP group``
+#   if specified, the given settings group will be used for executing the test.
+#   If not specified, the groupname will be "CTest_<username>"
+# ``PRE_COMMAND command``
+#   if specified, the given command will be executed before starting the squish test.
+# ``POST_COMMAND command``
+#   same as PRE_COMMAND, but after the squish test has been executed.
 #
 #
 #
@@ -70,7 +76,12 @@
 #    enable_testing()
 #    find_package(Squish 4.0)
 #    if (SQUISH_FOUND)
-#       squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup )
+#       squish_v4_add_test(myTestName
+#         AUT myApp
+#         SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite
+#         TEST someSquishTest
+#         SETTINGSGROUP myGroup
+#         )
 #    endif ()
 #
 #
@@ -201,7 +212,7 @@
 endif()
 
 # record if Squish was found
-include(FindPackageHandleStandardArgs)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 find_package_handle_standard_args(Squish  REQUIRED_VARS  SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE
                                           VERSION_VAR  SQUISH_VERSION )
 
diff --git a/Modules/FindThreads.cmake b/Modules/FindThreads.cmake
index 6050dcd..a0bc4d1 100644
--- a/Modules/FindThreads.cmake
+++ b/Modules/FindThreads.cmake
@@ -14,14 +14,32 @@
 #   CMAKE_USE_PTHREADS_INIT    - are we using pthreads
 #   CMAKE_HP_PTHREADS_INIT     - are we using hp pthreads
 #
+# The following import target is created
+#
+# ::
+#
+#   Threads::Threads
+#
 # For systems with multiple thread libraries, caller can set
 #
 # ::
 #
 #   CMAKE_THREAD_PREFER_PTHREAD
+#
+# If the use of the -pthread compiler and linker flag is prefered then the
+# caller can set
+#
+# ::
+#
+#   THREADS_PREFER_PTHREAD_FLAG
+#
+# Please note that the compiler flag can only be used with the imported
+# target. Use of both the imported target as well as this switch is highly
+# recommended for new code.
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
+# Copyright 2011-2014 Rolf Eike Beer <eike@sf-mail.de>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -45,6 +63,58 @@
   CHECK_INCLUDE_FILES("sys/types.h;sys/prctl.h"  CMAKE_HAVE_SPROC_H)
 endif()
 
+# Internal helper macro.
+# Do NOT even think about using it outside of this file!
+macro(_check_threads_lib LIBNAME FUNCNAME VARNAME)
+  if(NOT Threads_FOUND)
+     CHECK_LIBRARY_EXISTS(${LIBNAME} ${FUNCNAME} "" ${VARNAME})
+     if(${VARNAME})
+       set(CMAKE_THREAD_LIBS_INIT "-l${LIBNAME}")
+       set(CMAKE_HAVE_THREADS_LIBRARY 1)
+       set(Threads_FOUND TRUE)
+     endif()
+  endif ()
+endmacro()
+
+# Internal helper macro.
+# Do NOT even think about using it outside of this file!
+macro(_check_pthreads_flag)
+  if(NOT Threads_FOUND)
+    # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
+    if(NOT DEFINED THREADS_HAVE_PTHREAD_ARG)
+      message(STATUS "Check if compiler accepts -pthread")
+      try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
+        ${CMAKE_BINARY_DIR}
+        ${CMAKE_CURRENT_LIST_DIR}/CheckForPthreads.c
+        CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
+        COMPILE_OUTPUT_VARIABLE OUTPUT)
+
+      if(THREADS_HAVE_PTHREAD_ARG)
+        if(THREADS_PTHREAD_ARG STREQUAL "2")
+          set(Threads_FOUND TRUE)
+          message(STATUS "Check if compiler accepts -pthread - yes")
+        else()
+          message(STATUS "Check if compiler accepts -pthread - no")
+          file(APPEND
+            ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+            "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
+        endif()
+      else()
+        message(STATUS "Check if compiler accepts -pthread - no")
+        file(APPEND
+          ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+          "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
+      endif()
+
+    endif()
+
+    if(THREADS_HAVE_PTHREAD_ARG)
+      set(Threads_FOUND TRUE)
+      set(CMAKE_THREAD_LIBS_INIT "-pthread")
+    endif()
+  endif()
+endmacro()
+
 if(CMAKE_HAVE_SPROC_H AND NOT CMAKE_THREAD_PREFER_PTHREAD)
   # We have sproc
   set(CMAKE_USE_SPROC_INIT 1)
@@ -67,69 +137,23 @@
         set(Threads_FOUND TRUE)
       else()
 
-        # Do we have -lpthreads
-        CHECK_LIBRARY_EXISTS(pthreads pthread_create "" CMAKE_HAVE_PTHREADS_CREATE)
-        if(CMAKE_HAVE_PTHREADS_CREATE)
-          set(CMAKE_THREAD_LIBS_INIT "-lpthreads")
-          set(CMAKE_HAVE_THREADS_LIBRARY 1)
-          set(Threads_FOUND TRUE)
-        else()
+        # Check for -pthread first if enabled. This is the recommended
+        # way, but not backwards compatible as one must also pass -pthread
+        # as compiler flag then.
+        if (THREADS_PREFER_PTHREAD_FLAG)
+           _check_pthreads_flag()
+        endif ()
 
-          # Ok, how about -lpthread
-          CHECK_LIBRARY_EXISTS(pthread pthread_create "" CMAKE_HAVE_PTHREAD_CREATE)
-          if(CMAKE_HAVE_PTHREAD_CREATE)
-            set(CMAKE_THREAD_LIBS_INIT "-lpthread")
-            set(CMAKE_HAVE_THREADS_LIBRARY 1)
-            set(Threads_FOUND TRUE)
-
-          elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
+        _check_threads_lib(pthreads pthread_create CMAKE_HAVE_PTHREADS_CREATE)
+        _check_threads_lib(pthread  pthread_create CMAKE_HAVE_PTHREAD_CREATE)
+        if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
             # On sun also check for -lthread
-            CHECK_LIBRARY_EXISTS(thread thr_create "" CMAKE_HAVE_THR_CREATE)
-            if(CMAKE_HAVE_THR_CREATE)
-              set(CMAKE_THREAD_LIBS_INIT "-lthread")
-              set(CMAKE_HAVE_THREADS_LIBRARY 1)
-              set(Threads_FOUND TRUE)
-            endif()
-          endif()
+            _check_threads_lib(thread thr_create CMAKE_HAVE_THR_CREATE)
         endif()
       endif()
     endif()
 
-    if(NOT CMAKE_HAVE_THREADS_LIBRARY)
-      # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
-      if("x${THREADS_HAVE_PTHREAD_ARG}" STREQUAL "x")
-        message(STATUS "Check if compiler accepts -pthread")
-        try_run(THREADS_PTHREAD_ARG THREADS_HAVE_PTHREAD_ARG
-          ${CMAKE_BINARY_DIR}
-          ${CMAKE_ROOT}/Modules/CheckForPthreads.c
-          CMAKE_FLAGS -DLINK_LIBRARIES:STRING=-pthread
-          COMPILE_OUTPUT_VARIABLE OUTPUT)
-
-        if(THREADS_HAVE_PTHREAD_ARG)
-          if(THREADS_PTHREAD_ARG STREQUAL "2")
-            set(Threads_FOUND TRUE)
-            message(STATUS "Check if compiler accepts -pthread - yes")
-          else()
-            message(STATUS "Check if compiler accepts -pthread - no")
-            file(APPEND
-              ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-              "Determining if compiler accepts -pthread returned ${THREADS_PTHREAD_ARG} instead of 2. The compiler had the following output:\n${OUTPUT}\n\n")
-          endif()
-        else()
-          message(STATUS "Check if compiler accepts -pthread - no")
-          file(APPEND
-            ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-            "Determining if compiler accepts -pthread failed with the following output:\n${OUTPUT}\n\n")
-        endif()
-
-      endif()
-
-      if(THREADS_HAVE_PTHREAD_ARG)
-        set(Threads_FOUND TRUE)
-        set(CMAKE_THREAD_LIBS_INIT "-pthread")
-      endif()
-
-    endif()
+    _check_pthreads_flag()
   endif()
 endif()
 
@@ -178,3 +202,15 @@
 set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Threads DEFAULT_MSG Threads_FOUND)
+
+if(THREADS_FOUND AND NOT TARGET Threads::Threads)
+  add_library(Threads::Threads INTERFACE IMPORTED)
+
+  if(THREADS_HAVE_PTHREAD_ARG)
+    set_property(TARGET Threads::Threads PROPERTY INTERFACE_COMPILE_OPTIONS "-pthread")
+  endif()
+
+  if(CMAKE_THREAD_LIBS_INIT)
+    set_property(TARGET Threads::Threads PROPERTY INTERFACE_LINK_LIBRARIES "${CMAKE_THREAD_LIBS_INIT}")
+  endif()
+endif()
diff --git a/Modules/FindVTK.cmake b/Modules/FindVTK.cmake
deleted file mode 100644
index bcc7f87..0000000
--- a/Modules/FindVTK.cmake
+++ /dev/null
@@ -1,156 +0,0 @@
-#.rst:
-# FindVTK
-# -------
-#
-# Find a VTK installation or build tree.
-#
-# The following variables are set if VTK is found.  If VTK is not found,
-# VTK_FOUND is set to false.
-#
-# ::
-#
-#   VTK_FOUND         - Set to true when VTK is found.
-#   VTK_USE_FILE      - CMake file to use VTK.
-#   VTK_MAJOR_VERSION - The VTK major version number.
-#   VTK_MINOR_VERSION - The VTK minor version number
-#                        (odd non-release).
-#   VTK_BUILD_VERSION - The VTK patch level
-#                        (meaningless for odd minor).
-#   VTK_INCLUDE_DIRS  - Include directories for VTK
-#   VTK_LIBRARY_DIRS  - Link directories for VTK libraries
-#   VTK_KITS          - List of VTK kits, in CAPS
-#                       (COMMON,IO,) etc.
-#   VTK_LANGUAGES     - List of wrapped languages, in CAPS
-#                       (TCL, PYHTON,) etc.
-#
-# The following cache entries must be set by the user to locate VTK:
-#
-# ::
-#
-#   VTK_DIR  - The directory containing VTKConfig.cmake.
-#              This is either the root of the build tree,
-#              or the lib/vtk directory.  This is the
-#              only cache entry.
-#
-# The following variables are set for backward compatibility and should
-# not be used in new code:
-#
-# ::
-#
-#   USE_VTK_FILE - The full path to the UseVTK.cmake file.
-#                  This is provided for backward
-#                  compatibility.  Use VTK_USE_FILE
-#                  instead.
-
-#=============================================================================
-# Copyright 2001-2009 Kitware, Inc.
-#
-# Distributed under the OSI-approved BSD License (the "License");
-# see accompanying file Copyright.txt for details.
-#
-# This software is distributed WITHOUT ANY WARRANTY; without even the
-# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# See the License for more information.
-#=============================================================================
-# (To distribute this file outside of CMake, substitute the full
-#  License text for the above reference.)
-
-# Assume not found.
-set(VTK_FOUND 0)
-
-# VTK 4.0 did not provide VTKConfig.cmake.
-if("${VTK_FIND_VERSION}" VERSION_LESS 4.1)
-  set(_VTK_40_ALLOW 1)
-  if(VTK_FIND_VERSION)
-    set(_VTK_40_ONLY 1)
-  endif()
-endif()
-
-# Construct consistent error messages for use below.
-set(VTK_DIR_DESCRIPTION "directory containing VTKConfig.cmake.  This is either the root of the build tree, or PREFIX/lib/vtk for an installation.")
-if(_VTK_40_ALLOW)
-  set(VTK_DIR_DESCRIPTION "${VTK_DIR_DESCRIPTION}  For VTK 4.0, this is the location of UseVTK.cmake.  This is either the root of the build tree or PREFIX/include/vtk for an installation.")
-endif()
-set(VTK_DIR_MESSAGE "VTK not found.  Set the VTK_DIR cmake cache entry to the ${VTK_DIR_DESCRIPTION}")
-
-# Check whether VTK 4.0 has already been found.
-if(_VTK_40_ALLOW AND VTK_DIR)
-  if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
-    set(VTK_FOUND 1)
-    include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
-  endif()
-endif()
-
-# Use the Config mode of the find_package() command to find VTKConfig.
-# If this succeeds (possibly because VTK_DIR is already set), the
-# command will have already loaded VTKConfig.cmake and set VTK_FOUND.
-if(NOT _VTK_40_ONLY AND NOT VTK_FOUND)
-  find_package(VTK QUIET NO_MODULE)
-endif()
-
-# Special search for VTK 4.0.
-if(_VTK_40_ALLOW AND NOT VTK_DIR)
-  # Old scripts may set these directories in the CMakeCache.txt file.
-  # They can tell us where to find VTKConfig.cmake.
-  set(VTK_DIR_SEARCH_LEGACY "")
-  if(VTK_BINARY_PATH AND USE_BUILT_VTK)
-    set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY} ${VTK_BINARY_PATH})
-  endif()
-  if(VTK_INSTALL_PATH AND USE_INSTALLED_VTK)
-    set(VTK_DIR_SEARCH_LEGACY ${VTK_DIR_SEARCH_LEGACY}
-        ${VTK_INSTALL_PATH}/lib/vtk)
-  endif()
-
-  # Look for UseVTK.cmake in build trees or under <prefix>/include/vtk.
-  find_path(VTK_DIR
-    NAMES UseVTK.cmake
-    PATH_SUFFIXES vtk-4.0 vtk
-    HINTS ENV VTK_DIR
-
-    PATHS
-
-    # Support legacy cache files.
-    ${VTK_DIR_SEARCH_LEGACY}
-
-    # Read from the CMakeSetup registry entries.  It is likely that
-    # VTK will have been recently built.
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild1]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild2]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild3]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild4]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild5]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild6]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild7]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild8]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild9]
-    [HKEY_CURRENT_USER\\Software\\Kitware\\CMakeSetup\\Settings\\StartPath;WhereBuild10]
-
-    # Help the user find it if we cannot.
-    DOC "The ${VTK_DIR_DESCRIPTION}"
-    )
-
-  if(VTK_DIR)
-    if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
-      set(VTK_FOUND 1)
-      include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
-    else()
-      # We found the wrong version.  Pretend we did not find it.
-      set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)
-    endif()
-  endif()
-endif()
-
-#-----------------------------------------------------------------------------
-if(VTK_FOUND)
-  # Set USE_VTK_FILE for backward-compatibility.
-  set(USE_VTK_FILE ${VTK_USE_FILE})
-else()
-  # VTK not found, explain to the user how to specify its location.
-  if(VTK_FIND_REQUIRED)
-    message(FATAL_ERROR ${VTK_DIR_MESSAGE})
-  else()
-    if(NOT VTK_FIND_QUIETLY)
-      message(STATUS ${VTK_DIR_MESSAGE})
-    endif()
-  endif()
-endif()
diff --git a/Modules/FindX11.cmake b/Modules/FindX11.cmake
index 3a31cf0..90c1499 100644
--- a/Modules/FindX11.cmake
+++ b/Modules/FindX11.cmake
@@ -4,7 +4,7 @@
 #
 # Find X11 installation
 #
-# Try to find X11 on UNIX systems.  The following values are defined
+# Try to find X11 on UNIX systems. The following values are defined
 #
 # ::
 #
@@ -12,47 +12,44 @@
 #   X11_INCLUDE_DIR  - include directories to use X11
 #   X11_LIBRARIES    - link against these to use X11
 #
-#
-#
-# and also the following more fine grained variables: Include paths:
-# X11_ICE_INCLUDE_PATH, X11_ICE_LIB, X11_ICE_FOUND
+# and also the following more fine grained variables:
 #
 # ::
 #
-#                 X11_SM_INCLUDE_PATH,           X11_SM_LIB,         X11_SM_FOUND
-#                 X11_X11_INCLUDE_PATH,          X11_X11_LIB
-#                 X11_Xaccessrules_INCLUDE_PATH,                     X11_Xaccess_FOUND
-#                 X11_Xaccessstr_INCLUDE_PATH,                       X11_Xaccess_FOUND
-#                 X11_Xau_INCLUDE_PATH,          X11_Xau_LIB,        X11_Xau_FOUND
-#                 X11_Xcomposite_INCLUDE_PATH,   X11_Xcomposite_LIB, X11_Xcomposite_FOUND
-#                 X11_Xcursor_INCLUDE_PATH,      X11_Xcursor_LIB,    X11_Xcursor_FOUND
-#                 X11_Xdamage_INCLUDE_PATH,      X11_Xdamage_LIB,    X11_Xdamage_FOUND
-#                 X11_Xdmcp_INCLUDE_PATH,        X11_Xdmcp_LIB,      X11_Xdmcp_FOUND
-#                                                X11_Xext_LIB,       X11_Xext_FOUND
-#                 X11_dpms_INCLUDE_PATH,         (in X11_Xext_LIB),  X11_dpms_FOUND
-#                 X11_XShm_INCLUDE_PATH,         (in X11_Xext_LIB),  X11_XShm_FOUND
-#                 X11_Xshape_INCLUDE_PATH,       (in X11_Xext_LIB),  X11_Xshape_FOUND
-#                 X11_xf86misc_INCLUDE_PATH,     X11_Xxf86misc_LIB,  X11_xf86misc_FOUND
-#                 X11_xf86vmode_INCLUDE_PATH,    X11_Xxf86vm_LIB     X11_xf86vmode_FOUND
-#                 X11_Xfixes_INCLUDE_PATH,       X11_Xfixes_LIB,     X11_Xfixes_FOUND
-#                 X11_Xft_INCLUDE_PATH,          X11_Xft_LIB,        X11_Xft_FOUND
-#                 X11_Xi_INCLUDE_PATH,           X11_Xi_LIB,         X11_Xi_FOUND
-#                 X11_Xinerama_INCLUDE_PATH,     X11_Xinerama_LIB,   X11_Xinerama_FOUND
-#                 X11_Xinput_INCLUDE_PATH,       X11_Xinput_LIB,     X11_Xinput_FOUND
-#                 X11_Xkb_INCLUDE_PATH,                              X11_Xkb_FOUND
-#                 X11_Xkblib_INCLUDE_PATH,                           X11_Xkb_FOUND
-#                 X11_Xkbfile_INCLUDE_PATH,      X11_Xkbfile_LIB,    X11_Xkbfile_FOUND
-#                 X11_Xmu_INCLUDE_PATH,          X11_Xmu_LIB,        X11_Xmu_FOUND
-#                 X11_Xpm_INCLUDE_PATH,          X11_Xpm_LIB,        X11_Xpm_FOUND
-#                 X11_XTest_INCLUDE_PATH,        X11_XTest_LIB,      X11_XTest_FOUND
-#                 X11_Xrandr_INCLUDE_PATH,       X11_Xrandr_LIB,     X11_Xrandr_FOUND
-#                 X11_Xrender_INCLUDE_PATH,      X11_Xrender_LIB,    X11_Xrender_FOUND
-#                 X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
-#                 X11_Xt_INCLUDE_PATH,           X11_Xt_LIB,         X11_Xt_FOUND
-#                 X11_Xutil_INCLUDE_PATH,                            X11_Xutil_FOUND
-#                 X11_Xv_INCLUDE_PATH,           X11_Xv_LIB,         X11_Xv_FOUND
-#                 X11_XSync_INCLUDE_PATH,        (in X11_Xext_LIB),  X11_XSync_FOUND
-
+#   X11_ICE_INCLUDE_PATH,          X11_ICE_LIB,        X11_ICE_FOUND
+#   X11_SM_INCLUDE_PATH,           X11_SM_LIB,         X11_SM_FOUND
+#   X11_X11_INCLUDE_PATH,          X11_X11_LIB
+#   X11_Xaccessrules_INCLUDE_PATH,                     X11_Xaccess_FOUND
+#   X11_Xaccessstr_INCLUDE_PATH,                       X11_Xaccess_FOUND
+#   X11_Xau_INCLUDE_PATH,          X11_Xau_LIB,        X11_Xau_FOUND
+#   X11_Xcomposite_INCLUDE_PATH,   X11_Xcomposite_LIB, X11_Xcomposite_FOUND
+#   X11_Xcursor_INCLUDE_PATH,      X11_Xcursor_LIB,    X11_Xcursor_FOUND
+#   X11_Xdamage_INCLUDE_PATH,      X11_Xdamage_LIB,    X11_Xdamage_FOUND
+#   X11_Xdmcp_INCLUDE_PATH,        X11_Xdmcp_LIB,      X11_Xdmcp_FOUND
+#   X11_Xext_LIB,       X11_Xext_FOUND
+#   X11_dpms_INCLUDE_PATH,         (in X11_Xext_LIB),  X11_dpms_FOUND
+#   X11_XShm_INCLUDE_PATH,         (in X11_Xext_LIB),  X11_XShm_FOUND
+#   X11_Xshape_INCLUDE_PATH,       (in X11_Xext_LIB),  X11_Xshape_FOUND
+#   X11_xf86misc_INCLUDE_PATH,     X11_Xxf86misc_LIB,  X11_xf86misc_FOUND
+#   X11_xf86vmode_INCLUDE_PATH,    X11_Xxf86vm_LIB     X11_xf86vmode_FOUND
+#   X11_Xfixes_INCLUDE_PATH,       X11_Xfixes_LIB,     X11_Xfixes_FOUND
+#   X11_Xft_INCLUDE_PATH,          X11_Xft_LIB,        X11_Xft_FOUND
+#   X11_Xi_INCLUDE_PATH,           X11_Xi_LIB,         X11_Xi_FOUND
+#   X11_Xinerama_INCLUDE_PATH,     X11_Xinerama_LIB,   X11_Xinerama_FOUND
+#   X11_Xinput_INCLUDE_PATH,       X11_Xinput_LIB,     X11_Xinput_FOUND
+#   X11_Xkb_INCLUDE_PATH,                              X11_Xkb_FOUND
+#   X11_Xkblib_INCLUDE_PATH,                           X11_Xkb_FOUND
+#   X11_Xkbfile_INCLUDE_PATH,      X11_Xkbfile_LIB,    X11_Xkbfile_FOUND
+#   X11_Xmu_INCLUDE_PATH,          X11_Xmu_LIB,        X11_Xmu_FOUND
+#   X11_Xpm_INCLUDE_PATH,          X11_Xpm_LIB,        X11_Xpm_FOUND
+#   X11_XTest_INCLUDE_PATH,        X11_XTest_LIB,      X11_XTest_FOUND
+#   X11_Xrandr_INCLUDE_PATH,       X11_Xrandr_LIB,     X11_Xrandr_FOUND
+#   X11_Xrender_INCLUDE_PATH,      X11_Xrender_LIB,    X11_Xrender_FOUND
+#   X11_Xscreensaver_INCLUDE_PATH, X11_Xscreensaver_LIB, X11_Xscreensaver_FOUND
+#   X11_Xt_INCLUDE_PATH,           X11_Xt_LIB,         X11_Xt_FOUND
+#   X11_Xutil_INCLUDE_PATH,                            X11_Xutil_FOUND
+#   X11_Xv_INCLUDE_PATH,           X11_Xv_LIB,         X11_Xv_FOUND
+#   X11_XSync_INCLUDE_PATH,        (in X11_Xext_LIB),  X11_XSync_FOUND
 
 #=============================================================================
 # Copyright 2001-2009 Kitware, Inc.
diff --git a/Modules/FindXerces.cmake b/Modules/FindXerces.cmake
new file mode 100644
index 0000000..6c6007a
--- /dev/null
+++ b/Modules/FindXerces.cmake
@@ -0,0 +1,85 @@
+#.rst:
+# FindXerces
+# ----------
+#
+# Find the Apache Xerces-C++ validating XML parser headers and libraries.
+#
+# This module reports information about the Xerces installation in
+# several variables.  General variables::
+#
+#   Xerces_FOUND - true if the Xerces headers and libraries were found
+#   Xerces_VERSION - Xerces release version
+#   Xerces_INCLUDE_DIRS - the directory containing the Xerces headers
+#   Xerces_LIBRARIES - Xerces libraries to be linked
+#
+# The following cache variables may also be set::
+#
+#   Xerces_INCLUDE_DIR - the directory containing the Xerces headers
+#   Xerces_LIBRARY - the Xerces library
+
+# Written by Roger Leigh <rleigh@codelibre.net>
+
+#=============================================================================
+# Copyright 2014 University of Dundee
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+function(_Xerces_GET_VERSION  version_hdr)
+    file(STRINGS ${version_hdr} _contents REGEX "^[ \t]*#define XERCES_VERSION_.*")
+    if(_contents)
+        string(REGEX REPLACE ".*#define XERCES_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1" Xerces_MAJOR "${_contents}")
+        string(REGEX REPLACE ".*#define XERCES_VERSION_MINOR[ \t]+([0-9]+).*" "\\1" Xerces_MINOR "${_contents}")
+        string(REGEX REPLACE ".*#define XERCES_VERSION_REVISION[ \t]+([0-9]+).*" "\\1" Xerces_PATCH "${_contents}")
+
+        if(NOT Xerces_MAJOR MATCHES "^[0-9]+$")
+            message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MAJOR!")
+        endif()
+        if(NOT Xerces_MINOR MATCHES "^[0-9]+$")
+            message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_MINOR!")
+        endif()
+        if(NOT Xerces_PATCH MATCHES "^[0-9]+$")
+            message(FATAL_ERROR "Version parsing failed for XERCES_VERSION_REVISION!")
+        endif()
+
+        set(Xerces_VERSION "${Xerces_MAJOR}.${Xerces_MINOR}.${Xerces_PATCH}" PARENT_SCOPE)
+    else()
+        message(FATAL_ERROR "Include file ${version_hdr} does not exist or does not contain expected version information")
+    endif()
+endfunction()
+
+# Find include directory
+find_path(Xerces_INCLUDE_DIR
+          NAMES "xercesc/util/PlatformUtils.hpp"
+          DOC "Xerces-C++ include directory")
+mark_as_advanced(Xerces_INCLUDE_DIR)
+
+# Find all Xerces libraries
+find_library(Xerces_LIBRARY "xerces-c"
+  DOC "Xerces-C++ libraries")
+mark_as_advanced(Xerces_LIBRARY)
+
+if(Xerces_INCLUDE_DIR)
+  _Xerces_GET_VERSION("${Xerces_INCLUDE_DIR}/xercesc/util/XercesVersion.hpp")
+endif()
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xerces
+                                  FOUND_VAR Xerces_FOUND
+                                  REQUIRED_VARS Xerces_LIBRARY
+                                                Xerces_INCLUDE_DIR
+                                                Xerces_VERSION
+                                  VERSION_VAR Xerces_VERSION
+                                  FAIL_MESSAGE "Failed to find Xerces")
+
+if(Xerces_FOUND)
+  set(Xerces_INCLUDE_DIRS "${Xerces_INCLUDE_DIR}")
+  set(Xerces_LIBRARIES "${Xerces_LIBRARY}")
+endif()
diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake
index 8cc382c..d4a27d5 100644
--- a/Modules/FindZLIB.cmake
+++ b/Modules/FindZLIB.cmake
@@ -2,9 +2,18 @@
 # FindZLIB
 # --------
 #
-# Find zlib
+# Find the native ZLIB includes and library.
 #
-# Find the native ZLIB includes and library.  Once done this will define
+# IMPORTED Targets
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines :prop_tgt:`IMPORTED` target ``ZLIB::ZLIB``, if
+# ZLIB has been found.
+#
+# Result Variables
+# ^^^^^^^^^^^^^^^^
+#
+# This module defines the following variables:
 #
 # ::
 #
@@ -12,8 +21,6 @@
 #   ZLIB_LIBRARIES      - List of libraries when using zlib.
 #   ZLIB_FOUND          - True if zlib found.
 #
-#
-#
 # ::
 #
 #   ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
@@ -22,7 +29,8 @@
 #   ZLIB_VERSION_PATCH  - The patch version of zlib
 #   ZLIB_VERSION_TWEAK  - The tweak version of zlib
 #
-#
+# Backward Compatibility
+# ^^^^^^^^^^^^^^^^^^^^^^
 #
 # The following variable are provided for backward compatibility
 #
@@ -32,9 +40,10 @@
 #   ZLIB_MINOR_VERSION  - The minor version of zlib
 #   ZLIB_PATCH_VERSION  - The patch version of zlib
 #
+# Hints
+# ^^^^^
 #
-#
-# An includer may set ZLIB_ROOT to a zlib installation root to tell this
+# A user may set ``ZLIB_ROOT`` to a zlib installation root to tell this
 # module where to look.
 
 #=============================================================================
@@ -104,5 +113,11 @@
 if(ZLIB_FOUND)
     set(ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR})
     set(ZLIB_LIBRARIES ${ZLIB_LIBRARY})
-endif()
 
+    if(NOT TARGET ZLIB::ZLIB)
+      add_library(ZLIB::ZLIB UNKNOWN IMPORTED)
+      set_target_properties(ZLIB::ZLIB PROPERTIES
+        IMPORTED_LOCATION "${ZLIB_LIBRARY}"
+        INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIRS}")
+    endif()
+endif()
diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake
index 45596a0..7ef06a8 100644
--- a/Modules/FindwxWidgets.cmake
+++ b/Modules/FindwxWidgets.cmake
@@ -229,13 +229,12 @@
 endif()
 
 #=====================================================================
+# Determine whether unix or win32 paths should be used
 #=====================================================================
-if(WIN32 AND NOT CYGWIN AND NOT MSYS)
+if(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_CROSSCOMPILING)
   set(wxWidgets_FIND_STYLE "win32")
 else()
-  if(UNIX OR MSYS)
-    set(wxWidgets_FIND_STYLE "unix")
-  endif()
+  set(wxWidgets_FIND_STYLE "unix")
 endif()
 
 #=====================================================================
diff --git a/Modules/FortranCInterface/Detect.cmake b/Modules/FortranCInterface/Detect.cmake
index ceb1db4..bee7dae 100644
--- a/Modules/FortranCInterface/Detect.cmake
+++ b/Modules/FortranCInterface/Detect.cmake
@@ -67,7 +67,7 @@
 set(FortranCInterface_SYMBOLS)
 if(FortranCInterface_EXE)
   file(STRINGS "${FortranCInterface_EXE}" _info_strings
-    LIMIT_COUNT 8 REGEX "INFO:[^[]*\\[")
+    LIMIT_COUNT 8 REGEX "INFO:[A-Za-z0-9_]+\\[[^]]*\\]")
   foreach(info ${_info_strings})
     if("${info}" MATCHES "INFO:symbol\\[([^]]*)\\]")
       list(APPEND FortranCInterface_SYMBOLS ${CMAKE_MATCH_1})
diff --git a/Modules/GNUInstallDirs.cmake b/Modules/GNUInstallDirs.cmake
index eac553d..c61e7e9 100644
--- a/Modules/GNUInstallDirs.cmake
+++ b/Modules/GNUInstallDirs.cmake
@@ -6,36 +6,47 @@
 #
 # Provides install directory variables as defined for GNU software:
 #
-# ::
-#
 #   http://www.gnu.org/prep/standards/html_node/Directory-Variables.html
 #
 # Inclusion of this module defines the following variables:
 #
-# ::
-#
-#   CMAKE_INSTALL_<dir>      - destination for files of a given type
-#   CMAKE_INSTALL_FULL_<dir> - corresponding absolute path
+# ``CMAKE_INSTALL_<dir>``
+#   destination for files of a given type
+# ``CMAKE_INSTALL_FULL_<dir>``
+#   corresponding absolute path
 #
 # where <dir> is one of:
 #
-# ::
-#
-#   BINDIR           - user executables (bin)
-#   SBINDIR          - system admin executables (sbin)
-#   LIBEXECDIR       - program executables (libexec)
-#   SYSCONFDIR       - read-only single-machine data (etc)
-#   SHAREDSTATEDIR   - modifiable architecture-independent data (com)
-#   LOCALSTATEDIR    - modifiable single-machine data (var)
-#   LIBDIR           - object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
-#   INCLUDEDIR       - C header files (include)
-#   OLDINCLUDEDIR    - C header files for non-gcc (/usr/include)
-#   DATAROOTDIR      - read-only architecture-independent data root (share)
-#   DATADIR          - read-only architecture-independent data (DATAROOTDIR)
-#   INFODIR          - info documentation (DATAROOTDIR/info)
-#   LOCALEDIR        - locale-dependent data (DATAROOTDIR/locale)
-#   MANDIR           - man documentation (DATAROOTDIR/man)
-#   DOCDIR           - documentation root (DATAROOTDIR/doc/PROJECT_NAME)
+# ``BINDIR``
+#   user executables (bin)
+# ``SBINDIR``
+#   system admin executables (sbin)
+# ``LIBEXECDIR``
+#   program executables (libexec)
+# ``SYSCONFDIR``
+#   read-only single-machine data (etc)
+# ``SHAREDSTATEDIR``
+#   modifiable architecture-independent data (com)
+# ``LOCALSTATEDIR``
+#   modifiable single-machine data (var)
+# ``LIBDIR``
+#   object code libraries (lib or lib64 or lib/<multiarch-tuple> on Debian)
+# ``INCLUDEDIR``
+#   C header files (include)
+# ``OLDINCLUDEDIR``
+#   C header files for non-gcc (/usr/include)
+# ``DATAROOTDIR``
+#   read-only architecture-independent data root (share)
+# ``DATADIR``
+#   read-only architecture-independent data (DATAROOTDIR)
+# ``INFODIR``
+#   info documentation (DATAROOTDIR/info)
+# ``LOCALEDIR``
+#   locale-dependent data (DATAROOTDIR/locale)
+# ``MANDIR``
+#   man documentation (DATAROOTDIR/man)
+# ``DOCDIR``
+#   documentation root (DATAROOTDIR/doc/PROJECT_NAME)
 #
 # Each CMAKE_INSTALL_<dir> value may be passed to the DESTINATION
 # options of install() commands for the corresponding file type.  If the
@@ -198,7 +209,7 @@
     set(CMAKE_INSTALL_INFODIR "info")
   endif()
 
-  if(NOT CMAKE_INSTALL_MANDDIR)
+  if(NOT CMAKE_INSTALL_MANDIR)
     set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (man)")
     set(CMAKE_INSTALL_MANDIR "man")
   endif()
@@ -208,7 +219,7 @@
     set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info")
   endif()
 
-  if(NOT CMAKE_INSTALL_MANDDIR)
+  if(NOT CMAKE_INSTALL_MANDIR)
     set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)")
     set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man")
   endif()
diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake
index f83f992..0c6256c 100644
--- a/Modules/GenerateExportHeader.cmake
+++ b/Modules/GenerateExportHeader.cmake
@@ -213,14 +213,13 @@
 
   # Exclude XL here because it misinterprets -fvisibility=hidden even though
   # the check_cxx_compiler_flag passes
-  # http://www.cdash.org/CDash/testDetails.php?test=109109951&build=1419259
   if(NOT GCC_TOO_OLD
       AND NOT _INTEL_TOO_OLD
       AND NOT WIN32
       AND NOT CYGWIN
-      AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES XL
-      AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
-      AND NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+      AND NOT CMAKE_CXX_COMPILER_ID MATCHES XL
+      AND NOT CMAKE_CXX_COMPILER_ID MATCHES PGI
+      AND NOT CMAKE_CXX_COMPILER_ID MATCHES Watcom)
     check_cxx_compiler_flag(-fvisibility=hidden COMPILER_HAS_HIDDEN_VISIBILITY)
     check_cxx_compiler_flag(-fvisibility-inlines-hidden
       COMPILER_HAS_HIDDEN_INLINE_VISIBILITY)
@@ -231,11 +230,11 @@
 endmacro()
 
 macro(_test_compiler_has_deprecated)
-  if("${CMAKE_CXX_COMPILER_ID}" MATCHES Borland
-      OR "${CMAKE_CXX_COMPILER_ID}" MATCHES HP
+  if(CMAKE_CXX_COMPILER_ID MATCHES Borland
+      OR CMAKE_CXX_COMPILER_ID MATCHES HP
       OR GCC_TOO_OLD
-      OR "${CMAKE_CXX_COMPILER_ID}" MATCHES PGI
-      OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
+      OR CMAKE_CXX_COMPILER_ID MATCHES PGI
+      OR CMAKE_CXX_COMPILER_ID MATCHES Watcom)
     set(COMPILER_HAS_DEPRECATED "" CACHE INTERNAL
       "Compiler support for a deprecated attribute")
   else()
@@ -364,6 +363,7 @@
   get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE)
   if(NOT ${type} STREQUAL "STATIC_LIBRARY"
       AND NOT ${type} STREQUAL "SHARED_LIBRARY"
+      AND NOT ${type} STREQUAL "OBJECT_LIBRARY"
       AND NOT ${type} STREQUAL "MODULE_LIBRARY")
     message(WARNING "This macro can only be used with libraries")
     return()
diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake
index 05c2edb..9963517 100644
--- a/Modules/GetPrerequisites.cmake
+++ b/Modules/GetPrerequisites.cmake
@@ -41,7 +41,7 @@
 # ::
 #
 #   GET_PREREQUISITES(<target> <prerequisites_var> <exclude_system> <recurse>
-#                     <exepath> <dirs>)
+#                     <exepath> <dirs> [<rpaths>])
 #
 # Get the list of shared library files required by <target>.  The list
 # in the variable named <prerequisites_var> should be empty on first
@@ -113,7 +113,8 @@
 #
 # ::
 #
-#   GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>)
+#   GP_RESOLVE_ITEM(<context> <item> <exepath> <dirs> <resolved_item_var>
+#                   [<rpaths>])
 #
 # Resolve an item into an existing full path file.
 #
@@ -122,7 +123,8 @@
 #
 # ::
 #
-#   GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>)
+#   GP_RESOLVED_FILE_TYPE(<original_file> <file> <exepath> <dirs> <type_var>
+#                         [<rpaths>])
 #
 # Return the type of <file> with respect to <original_file>.  String
 # describing type of prerequisite is returned in variable named
@@ -321,6 +323,7 @@
 function(gp_resolve_item context item exepath dirs resolved_item_var)
   set(resolved 0)
   set(resolved_item "${item}")
+  set(rpaths "${ARGV5}")
 
   # Is it already resolved?
   #
@@ -329,7 +332,7 @@
   endif()
 
   if(NOT resolved)
-    if(item MATCHES "@executable_path")
+    if(item MATCHES "^@executable_path")
       #
       # @executable_path references are assumed relative to exepath
       #
@@ -347,7 +350,7 @@
   endif()
 
   if(NOT resolved)
-    if(item MATCHES "@loader_path")
+    if(item MATCHES "^@loader_path")
       #
       # @loader_path references are assumed relative to the
       # PATH of the given "context" (presumably another library)
@@ -367,7 +370,7 @@
   endif()
 
   if(NOT resolved)
-    if(item MATCHES "@rpath")
+    if(item MATCHES "^@rpath")
       #
       # @rpath references are relative to the paths built into the binaries with -rpath
       # We handle this case like we do for other Unixes
@@ -375,9 +378,9 @@
       string(REPLACE "@rpath/" "" norpath_item "${item}")
 
       set(ri "ri-NOTFOUND")
-      find_file(ri "${norpath_item}" ${exepath} ${dirs} NO_DEFAULT_PATH)
+      find_file(ri "${norpath_item}" ${exepath} ${dirs} ${rpaths} NO_DEFAULT_PATH)
       if(ri)
-        #message(STATUS "info: 'find_file' in exepath/dirs (${ri})")
+        #message(STATUS "info: 'find_file' in exepath/dirs/rpaths (${ri})")
         set(resolved 1)
         set(resolved_item "${ri}")
         set(ri "ri-NOTFOUND")
@@ -471,6 +474,7 @@
 
 
 function(gp_resolved_file_type original_file file exepath dirs type_var)
+  set(rpaths "${ARGV5}")
   #message(STATUS "**")
 
   if(NOT IS_ABSOLUTE "${original_file}")
@@ -489,7 +493,7 @@
 
   if(NOT is_embedded)
     if(NOT IS_ABSOLUTE "${file}")
-      gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file)
+      gp_resolve_item("${original_file}" "${file}" "${exepath}" "${dirs}" resolved_file "${rpaths}")
     endif()
 
     string(TOLOWER "${original_file}" original_lower)
@@ -612,6 +616,7 @@
 function(get_prerequisites target prerequisites_var exclude_system recurse exepath dirs)
   set(verbose 0)
   set(eol_char "E")
+  set(rpaths "${ARGV6}")
 
   if(NOT IS_ABSOLUTE "${target}")
     message("warning: target '${target}' is not absolute...")
@@ -834,7 +839,7 @@
 
     if(add_item AND ${exclude_system})
       set(type "")
-      gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type)
+      gp_resolved_file_type("${target}" "${item}" "${exepath}" "${dirs}" type "${rpaths}")
 
       if("${type}" STREQUAL "system")
         set(add_item 0)
@@ -855,7 +860,7 @@
         # that the analysis tools can simply accept it as input.
         #
         if(NOT list_length_before_append EQUAL list_length_after_append)
-          gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item)
+          gp_resolve_item("${target}" "${item}" "${exepath}" "${dirs}" resolved_item "${rpaths}")
           set(unseen_prereqs ${unseen_prereqs} "${resolved_item}")
         endif()
       endif()
@@ -874,7 +879,7 @@
   if(${recurse})
     set(more_inputs ${unseen_prereqs})
     foreach(input ${more_inputs})
-      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}")
+      get_prerequisites("${input}" ${prerequisites_var} ${exclude_system} ${recurse} "${exepath}" "${dirs}" "${rpaths}")
     endforeach()
   endif()
 
diff --git a/Modules/InstallRequiredSystemLibraries.cmake b/Modules/InstallRequiredSystemLibraries.cmake
index 5c439e9..5afb517 100644
--- a/Modules/InstallRequiredSystemLibraries.cmake
+++ b/Modules/InstallRequiredSystemLibraries.cmake
@@ -19,6 +19,8 @@
 # libraries are installed when both debug and release are available.  If
 # CMAKE_INSTALL_MFC_LIBRARIES is set then the MFC run time libraries are
 # installed as well as the CRT run time libraries.  If
+# CMAKE_INSTALL_OPENMP_LIBRARIES is set then the OpenMP run time libraries
+# are installed as well.  If
 # CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION is set then the libraries are
 # installed to that directory rather than the default.  If
 # CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS is NOT set, then this
@@ -94,6 +96,8 @@
         "${MSVC80_CRT_DIR}/msvcp80.dll"
         "${MSVC80_CRT_DIR}/msvcr80.dll"
         )
+    else()
+      set(__install__libs)
     endif()
 
     if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -132,6 +136,8 @@
         "${MSVC90_CRT_DIR}/msvcp90.dll"
         "${MSVC90_CRT_DIR}/msvcr90.dll"
         )
+    else()
+      set(__install__libs)
     endif()
 
     if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -168,6 +174,8 @@
         "${MSVC${v}_CRT_DIR}/msvcp${v}0.dll"
         "${MSVC${v}_CRT_DIR}/msvcr${v}0.dll"
         )
+    else()
+      set(__install__libs)
     endif()
 
     if(CMAKE_INSTALL_DEBUG_LIBRARIES)
@@ -192,6 +200,10 @@
     MSVCRT_FILES_FOR_VERSION(12)
   endif()
 
+  if(MSVC14)
+    MSVCRT_FILES_FOR_VERSION(14)
+  endif()
+
   if(CMAKE_INSTALL_MFC_LIBRARIES)
     if(MSVC70)
       set(__install__libs ${__install__libs}
@@ -361,6 +373,44 @@
     if(MSVC12)
       MFC_FILES_FOR_VERSION(12)
     endif()
+
+    if(MSVC14)
+      MFC_FILES_FOR_VERSION(14)
+    endif()
+  endif()
+
+  # MSVC 8 was the first version with OpenMP
+  # Furthermore, there is no debug version of this
+  if(CMAKE_INSTALL_OPENMP_LIBRARIES)
+    macro(OPENMP_FILES_FOR_VERSION version_a version_b)
+      set(va "${version_a}")
+      set(vb "${version_b}")
+      set(MSVC${va}_OPENMP_DIR "${MSVC${va}_REDIST_DIR}/${CMAKE_MSVC_ARCH}/Microsoft.VC${vb}.OPENMP")
+
+      if(NOT CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY)
+        set(__install__libs ${__install__libs}
+          "${MSVC${va}_OPENMP_DIR}/vcomp${vb}.dll")
+      endif()
+    endmacro()
+
+    if(MSVC80)
+      OPENMP_FILES_FOR_VERSION(80 80)
+    endif()
+    if(MSVC90)
+      OPENMP_FILES_FOR_VERSION(90 90)
+    endif()
+    if(MSVC10)
+      OPENMP_FILES_FOR_VERSION(10 100)
+    endif()
+    if(MSVC11)
+      OPENMP_FILES_FOR_VERSION(11 110)
+    endif()
+    if(MSVC12)
+      OPENMP_FILES_FOR_VERSION(12 120)
+    endif()
+    if(MSVC14)
+      OPENMP_FILES_FOR_VERSION(14 140)
+    endif()
   endif()
 
   foreach(lib
diff --git a/Modules/Platform/Android.cmake b/Modules/Platform/Android.cmake
new file mode 100644
index 0000000..1bdad04
--- /dev/null
+++ b/Modules/Platform/Android.cmake
@@ -0,0 +1,15 @@
+include(Platform/Linux)
+
+# Android has soname, but binary names must end in ".so" so we cannot append
+# a version number.  Also we cannot portably represent symlinks on the host.
+set(CMAKE_PLATFORM_NO_VERSIONED_SONAME 1)
+
+# Android reportedly ignores RPATH, and we cannot predict the install
+# location anyway.
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "")
+
+# Nsight Tegra Visual Studio Edition takes care of
+# prefixing library names with '-l'.
+if(CMAKE_VS_PLATFORM_NAME STREQUAL "Tegra-Android")
+  set(CMAKE_LINK_LIBRARY_FLAG "")
+endif()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index e25df1e..e5c5f36 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -70,6 +70,8 @@
     set(_sdk_ver "${CMAKE_MATCH_1}")
   elseif("${_CMAKE_OSX_SYSROOT_ORIG}" MATCHES "^macosx([0-9]+\\.[0-9]+)$")
     set(_sdk_ver "${CMAKE_MATCH_1}")
+  elseif("${_CMAKE_OSX_SYSROOT_ORIG}" STREQUAL "/")
+    set(_sdk_ver "${_CURRENT_OSX_VERSION}")
   else()
     message(FATAL_ERROR
       "CMAKE_OSX_DEPLOYMENT_TARGET is '${CMAKE_OSX_DEPLOYMENT_TARGET}' "
diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake
deleted file mode 100644
index e5721a7..0000000
--- a/Modules/Platform/QNX-QCC-C.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-include(Platform/QNX)
-
-__compiler_qcc(C)
diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake
deleted file mode 100644
index e490bbe..0000000
--- a/Modules/Platform/QNX-QCC-CXX.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-include(Platform/QNX)
-
-__compiler_qcc(CXX)
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index cc551bd..ebc4609 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -1,5 +1,8 @@
 set(QNXNTO 1)
 
+include(Platform/GNU)
+unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
+
 set(CMAKE_DL_LIBS "")
 
 # Shared libraries with no builtin soname may not be linked safely by
@@ -14,22 +17,3 @@
   set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
   set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
 endforeach()
-
-include(Platform/GNU)
-unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-
-macro(__compiler_qcc lang)
-  # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
-  set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
-
-  set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
-  set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
-
-  if (lang STREQUAL CXX)
-    # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the
-    # default for the driver is not c++.
-    set(CMAKE_CXX_COMPILE_OBJECT
-    "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
-  endif()
-
-endmacro()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index 5732170..a72f946 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -36,15 +36,14 @@
   set(CMAKE_CL_NOLOGO "/nologo")
 endif()
 
-set(WIN32 1)
-
-if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
-  set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
-  set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
-  set(WINCE 1)
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
+  set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
+  set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
+  set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
 else()
   set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
   set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+  set(_PLATFORM_LINK_FLAGS "")
 endif()
 
 if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
@@ -85,6 +84,7 @@
   set(MSVC10)
   set(MSVC11)
   set(MSVC12)
+  set(MSVC14)
   set(MSVC60)
   set(MSVC70)
   set(MSVC71)
@@ -92,7 +92,9 @@
   set(MSVC90)
   set(CMAKE_COMPILER_2005)
   set(CMAKE_COMPILER_SUPPORTS_PDBTYPE)
-  if(NOT "${_compiler_version}" VERSION_LESS 18)
+  if(NOT "${_compiler_version}" VERSION_LESS 19)
+    set(MSVC14 1)
+  elseif(NOT "${_compiler_version}" VERSION_LESS 18)
     set(MSVC12 1)
   elseif(NOT "${_compiler_version}" VERSION_LESS 17)
     set(MSVC11 1)
@@ -160,10 +162,23 @@
   if (MSVC_VERSION LESS 1600)
     set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib")
   endif ()
+elseif(WINDOWS_PHONE OR WINDOWS_STORE)
+  set(_PLATFORM_DEFINES "/DWIN32")
+  set(_FLAGS_C " /DUNICODE /D_UNICODE")
+  set(_FLAGS_CXX " /DUNICODE /D_UNICODE /GR /EHsc")
+  if(WINDOWS_PHONE)
+    set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib")
+  elseif(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM)
+    set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+  else()
+    set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
+  endif()
 else()
   set(_PLATFORM_DEFINES "/DWIN32")
 
-  if(MSVC_VERSION GREATER 1310)
+  if(MSVC_C_ARCHITECTURE_ID STREQUAL ARM OR MSVC_CXX_ARCHITECTURE_ID STREQUAL ARM)
+    set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib")
+  elseif(MSVC_VERSION GREATER 1310)
     set(_RTC1 "/RTC1")
     set(_FLAGS_CXX " /GR /EHsc")
     set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib")
@@ -197,10 +212,12 @@
 # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
 # on versions that support it
 set( MSVC_INCREMENTAL_YES_FLAG "")
-if(NOT MSVC_INCREMENTAL_DEFAULT)
-  set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
-else()
-  set(  MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+if(NOT WINDOWS_PHONE AND NOT WINDOWS_STORE)
+  if(NOT MSVC_INCREMENTAL_DEFAULT)
+    set( MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL:YES")
+  else()
+    set(  MSVC_INCREMENTAL_YES_FLAG "/INCREMENTAL" )
+  endif()
 endif()
 
 if (CMAKE_COMPILER_SUPPORTS_PDBTYPE)
@@ -235,7 +252,7 @@
     set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
   endif()
   set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
-    "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+    "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
 
   set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
   set(CMAKE_${lang}_CREATE_STATIC_LIBRARY  "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
@@ -249,11 +266,12 @@
 
   set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
   set(CMAKE_${lang}_LINK_EXECUTABLE
-    "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+    "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
   set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
   set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
   set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
   set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")
   set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG")
+  set(CMAKE_${lang}_LINKER_SUPPORTS_PDB ON)
 endmacro()
diff --git a/Modules/Platform/Windows-df.cmake b/Modules/Platform/Windows-df.cmake
index 8dfb610..211cc9d 100644
--- a/Modules/Platform/Windows-df.cmake
+++ b/Modules/Platform/Windows-df.cmake
@@ -26,7 +26,6 @@
 
 set(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
 
-set(CMAKE_${lang}_COMPILER_LINKER_OPTION_FLAG_EXECUTABLE "/link")
 set(CMAKE_Fortran_LINK_EXECUTABLE
     "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /exe:<TARGET> <OBJECTS> /link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake
index b158a9d..9a937a7 100644
--- a/Modules/Platform/Windows.cmake
+++ b/Modules/Platform/Windows.cmake
@@ -1,5 +1,13 @@
 set(WIN32 1)
 
+if(CMAKE_SYSTEM_NAME STREQUAL "WindowsCE")
+  set(WINCE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsPhone")
+  set(WINDOWS_PHONE 1)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+  set(WINDOWS_STORE 1)
+endif()
+
 set(CMAKE_STATIC_LIBRARY_PREFIX "")
 set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
 set(CMAKE_SHARED_LIBRARY_PREFIX "")          # lib
diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake
deleted file mode 100644
index d28b4ab..0000000
--- a/Modules/Platform/WindowsCE-MSVC.cmake
+++ /dev/null
@@ -1 +0,0 @@
-include(Platform/Windows-MSVC)
diff --git a/Modules/Platform/WindowsPhone-MSVC-C.cmake b/Modules/Platform/WindowsPhone-MSVC-C.cmake
new file mode 100644
index 0000000..ce8060b
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsPhone-MSVC-CXX.cmake b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
new file mode 100644
index 0000000..281eadc
--- /dev/null
+++ b/Modules/Platform/WindowsPhone-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsPhone.cmake b/Modules/Platform/WindowsPhone.cmake
new file mode 100644
index 0000000..65b2eae
--- /dev/null
+++ b/Modules/Platform/WindowsPhone.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/Platform/WindowsStore-MSVC-C.cmake b/Modules/Platform/WindowsStore-MSVC-C.cmake
new file mode 100644
index 0000000..ce8060b
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-C.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-C)
diff --git a/Modules/Platform/WindowsStore-MSVC-CXX.cmake b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
new file mode 100644
index 0000000..281eadc
--- /dev/null
+++ b/Modules/Platform/WindowsStore-MSVC-CXX.cmake
@@ -0,0 +1 @@
+include(Platform/Windows-MSVC-CXX)
diff --git a/Modules/Platform/WindowsStore.cmake b/Modules/Platform/WindowsStore.cmake
new file mode 100644
index 0000000..65b2eae
--- /dev/null
+++ b/Modules/Platform/WindowsStore.cmake
@@ -0,0 +1 @@
+include(Platform/Windows)
diff --git a/Modules/ProcessorCount.cmake b/Modules/ProcessorCount.cmake
index e034a28..8f21adf 100644
--- a/Modules/ProcessorCount.cmake
+++ b/Modules/ProcessorCount.cmake
@@ -103,6 +103,10 @@
         OUTPUT_VARIABLE machinfo_output)
       string(REGEX MATCHALL "Number of CPUs = ([0-9]+)" procs "${machinfo_output}")
       set(count "${CMAKE_MATCH_1}")
+      if(NOT count)
+        string(REGEX MATCHALL "([0-9]+) logical processors" procs "${machinfo_output}")
+        set(count "${CMAKE_MATCH_1}")
+      endif()
       #message("ProcessorCount: trying machinfo '${ProcessorCount_cmd_machinfo}'")
     else()
       find_program(ProcessorCount_cmd_mpsched mpsched)
diff --git a/Modules/TestBigEndian.cmake b/Modules/TestBigEndian.cmake
index 6f32b08..fcb41ab 100644
--- a/Modules/TestBigEndian.cmake
+++ b/Modules/TestBigEndian.cmake
@@ -25,7 +25,7 @@
 #  License text for the above reference.)
 
 macro(TEST_BIG_ENDIAN VARIABLE)
-  if("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$")
+  if(NOT DEFINED HAVE_${VARIABLE})
     message(STATUS "Check if the system is big endian")
     message(STATUS "Searching 16 bit integer")
 
diff --git a/Modules/TestForANSIForScope.cmake b/Modules/TestForANSIForScope.cmake
index de4b1f1..78fff9f 100644
--- a/Modules/TestForANSIForScope.cmake
+++ b/Modules/TestForANSIForScope.cmake
@@ -24,7 +24,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
+if(NOT DEFINED CMAKE_ANSI_FOR_SCOPE)
   message(STATUS "Check for ANSI scope")
   try_compile(CMAKE_ANSI_FOR_SCOPE  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake
index 8977583..fe18ea2 100644
--- a/Modules/TestForSSTREAM.cmake
+++ b/Modules/TestForSSTREAM.cmake
@@ -23,7 +23,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$")
+if(NOT DEFINED CMAKE_HAS_ANSI_STRING_STREAM)
   message(STATUS "Check for sstream")
   try_compile(CMAKE_HAS_ANSI_STRING_STREAM  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx
diff --git a/Modules/TestForSTDNamespace.cmake b/Modules/TestForSTDNamespace.cmake
index e43b75d..0d90774 100644
--- a/Modules/TestForSTDNamespace.cmake
+++ b/Modules/TestForSTDNamespace.cmake
@@ -23,7 +23,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-if("CMAKE_STD_NAMESPACE" MATCHES "^CMAKE_STD_NAMESPACE$")
+if(NOT DEFINED CMAKE_STD_NAMESPACE)
   message(STATUS "Check for STD namespace")
   try_compile(CMAKE_STD_NAMESPACE  ${CMAKE_BINARY_DIR}
     ${CMAKE_ROOT}/Modules/TestForSTDNamespace.cxx
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 918e2ec..31ab48d 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -73,7 +73,7 @@
   set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
 
   set(SWIG_MODULE_${name}_REAL_NAME "${name}")
-  if (CMAKE_SWIG_FLAGS MATCHES "-noproxy")
+  if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;")
     set (SWIG_MODULE_${name}_NOPROXY TRUE)
   endif ()
   if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake
index f2f260d..b3633a6 100644
--- a/Modules/UsewxWidgets.cmake
+++ b/Modules/UsewxWidgets.cmake
@@ -88,8 +88,11 @@
   endif()
 
   if   (wxWidgets_CXX_FLAGS)
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
-    MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
+    # Flags are expected to be a string here, not a list.
+    string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}")
+    MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}")
+    unset(wxWidgets_CXX_FLAGS_str)
   endif()
 
   # DEPRECATED JW
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 7d28e95..bf55eb9 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -6,7 +6,10 @@
 #
 # ::
 #
-#   WRITE_BASIC_CONFIG_VERSION_FILE( filename [VERSION major.minor.patch] COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+#   WRITE_BASIC_CONFIG_VERSION_FILE( filename
+#     [VERSION major.minor.patch]
+#     COMPATIBILITY (AnyNewerVersion|SameMajorVersion)
+#     )
 #
 #
 #
diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake
index 6e64cd2..86137e2 100644
--- a/Modules/WriteCompilerDetectionHeader.cmake
+++ b/Modules/WriteCompilerDetectionHeader.cmake
@@ -52,7 +52,15 @@
 # Feature Test Macros
 # ===================
 #
-# For each compiler, a preprocessor test of the compiler version is generated
+# For each compiler, a preprocessor macro is generated matching
+# ``<PREFIX>_COMPILER_IS_<compiler>`` which has the content either ``0``
+# or ``1``, depending on the compiler in use. Preprocessor macros for
+# compiler version components are generated matching
+# ``<PREFIX>_COMPILER_VERSION_MAJOR`` ``<PREFIX>_COMPILER_VERSION_MINOR``
+# and ``<PREFIX>_COMPILER_VERSION_PATCH`` containing decimal values
+# for the corresponding compiler version components, if defined.
+#
+# A preprocessor test is generated based on the compiler version
 # denoting whether each feature is enabled.  A preprocessor macro
 # matching ``<PREFIX>_COMPILER_<FEATURE>``, where ``<FEATURE>`` is the
 # upper-case ``<feature>`` name, is generated to contain the value
@@ -91,14 +99,14 @@
 #
 # .. code-block:: c++
 #
-#    class MyClass ClimbingStats_DECL_CXX_FINAL
+#    class MyClass ClimbingStats_FINAL
 #    {
-#        ClimbingStats_DECL_CXX_CONSTEXPR int someInterface() { return 42; }
+#        ClimbingStats_CONSTEXPR int someInterface() { return 42; }
 #    };
 #
-# The ``ClimbingStats_DECL_CXX_FINAL`` macro will expand to ``final`` if the
+# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
 # compiler (and its flags) support the ``cxx_final`` feature, and the
-# ``ClimbingStats_DECL_CXX_CONSTEXPR`` macro will expand to ``constexpr``
+# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
 # if ``cxx_constexpr`` is supported.
 #
 # The following features generate corresponding symbol defines:
@@ -138,6 +146,16 @@
 # ``[[deprecated]]`` attribute or a compiler-specific decorator such
 # as ``__attribute__((__deprecated__))`` used by GNU compilers.
 #
+# The ``cxx_alignas`` feature provides a macro definition
+# ``<PREFIX>_ALIGNAS`` which expands to either the standard ``alignas``
+# decorator or a compiler-specific decorator such as
+# ``__attribute__ ((__aligned__))`` used by GNU compilers.
+#
+# The ``cxx_alignof`` feature provides a macro definition
+# ``<PREFIX>_ALIGNOF`` which expands to either the standard ``alignof``
+# decorator or a compiler-specific decorator such as ``__alignof__``
+# used by GNU compilers.
+#
 # ============================= ================================ =====================
 #           Feature                          Define                     Symbol
 # ============================= ================================ =====================
@@ -187,6 +205,8 @@
   foreach(feature ${ARGN})
     set(_cmake_feature_test_${CompilerId}_${feature} ${_cmake_feature_test_${feature}} PARENT_SCOPE)
   endforeach()
+  include("${CMAKE_ROOT}/Modules/Compiler/${CompilerId}-DetermineCompiler.cmake" OPTIONAL)
+  set(_compiler_id_version_compute_${CompilerId} ${_compiler_id_version_compute} PARENT_SCOPE)
 endfunction()
 
 function(write_compiler_detection_header
@@ -215,22 +235,44 @@
     message(FATAL_ERROR "Unparsed arguments: ${_WCD_UNPARSED_ARGUMENTS}")
   endif()
 
+  if (prefix_arg STREQUAL "")
+    message(FATAL_ERROR "A prefix must be specified")
+  endif()
+  string(MAKE_C_IDENTIFIER ${prefix_arg} cleaned_prefix)
+  if (NOT prefix_arg STREQUAL cleaned_prefix)
+    message(FATAL_ERROR "The prefix must be a valid C identifier.")
+  endif()
+
   if(NOT _WCD_VERSION)
     set(_WCD_VERSION ${CMAKE_MINIMUM_REQUIRED_VERSION})
   endif()
-  if (_WCD_VERSION VERSION_LESS 3.1.0) # Version which introduced this function
-    message(FATAL_ERROR "VERSION parameter too low.")
+  set(_min_version 3.1.0) # Version which introduced this function
+  if (_WCD_VERSION VERSION_LESS _min_version)
+    set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.")
+    set(err "${err}  It must be set to at least ${_min_version}.  ")
+    set(err "${err}  Either set the VERSION parameter to the write_compiler_detection_header function, or update")
+    set(err "${err} your minimum required CMake version with the cmake_minimum_required command.")
+    message(FATAL_ERROR "${err}")
   endif()
 
   set(compilers
     GNU
     Clang
   )
+
+  set(_hex_compilers ADSP Borland Embarcadero SunPro)
+
   foreach(_comp ${_WCD_COMPILERS})
     list(FIND compilers ${_comp} idx)
     if (idx EQUAL -1)
       message(FATAL_ERROR "Unsupported compiler ${_comp}.")
     endif()
+    if (NOT _need_hex_conversion)
+      list(FIND _hex_compilers ${_comp} idx)
+      if (NOT idx EQUAL -1)
+        set(_need_hex_conversion TRUE)
+      endif()
+    endif()
   endforeach()
 
   set(file_content "
@@ -244,6 +286,21 @@
     set(file_content "${file_content}\n${_WCD_PROLOG}\n")
   endif()
 
+  if (_need_hex_conversion)
+    set(file_content "${file_content}
+#define ${prefix_arg}_DEC(X) (X)
+#define ${prefix_arg}_HEX(X) ( \\
+    ((X)>>28 & 0xF) * 10000000 + \\
+    ((X)>>24 & 0xF) *  1000000 + \\
+    ((X)>>20 & 0xF) *   100000 + \\
+    ((X)>>16 & 0xF) *    10000 + \\
+    ((X)>>12 & 0xF) *     1000 + \\
+    ((X)>>8  & 0xF) *      100 + \\
+    ((X)>>4  & 0xF) *       10 + \\
+    ((X)     & 0xF) \\
+    )\n")
+  endif()
+
   foreach(feature ${_WCD_FEATURES})
     if (feature MATCHES "^cxx_")
       list(APPEND _langs CXX)
@@ -287,6 +344,21 @@
 #    if !(${_cmake_oldestSupported_${compiler}})
 #      error Unsupported compiler version
 #    endif\n")
+
+      set(PREFIX ${prefix_arg}_)
+      if (_need_hex_conversion)
+        set(MACRO_DEC ${prefix_arg}_DEC)
+        set(MACRO_HEX ${prefix_arg}_HEX)
+      else()
+        set(MACRO_DEC)
+        set(MACRO_HEX)
+      endif()
+      string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY)
+      set(file_content "${file_content}${VERSION_BLOCK}\n")
+      set(PREFIX)
+      set(MACRO_DEC)
+      set(MACRO_HEX)
+
       set(pp_if "elif")
       foreach(feature ${${_lang}_features})
         string(TOUPPER ${feature} feature_upper)
@@ -322,7 +394,7 @@
 \n")
       endif()
       if (feature STREQUAL cxx_constexpr)
-        set(def_value "${prefix_arg}_DECL_${feature_upper}")
+        set(def_value "${prefix_arg}_CONSTEXPR")
         set(file_content "${file_content}
 #  if ${def_name}
 #    define ${def_value} constexpr
@@ -332,7 +404,7 @@
 \n")
       endif()
       if (feature STREQUAL cxx_final)
-        set(def_value "${prefix_arg}_DECL_${feature_upper}")
+        set(def_value "${prefix_arg}_FINAL")
         set(file_content "${file_content}
 #  if ${def_name}
 #    define ${def_value} final
@@ -342,7 +414,7 @@
 \n")
       endif()
       if (feature STREQUAL cxx_override)
-        set(def_value "${prefix_arg}_DECL_${feature_upper}")
+        set(def_value "${prefix_arg}_OVERRIDE")
         set(file_content "${file_content}
 #  if ${def_name}
 #    define ${def_value} override
@@ -364,7 +436,7 @@
         set(file_content "${file_content}
 #  if ${def_name}
 #    define ${def_value} alignas(X)
-#  elif ${prefix_arg}_COMPILER_IS_GNU
+#  elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
 #    define ${def_value} __attribute__ ((__aligned__(X)))
 #  else
 #    define ${def_value}
@@ -376,7 +448,7 @@
         set(file_content "${file_content}
 #  if ${def_name}
 #    define ${def_value} alignof(X)
-#  elif ${prefix_arg}_COMPILER_IS_GNU
+#  elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
 #    define ${def_value} __alignof__(X)
 #  endif
 \n")
@@ -431,10 +503,10 @@
 #    if ${def_name}
 #      define ${def_value} [[deprecated]]
 #      define ${def_value}_MSG(MSG) [[deprecated(MSG)]]
-#    elif defined(__GNUC__) || defined(__clang__)
+#    elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang
 #      define ${def_value} __attribute__((__deprecated__))
 #      define ${def_value}_MSG(MSG) __attribute__((__deprecated__(MSG)))
-#    elif defined(_MSC_VER)
+#    elif ${prefix_arg}_COMPILER_IS_MSVC
 #      define ${def_value} __declspec(deprecated)
 #      define ${def_value}_MSG(MSG) __declspec(deprecated(MSG))
 #    else
diff --git a/README.rst b/README.rst
index e91b209..e8524f8 100644
--- a/README.rst
+++ b/README.rst
@@ -75,6 +75,22 @@
 
 .. _`Running CMake`: http://www.cmake.org/cmake/help/runningcmake.html
 
+Reporting Bugs
+==============
+
+If you have found a bug:
+
+1. If you have a patch, please read the `CONTRIBUTING.rst`_ document.
+
+2. Otherwise, please join the the `CMake Users List`_ and ask about
+   the expected and observed behaviors to determine if it is really
+   a bug.
+
+3. Finally, if the issue is not resolved by the above steps, open
+   an entry in the `CMake Issue Tracker`_.
+
+.. _`CMake Issue Tracker`: http://www.cmake.org/Bug
+
 Contributing
 ============
 
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index fe6cc1b..f9405b3 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -308,6 +308,7 @@
   cmTest.h
   cmTestGenerator.cxx
   cmTestGenerator.h
+  cmUuid.cxx
   cmVariableWatch.cxx
   cmVariableWatch.h
   cmVersion.cxx
@@ -426,6 +427,8 @@
       cmGlobalVisualStudio11Generator.cxx
       cmGlobalVisualStudio12Generator.h
       cmGlobalVisualStudio12Generator.cxx
+      cmGlobalVisualStudio14Generator.h
+      cmGlobalVisualStudio14Generator.cxx
       cmGlobalVisualStudioGenerator.cxx
       cmGlobalVisualStudioGenerator.h
       cmIDEFlagTable.h
@@ -448,7 +451,7 @@
 endif ()
 
 # Watcom support
-if(WIN32 OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
+if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Linux")
   set_property(SOURCE cmake.cxx APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_USE_WMAKE)
   list(APPEND SRCS
     cmGlobalWatcomWMakeGenerator.cxx
@@ -518,6 +521,7 @@
   CTest/cmParseMumpsCoverage.cxx
   CTest/cmParseCacheCoverage.cxx
   CTest/cmParseGTMCoverage.cxx
+  CTest/cmParseJacocoCoverage.cxx
   CTest/cmParsePHPCoverage.cxx
   CTest/cmParseCoberturaCoverage.cxx
   CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
@@ -574,11 +578,16 @@
   CPack/cmCPackGenerator.cxx
   CPack/cmCPackLog.cxx
   CPack/cmCPackNSISGenerator.cxx
+  CPack/IFW/cmCPackIFWPackage.cxx
+  CPack/IFW/cmCPackIFWInstaller.cxx
+  CPack/IFW/cmCPackIFWGenerator.cxx
   CPack/cmCPackSTGZGenerator.cxx
   CPack/cmCPackTGZGenerator.cxx
+  CPack/cmCPackTXZGenerator.cxx
   CPack/cmCPackTarBZip2Generator.cxx
   CPack/cmCPackTarCompressGenerator.cxx
   CPack/cmCPackZIPGenerator.cxx
+  CPack/cmCPack7zGenerator.cxx
   )
 
 if(CYGWIN)
@@ -598,13 +607,14 @@
 if(WIN32)
   set(CPACK_SRCS ${CPACK_SRCS}
     CPack/WiX/cmCPackWIXGenerator.cxx
-    CPack/WiX/cmWIXSourceWriter.cxx
+    CPack/WiX/cmWIXAccessControlList.cxx
     CPack/WiX/cmWIXDirectoriesSourceWriter.cxx
     CPack/WiX/cmWIXFeaturesSourceWriter.cxx
     CPack/WiX/cmWIXFilesSourceWriter.cxx
-    CPack/WiX/cmWIXRichTextFormatWriter.cxx
     CPack/WiX/cmWIXPatch.cxx
     CPack/WiX/cmWIXPatchParser.cxx
+    CPack/WiX/cmWIXRichTextFormatWriter.cxx
+    CPack/WiX/cmWIXSourceWriter.cxx
   )
 endif()
 
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 34aefb4..716f229 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 0)
-set(CMake_VERSION_PATCH 20140609)
-#set(CMake_VERSION_RC 1)
+set(CMake_VERSION_MINOR 1)
+set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
new file mode 100644
index 0000000..7f06e2d
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -0,0 +1,552 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmCPackIFWGenerator.h"
+
+#include "cmCPackIFWPackage.h"
+#include "cmCPackIFWInstaller.h"
+
+#include <CPack/cmCPackLog.h>
+#include <CPack/cmCPackComponentGroup.h>
+
+#include <cmsys/SystemTools.hxx>
+#include <cmsys/Glob.hxx>
+#include <cmsys/Directory.hxx>
+#include <cmsys/RegularExpression.hxx>
+
+#include <cmGlobalGenerator.h>
+#include <cmLocalGenerator.h>
+#include <cmSystemTools.h>
+#include <cmMakefile.h>
+#include <cmGeneratedFileStream.h>
+#include <cmXMLSafe.h>
+
+//----------------------------------------------------------------------------
+cmCPackIFWGenerator::cmCPackIFWGenerator()
+{
+}
+
+//----------------------------------------------------------------------------
+cmCPackIFWGenerator::~cmCPackIFWGenerator()
+{
+}
+
+//----------------------------------------------------------------------------
+int cmCPackIFWGenerator::PackageFiles()
+{
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Configuration" << std::endl);
+
+  // Installer configuragion
+  Installer.GenerateInstallerFile();
+
+  // Packages configuration
+  Installer.GeneratePackageFiles();
+
+  std::string ifwTLD = this->GetOption("CPACK_TOPLEVEL_DIRECTORY");
+  std::string ifwTmpFile = ifwTLD;
+  ifwTmpFile += "/IFWOutput.log";
+
+  // Run repogen
+  if (!Installer.Repositories.empty())
+    {
+    std::string ifwCmd = RepoGen;
+    ifwCmd += " -c " + this->toplevel + "/config/config.xml";
+    ifwCmd += " -p " + this->toplevel + "/packages";
+
+    if(!PkgsDirsVector.empty())
+      {
+      for(std::vector<std::string>::iterator it = PkgsDirsVector.begin();
+          it != PkgsDirsVector.end(); ++it)
+        {
+        ifwCmd += " -p " + *it;
+        }
+      }
+
+    if (!OnlineOnly && !DownloadedPackages.empty())
+      {
+      ifwCmd += " -i ";
+      std::set<cmCPackIFWPackage*>::iterator it
+        = DownloadedPackages.begin();
+      ifwCmd += (*it)->Name;
+      ++it;
+      while(it != DownloadedPackages.end())
+        {
+        ifwCmd += "," + (*it)->Name;
+        ++it;
+        }
+      }
+    ifwCmd += " " + this->toplevel + "/repository";
+    cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd
+                  << std::endl);
+    std::string output;
+    int retVal = 1;
+    cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+                  "- Generate repository" << std::endl);
+    bool res = cmSystemTools::RunSingleCommand(
+      ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0);
+    if ( !res || retVal )
+      {
+      cmGeneratedFileStream ofs(ifwTmpFile.c_str());
+      ofs << "# Run command: " << ifwCmd << std::endl
+          << "# Output:" << std::endl
+          << output << std::endl;
+      cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
+                    << ifwCmd << std::endl
+                    << "Please check " << ifwTmpFile << " for errors"
+                    << std::endl);
+      return 0;
+      }
+    cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- repository: " << this->toplevel
+                  << "/repository generated" << std::endl);
+    }
+
+  // Run binary creator
+  {
+  std::string ifwCmd = BinCreator;
+  ifwCmd += " -c " + this->toplevel + "/config/config.xml";
+  ifwCmd += " -p " + this->toplevel + "/packages";
+
+  if(!PkgsDirsVector.empty())
+    {
+    for(std::vector<std::string>::iterator it = PkgsDirsVector.begin();
+        it != PkgsDirsVector.end(); ++it)
+      {
+      ifwCmd += " -p " + *it;
+      }
+    }
+
+  if (OnlineOnly)
+    {
+    ifwCmd += " --online-only";
+    }
+  else if (!DownloadedPackages.empty() && !Installer.Repositories.empty())
+    {
+    ifwCmd += " -e ";
+    std::set<cmCPackIFWPackage*>::iterator it
+      = DownloadedPackages.begin();
+    ifwCmd += (*it)->Name;
+    ++it;
+    while(it != DownloadedPackages.end())
+      {
+      ifwCmd += "," + (*it)->Name;
+      ++it;
+      }
+    }
+  else if (!DependentPackages.empty())
+    {
+    ifwCmd += " -i ";
+    // Binary
+    std::set<cmCPackIFWPackage*>::iterator bit = BinaryPackages.begin();
+    while(bit != BinaryPackages.end())
+      {
+      ifwCmd += (*bit)->Name + ",";
+      ++bit;
+      }
+    // Depend
+    DependenceMap::iterator it = DependentPackages.begin();
+    ifwCmd += it->second.Name;
+    ++it;
+    while(it != DependentPackages.end())
+      {
+      ifwCmd += "," + it->second.Name;
+      ++it;
+      }
+    }
+  // TODO: set correct name for multipackages
+  if (this->packageFileNames.size() > 0)
+    {
+    ifwCmd += " " + packageFileNames[0];
+    }
+  else
+    {
+    ifwCmd += " installer";
+    }
+  cmCPackLogger(cmCPackLog::LOG_VERBOSE, "Execute: " << ifwCmd
+                << std::endl);
+  std::string output;
+  int retVal = 1;
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT, "- Generate package" << std::endl);
+  bool res = cmSystemTools::RunSingleCommand(
+    ifwCmd.c_str(), &output, &retVal, 0, this->GeneratorVerbose, 0);
+  if ( !res || retVal )
+    {
+    cmGeneratedFileStream ofs(ifwTmpFile.c_str());
+    ofs << "# Run command: " << ifwCmd << std::endl
+        << "# Output:" << std::endl
+        << output << std::endl;
+    cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running IFW command: "
+                  << ifwCmd << std::endl
+                  << "Please check " << ifwTmpFile << " for errors"
+                  << std::endl);
+    return 0;
+    }
+  }
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+const char *cmCPackIFWGenerator::GetPackagingInstallPrefix()
+{
+  const char *defPrefix = cmCPackGenerator::GetPackagingInstallPrefix();
+
+  std::string tmpPref = defPrefix ? defPrefix : "";
+
+  if(this->Components.empty())
+    {
+    tmpPref += "packages/" + GetRootPackageName() + "/data";
+    }
+
+  this->SetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX", tmpPref.c_str());
+
+  return this->GetOption("CPACK_IFW_PACKAGING_INSTALL_PREFIX");
+}
+
+//----------------------------------------------------------------------------
+const char *cmCPackIFWGenerator::GetOutputExtension()
+{
+  const char *suffix = this->GetOption("CMAKE_EXECUTABLE_SUFFIX");
+  return suffix ? suffix : cmCPackGenerator::GetOutputExtension();
+}
+
+//----------------------------------------------------------------------------
+int cmCPackIFWGenerator::InitializeInternal()
+{
+  // Search Qt Installer Framework tools
+
+  const std::string BinCreatorOpt = "CPACK_IFW_BINARYCREATOR_EXECUTABLE";
+  const std::string RepoGenOpt = "CPACK_IFW_REPOGEN_EXECUTABLE";
+
+  if(!this->IsSet(BinCreatorOpt) ||
+     !this->IsSet(RepoGenOpt))
+    {
+    this->ReadListFile("CPackIFW.cmake");
+    }
+
+  // Look 'binarycreator' executable (needs)
+
+  const char *BinCreatorStr = this->GetOption(BinCreatorOpt);
+  if(!BinCreatorStr || cmSystemTools::IsNOTFOUND(BinCreatorStr))
+    {
+    BinCreator = "";
+    }
+  else
+    {
+    BinCreator = BinCreatorStr;
+    }
+
+  if (BinCreator.empty())
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+                  "Cannot find QtIFW compiler \"binarycreator\": "
+                  "likely it is not installed, or not in your PATH"
+                  << std::endl);
+    return 0;
+    }
+
+  // Look 'repogen' executable (optional)
+
+  const char *RepoGenStr = this->GetOption(RepoGenOpt);
+  if(!RepoGenStr || cmSystemTools::IsNOTFOUND(RepoGenStr))
+    {
+    RepoGen = "";
+    }
+  else
+    {
+    RepoGen = RepoGenStr;
+    }
+
+  // Variables that Change Behavior
+
+  // Resolve duplicate names
+  ResolveDuplicateNames = this->IsOn("CPACK_IFW_RESOLVE_DUPLICATE_NAMES");
+
+  // Additional packages dirs
+  PkgsDirsVector.clear();
+  if(const char* dirs = this->GetOption("CPACK_IFW_PACKAGES_DIRECTORIES"))
+    {
+    cmSystemTools::ExpandListArgument(dirs,
+                                      PkgsDirsVector);
+    }
+
+  // Installer
+  Installer.Generator = this;
+  Installer.ConfigureFromOptions();
+
+  if (const char* ifwDownloadAll =
+      this->GetOption("CPACK_IFW_DOWNLOAD_ALL"))
+    {
+    OnlineOnly = cmSystemTools::IsOn(ifwDownloadAll);
+    }
+  else if (const char* cpackDownloadAll =
+           this->GetOption("CPACK_DOWNLOAD_ALL"))
+    {
+    OnlineOnly = cmSystemTools::IsOn(cpackDownloadAll);
+    }
+  else
+    {
+    OnlineOnly = false;
+    }
+
+  if (!Installer.Repositories.empty() && RepoGen.empty()) {
+  cmCPackLogger(cmCPackLog::LOG_ERROR,
+                "Cannot find QtIFW repository generator \"repogen\": "
+                "likely it is not installed, or not in your PATH"
+                << std::endl);
+  return 0;
+  }
+
+  return this->Superclass::InitializeInternal();
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmCPackIFWGenerator::GetComponentInstallDirNameSuffix(
+  const std::string& componentName)
+{
+  const std::string prefix = "packages/";
+  const std::string suffix = "/data";
+
+  if (componentPackageMethod == ONE_PACKAGE) {
+  return std::string(prefix + GetRootPackageName() + suffix);
+  }
+
+  return prefix
+    + GetComponentPackageName(&Components[componentName])
+    + suffix;
+}
+
+//----------------------------------------------------------------------------
+cmCPackComponent*
+cmCPackIFWGenerator::GetComponent(const std::string &projectName,
+                                  const std::string &componentName)
+{
+  ComponentsMap::iterator cit = Components.find(componentName);
+  if ( cit != Components.end() ) return &(cit->second);
+
+  cmCPackComponent* component
+    = cmCPackGenerator::GetComponent(projectName, componentName);
+  if(!component) return component;
+
+  std::string name = GetComponentPackageName(component);
+  PackagesMap::iterator pit = Packages.find(name);
+  if(pit != Packages.end()) return component;
+
+  cmCPackIFWPackage *package = &Packages[name];
+  package->Name = name;
+  package->Generator = this;
+  if(package->ConfigureFromComponent(component))
+    {
+    package->Installer = &Installer;
+    Installer.Packages.insert(
+      std::pair<std::string, cmCPackIFWPackage*>(
+        name, package));
+    ComponentPackages.insert(
+      std::pair<cmCPackComponent*, cmCPackIFWPackage*>(
+        component, package));
+    if(component->IsDownloaded)
+      {
+      DownloadedPackages.insert(package);
+      }
+    else
+      {
+      BinaryPackages.insert(package);
+      }
+    }
+  else
+    {
+    Packages.erase(name);
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+                  "Cannot configure package \"" << name <<
+                  "\" for component \"" << component->Name << "\""
+                  << std::endl);
+    }
+
+  return component;
+}
+
+//----------------------------------------------------------------------------
+cmCPackComponentGroup*
+cmCPackIFWGenerator::GetComponentGroup(const std::string &projectName,
+                                       const std::string &groupName)
+{
+  cmCPackComponentGroup* group
+    = cmCPackGenerator::GetComponentGroup(projectName, groupName);
+  if(!group) return group;
+
+  std::string name = GetGroupPackageName(group);
+  PackagesMap::iterator pit = Packages.find(name);
+  if(pit != Packages.end()) return group;
+
+  cmCPackIFWPackage *package = &Packages[name];
+  package->Name = name;
+  package->Generator = this;
+  if(package->ConfigureFromGroup(group))
+    {
+    package->Installer = &Installer;
+    Installer.Packages.insert(
+      std::pair<std::string, cmCPackIFWPackage*>(
+        name, package));
+    GroupPackages.insert(
+      std::pair<cmCPackComponentGroup*, cmCPackIFWPackage*>(
+        group, package));
+    BinaryPackages.insert(package);
+    }
+  else
+    {
+    Packages.erase(name);
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+                  "Cannot configure package \"" << name <<
+                  "\" for component group \"" << group->Name << "\""
+                  << std::endl);
+    }
+  return group;
+}
+
+//----------------------------------------------------------------------------
+enum cmCPackGenerator::CPackSetDestdirSupport
+cmCPackIFWGenerator::SupportsSetDestdir() const
+{
+  return cmCPackGenerator::SETDESTDIR_SHOULD_NOT_BE_USED;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::SupportsAbsoluteDestination() const
+{
+  return false;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::SupportsComponentInstallation() const
+{
+  return true;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWGenerator::IsOnePackage() const
+{
+  return componentPackageMethod == ONE_PACKAGE;
+}
+
+//----------------------------------------------------------------------------
+std::string cmCPackIFWGenerator::GetRootPackageName()
+{
+  // Default value
+  std::string name = "root";
+  if (const char* optIFW_PACKAGE_GROUP =
+      this->GetOption("CPACK_IFW_PACKAGE_GROUP"))
+    {
+    // Configure from root group
+    cmCPackIFWPackage package;
+    package.Generator = this;
+    package.ConfigureFromGroup(optIFW_PACKAGE_GROUP);
+    name = package.Name;
+    }
+  else if (const char* optIFW_PACKAGE_NAME =
+           this->GetOption("CPACK_IFW_PACKAGE_NAME"))
+    {
+    // Configure from root package name
+    name = optIFW_PACKAGE_NAME;
+    }
+  else if (const char* optPACKAGE_NAME =
+           this->GetOption("CPACK_PACKAGE_NAME"))
+    {
+    // Configure from package name
+    name = optPACKAGE_NAME;
+    }
+  return name;
+}
+
+//----------------------------------------------------------------------------
+std::string
+cmCPackIFWGenerator::GetGroupPackageName(cmCPackComponentGroup *group) const
+{
+  std::string name;
+  if (!group) return name;
+  if (cmCPackIFWPackage* package = GetGroupPackage(group))
+    {
+    return package->Name;
+    }
+  const char* option = GetOption(
+    "CPACK_IFW_COMPONENT_GROUP_"
+    + cmsys::SystemTools::UpperCase(group->Name)
+    + "_NAME");
+  name = option ? option : group->Name;
+  if(group->ParentGroup)
+    {
+    cmCPackIFWPackage* package = GetGroupPackage(group->ParentGroup);
+    bool dot = !ResolveDuplicateNames;
+    if(dot && name.substr(0, package->Name.size()) == package->Name)
+      {
+      dot = false;
+      }
+    if(dot)
+      {
+      name = package->Name + "." + name;
+      }
+    }
+  return name;
+}
+
+//----------------------------------------------------------------------------
+std::string cmCPackIFWGenerator::GetComponentPackageName(
+  cmCPackComponent *component) const
+{
+  std::string name;
+  if (!component) return name;
+  if (cmCPackIFWPackage* package = GetComponentPackage(component))
+    {
+    return package->Name;
+    }
+  std::string prefix = "CPACK_IFW_COMPONENT_"
+    + cmsys::SystemTools::UpperCase(component->Name)
+    + "_";
+  const char* option = GetOption(prefix + "NAME");
+  name = option ? option : component->Name;
+  if(component->Group)
+    {
+    cmCPackIFWPackage* package = GetGroupPackage(component->Group);
+    if((componentPackageMethod == ONE_PACKAGE_PER_GROUP)
+       || IsOn(prefix + "COMMON"))
+      {
+      return package->Name;
+      }
+    bool dot = !ResolveDuplicateNames;
+    if(dot && name.substr(0, package->Name.size()) == package->Name)
+      {
+      dot = false;
+      }
+    if(dot)
+      {
+      name = package->Name + "." + name;
+      }
+    }
+  return name;
+}
+
+//----------------------------------------------------------------------------
+cmCPackIFWPackage* cmCPackIFWGenerator::GetGroupPackage(
+  cmCPackComponentGroup *group) const
+{
+  std::map<cmCPackComponentGroup*, cmCPackIFWPackage*>::const_iterator pit
+    = GroupPackages.find(group);
+  return pit != GroupPackages.end() ? pit->second : 0;
+}
+
+//----------------------------------------------------------------------------
+cmCPackIFWPackage* cmCPackIFWGenerator::GetComponentPackage(
+  cmCPackComponent *component) const
+{
+  std::map<cmCPackComponent*, cmCPackIFWPackage*>::const_iterator pit
+    = ComponentPackages.find(component);
+  return pit != ComponentPackages.end() ? pit->second : 0;
+}
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.h b/Source/CPack/IFW/cmCPackIFWGenerator.h
new file mode 100644
index 0000000..1d4d67b
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.h
@@ -0,0 +1,135 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackIFWGenerator_h
+#define cmCPackIFWGenerator_h
+
+#include <CPack/cmCPackGenerator.h>
+
+#include "cmCPackIFWPackage.h"
+#include "cmCPackIFWInstaller.h"
+
+/** \class cmCPackIFWGenerator
+ * \brief A generator for Qt Installer Framework tools
+ *
+ * http://qt-project.org/doc/qtinstallerframework/index.html
+ */
+class cmCPackIFWGenerator : public cmCPackGenerator
+{
+public:
+  cmCPackTypeMacro(cmCPackIFWGenerator, cmCPackGenerator);
+
+  typedef std::map<std::string, cmCPackIFWPackage> PackagesMap;
+  typedef std::map<std::string, cmCPackComponent> ComponentsMap;
+  typedef std::map<std::string, cmCPackComponentGroup> ComponentGoupsMap;
+  typedef std::map<std::string, cmCPackIFWPackage::DependenceStruct>
+    DependenceMap;
+
+  /**
+   * Construct IFW generator
+   */
+  cmCPackIFWGenerator();
+
+  /**
+   * Destruct IFW generator
+   */
+  virtual ~cmCPackIFWGenerator();
+
+protected: // cmCPackGenerator reimplementation
+
+  /**
+   * @brief Initialize generator
+   * @return 0 on failure
+   */
+  virtual int InitializeInternal();
+  virtual int PackageFiles();
+  virtual const char* GetPackagingInstallPrefix();
+
+  /**
+   * @brief Extension of binary installer
+   * @return Executable suffix or value from default implementation
+   */
+  virtual const char* GetOutputExtension();
+
+  virtual std::string GetComponentInstallDirNameSuffix(
+    const std::string& componentName);
+
+  /**
+   * @brief Get Component
+   * @param projectName Project name
+   * @param componentName Component name
+   *
+   * This method calls the base implementation.
+   *
+   * @return Pointer to component
+   */
+  virtual cmCPackComponent* GetComponent(
+    const std::string& projectName,
+    const std::string& componentName);
+
+  /**
+   * @brief Get group of component
+   * @param projectName Project name
+   * @param groupName Component group name
+   *
+   * This method calls the base implementation.
+   *
+   * @return Pointer to component group
+   */
+  virtual cmCPackComponentGroup* GetComponentGroup(
+    const std::string& projectName,
+    const std::string& groupName);
+
+  enum cmCPackGenerator::CPackSetDestdirSupport SupportsSetDestdir() const;
+  virtual bool SupportsAbsoluteDestination() const;
+  virtual bool SupportsComponentInstallation() const;
+
+protected: // Methods
+
+  bool IsOnePackage() const;
+
+  std::string GetRootPackageName();
+
+  std::string GetGroupPackageName(cmCPackComponentGroup *group) const;
+  std::string GetComponentPackageName(cmCPackComponent *component) const;
+
+  cmCPackIFWPackage* GetGroupPackage(cmCPackComponentGroup *group) const;
+  cmCPackIFWPackage* GetComponentPackage(cmCPackComponent *component) const;
+
+protected: // Data
+
+  friend class cmCPackIFWPackage;
+  friend class cmCPackIFWInstaller;
+
+  // Installer
+  cmCPackIFWInstaller Installer;
+  // Collection of packages
+  PackagesMap Packages;
+  // Collection of binary packages
+  std::set<cmCPackIFWPackage*> BinaryPackages;
+  // Collection of downloaded packages
+  std::set<cmCPackIFWPackage*> DownloadedPackages;
+  // Dependent packages
+  DependenceMap DependentPackages;
+  std::map<cmCPackComponent*, cmCPackIFWPackage*> ComponentPackages;
+  std::map<cmCPackComponentGroup*, cmCPackIFWPackage*> GroupPackages;
+
+private:
+  std::string RepoGen;
+  std::string BinCreator;
+
+  bool OnlineOnly;
+  bool ResolveDuplicateNames;
+  std::vector<std::string> PkgsDirsVector;
+};
+
+#endif
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.cxx b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
new file mode 100644
index 0000000..0644ecb
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.cxx
@@ -0,0 +1,406 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmCPackIFWInstaller.h"
+
+#include "cmCPackIFWGenerator.h"
+
+#include <CPack/cmCPackLog.h>
+
+#include <cmGeneratedFileStream.h>
+#include <cmXMLSafe.h>
+
+#ifdef cmCPackLogger
+# undef cmCPackLogger
+#endif
+#define cmCPackLogger(logType, msg)                                     \
+  do {                                                                  \
+  cmOStringStream cmCPackLog_msg;                                       \
+  cmCPackLog_msg << msg;                                                \
+  if(Generator) {                                                       \
+  Generator->Logger->Log(logType, __FILE__, __LINE__,                   \
+                         cmCPackLog_msg.str().c_str());                 \
+  }                                                                     \
+  } while ( 0 )
+
+//----------------------------------------------------------------------------
+cmCPackIFWInstaller::cmCPackIFWInstaller() :
+  Generator(0)
+{
+}
+
+//----------------------------------------------------------------------------
+const char *cmCPackIFWInstaller::GetOption(const std::string &op) const
+{
+  return Generator ? Generator->GetOption(op) : 0;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWInstaller::IsOn(const std::string &op) const
+{
+  return Generator ? Generator->IsOn(op) : false;
+}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWInstaller::ConfigureFromOptions()
+{
+  // Name;
+  if (const char* optIFW_PACKAGE_NAME =
+      this->GetOption("CPACK_IFW_PACKAGE_NAME"))
+    {
+    Name = optIFW_PACKAGE_NAME;
+    }
+  else if (const char* optPACKAGE_NAME =
+           this->GetOption("CPACK_PACKAGE_NAME"))
+    {
+    Name = optPACKAGE_NAME;
+    }
+  else
+    {
+    Name = "Your package";
+    }
+
+  // Title;
+  if (const char* optIFW_PACKAGE_TITLE =
+      GetOption("CPACK_IFW_PACKAGE_TITLE"))
+    {
+    Title = optIFW_PACKAGE_TITLE;
+    }
+  else if (const char* optPACKAGE_DESCRIPTION_SUMMARY =
+           GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"))
+    {
+    Title = optPACKAGE_DESCRIPTION_SUMMARY;
+    }
+  else
+    {
+    Title = "Your package description";
+    }
+
+  // Version;
+  if (const char* option = GetOption("CPACK_PACKAGE_VERSION"))
+    {
+    Version = option;
+    }
+  else
+    {
+    Version = "1.0.0";
+    }
+
+  // Publisher
+  if(const char* optIFW_PACKAGE_PUBLISHER =
+     GetOption("CPACK_IFW_PACKAGE_PUBLISHER"))
+    {
+    Publisher = optIFW_PACKAGE_PUBLISHER;
+    }
+  else if(const char* optPACKAGE_VENDOR = GetOption("CPACK_PACKAGE_VENDOR"))
+    {
+    Publisher = optPACKAGE_VENDOR;
+    }
+
+  // ProductUrl
+  if(const char* option = GetOption("CPACK_IFW_PRODUCT_URL"))
+    {
+    ProductUrl = option;
+    }
+
+  // ApplicationIcon
+  if(const char* option = GetOption("CPACK_IFW_PACKAGE_ICON"))
+    {
+    if(cmSystemTools::FileExists(option))
+      {
+      InstallerApplicationIcon = option;
+      }
+    else
+      {
+      // TODO: implement warning
+      }
+    }
+
+  // WindowIcon
+  if(const char* option = GetOption("CPACK_IFW_PACKAGE_WINDOW_ICON"))
+    {
+    if(cmSystemTools::FileExists(option))
+      {
+      InstallerWindowIcon = option;
+      }
+    else
+      {
+      // TODO: implement warning
+      }
+    }
+
+  // Logo
+  if(const char* option = GetOption("CPACK_IFW_PACKAGE_LOGO"))
+    {
+    if(cmSystemTools::FileExists(option))
+      {
+      Logo = option;
+      }
+    else
+      {
+      // TODO: implement warning
+      }
+    }
+
+  // Default target directory for installation
+  if (const char* optIFW_TARGET_DIRECTORY =
+      GetOption("CPACK_IFW_TARGET_DIRECTORY"))
+    {
+    TargetDir = optIFW_TARGET_DIRECTORY;
+    }
+  else if (const char *optPACKAGE_INSTALL_DIRECTORY =
+           GetOption("CPACK_PACKAGE_INSTALL_DIRECTORY"))
+    {
+    TargetDir = "@ApplicationsDir@/";
+    TargetDir += optPACKAGE_INSTALL_DIRECTORY;
+    }
+  else
+    {
+    TargetDir = "@RootDir@/usr/local";
+    }
+
+  // Default target directory for installation with administrator rights
+  if (const char* option = GetOption("CPACK_IFW_ADMIN_TARGET_DIRECTORY"))
+    {
+    AdminTargetDir = option;
+    }
+
+  // Repositories
+  Repositories.clear();
+  RepositoryStruct Repo;
+  if (const char *site = this->GetOption("CPACK_DOWNLOAD_SITE"))
+    {
+    Repo.Url = site;
+    Repositories.push_back(Repo);
+    }
+  if(const char *RepoAllStr = this->GetOption("CPACK_IFW_REPOSITORIES_ALL"))
+    {
+    std::vector<std::string> RepoAllVector;
+    cmSystemTools::ExpandListArgument(RepoAllStr,
+                                      RepoAllVector);
+    for(std::vector<std::string>::iterator
+          rit = RepoAllVector.begin(); rit != RepoAllVector.end(); ++rit)
+      {
+        std::string prefix = "CPACK_IFW_REPOSITORY_"
+          + cmsys::SystemTools::UpperCase(*rit)
+          + "_";
+        // Url
+        if (const char* url = GetOption(prefix + "URL"))
+          {
+          Repo.Url = url;
+          }
+        else
+          {
+          Repo.Url = "";
+          }
+        // Enabled
+        if (IsOn(prefix + "DISABLED"))
+          {
+          Repo.Enabled = "0";
+          }
+        else
+          {
+          Repo.Enabled = "";
+          }
+        // Username
+        if (const char* username = GetOption(prefix + "USERNAME"))
+          {
+          Repo.Username = username;
+          }
+        else
+          {
+          Repo.Username = "";
+          }
+        // Password
+        if (const char* password = GetOption(prefix + "PASSWORD"))
+          {
+          Repo.Password = password;
+          }
+        else
+          {
+          Repo.Password = "";
+          }
+        // DisplayName
+        if (const char* displayName = GetOption(prefix + "DISPLAY_NAME"))
+          {
+          Repo.DisplayName = displayName;
+          }
+        else
+          {
+          Repo.DisplayName = "";
+          }
+
+        if(!Repo.Url.empty())
+          {
+          Repositories.push_back(Repo);
+          }
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWInstaller::GenerateInstallerFile()
+{
+  // Lazy directory initialization
+  if(Directory.empty() && Generator)
+    {
+    Directory = Generator->toplevel;
+    }
+
+  // Output stream
+  cmGeneratedFileStream xout((Directory + "/config/config.xml").data());
+
+  xout << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+  xout << "<Installer>" << std::endl;
+
+  xout << "    <Name>" << cmXMLSafe(Name).str() << "</Name>" << std::endl;
+
+  xout << "    <Version>" << Version << "</Version>" << std::endl;
+
+  xout << "    <Title>" << cmXMLSafe(Title).str() << "</Title>"
+       << std::endl;
+
+  if(!Publisher.empty())
+    {
+    xout << "    <Publisher>" << cmXMLSafe(Publisher).str()
+         << "</Publisher>" << std::endl;
+    }
+
+  if(!ProductUrl.empty())
+    {
+    xout << "    <ProductUrl>" << ProductUrl << "</ProductUrl>" << std::endl;
+    }
+
+  // ApplicationIcon
+  if(!InstallerApplicationIcon.empty())
+    {
+    std::string name =
+      cmSystemTools::GetFilenameName(InstallerApplicationIcon);
+    std::string path = Directory + "/config/" + name;
+    name = cmSystemTools::GetFilenameWithoutExtension(name);
+    cmsys::SystemTools::CopyFileIfDifferent(
+      InstallerApplicationIcon.data(), path.data());
+    xout << "    <InstallerApplicationIcon>" << name
+         << "</InstallerApplicationIcon>" << std::endl;
+    }
+
+  // WindowIcon
+  if(!InstallerWindowIcon.empty())
+    {
+    std::string name = cmSystemTools::GetFilenameName(InstallerWindowIcon);
+    std::string path = Directory + "/config/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(
+      InstallerWindowIcon.data(), path.data());
+    xout << "    <InstallerWindowIcon>" << name
+         << "</InstallerWindowIcon>" << std::endl;
+    }
+
+  // Logo
+  if(!Logo.empty())
+    {
+    std::string name = cmSystemTools::GetFilenameName(Logo);
+    std::string path = Directory + "/config/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(Logo.data(), path.data());
+    xout << "    <Logo>" << name << "</Logo>" << std::endl;
+    }
+
+  if(!TargetDir.empty())
+    {
+    xout << "    <TargetDir>" << TargetDir << "</TargetDir>" << std::endl;
+    }
+
+  if(!AdminTargetDir.empty())
+    {
+    xout << "    <AdminTargetDir>" << AdminTargetDir
+         << "</AdminTargetDir>" << std::endl;
+    }
+
+  // Remote repositories
+  if (!Repositories.empty())
+    {
+    xout << "    <RemoteRepositories>" << std::endl;
+    for(std::vector<RepositoryStruct>::iterator
+        rit = Repositories.begin(); rit != Repositories.end(); ++rit)
+      {
+      xout << "        <Repository>" << std::endl;
+      // Url
+      xout << "            <Url>" << rit->Url
+           << "</Url>" << std::endl;
+      // Enabled
+      if(!rit->Enabled.empty())
+        {
+        xout << "            <Enabled>" << rit->Enabled
+             << "</Enabled>" << std::endl;
+        }
+      // Username
+      if(!rit->Username.empty())
+        {
+        xout << "            <Username>" << rit->Username
+             << "</Username>" << std::endl;
+        }
+      // Password
+      if(!rit->Password.empty())
+        {
+        xout << "            <Password>" << rit->Password
+             << "</Password>" << std::endl;
+        }
+      // DisplayName
+      if(!rit->DisplayName.empty())
+        {
+        xout << "            <DisplayName>" << rit->DisplayName
+             << "</DisplayName>" << std::endl;
+        }
+      xout << "        </Repository>" << std::endl;
+      }
+    xout << "    </RemoteRepositories>" << std::endl;
+    }
+
+  // CPack IFW default policy
+  xout << "    <!-- CPack IFW default policy -->" << std::endl;
+  xout << "    <AllowNonAsciiCharacters>true</AllowNonAsciiCharacters>"
+       << std::endl;
+  xout << "    <AllowSpaceInPath>true</AllowSpaceInPath>" << std::endl;
+
+  xout << "</Installer>" << std::endl;
+}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWInstaller::GeneratePackageFiles()
+{
+  if (Packages.empty() || Generator->IsOnePackage())
+    {
+    // Generate default package
+    cmCPackIFWPackage package;
+    package.Generator = Generator;
+    package.Installer = this;
+    // Check package group
+    if (const char* option = GetOption("CPACK_IFW_PACKAGE_GROUP"))
+      {
+      package.ConfigureFromGroup(option);
+      package.ForcedInstallation = "true";
+      }
+    else
+      {
+      package.ConfigureFromOptions();
+      }
+    package.GeneratePackageFile();
+    return;
+    }
+
+  // Generate packages meta information
+  for(PackagesMap::iterator pit = Packages.begin();
+      pit != Packages.end(); ++pit)
+    {
+    cmCPackIFWPackage* package = pit->second;
+    package->GeneratePackageFile();
+    }
+}
diff --git a/Source/CPack/IFW/cmCPackIFWInstaller.h b/Source/CPack/IFW/cmCPackIFWInstaller.h
new file mode 100644
index 0000000..5824d33
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWInstaller.h
@@ -0,0 +1,95 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackIFWInstaller_h
+#define cmCPackIFWInstaller_h
+
+#include <cmStandardIncludes.h>
+
+class cmCPackIFWPackage;
+class cmCPackIFWGenerator;
+
+/** \class cmCPackIFWInstaller
+ * \brief A binary installer to be created CPack IFW generator
+ */
+class cmCPackIFWInstaller
+{
+public: // Types
+
+  typedef std::map<std::string, cmCPackIFWPackage*> PackagesMap;
+
+  struct RepositoryStruct
+  {
+    std::string Url;
+    std::string Enabled;
+    std::string Username;
+    std::string Password;
+    std::string DisplayName;
+  };
+
+public: // Constructor
+
+  /**
+   * Construct installer
+   */
+  cmCPackIFWInstaller();
+
+public: // Configuration
+
+  /// Name of the product being installed
+  std::string Name;
+
+  /// Version number of the product being installed
+  std::string Version;
+
+  /// Name of the installer as displayed on the title bar
+  std::string Title;
+
+  /// Publisher of the software (as shown in the Windows Control Panel)
+  std::string Publisher;
+
+  /// URL to a page that contains product information on your web site
+  std::string ProductUrl;
+
+  /// Filename for a custom installer icon
+  std::string InstallerApplicationIcon;
+
+  /// Filename for a custom window icon
+  std::string InstallerWindowIcon;
+
+  /// Filename for a logo
+  std::string Logo;
+
+  /// Default target directory for installation
+  std::string TargetDir;
+
+  /// Default target directory for installation with administrator rights
+  std::string AdminTargetDir;
+
+public: // Internal implementation
+
+  const char* GetOption(const std::string& op) const;
+  bool IsOn(const std::string& op) const;
+
+  void ConfigureFromOptions();
+
+  void GenerateInstallerFile();
+
+  void GeneratePackageFiles();
+
+  cmCPackIFWGenerator* Generator;
+  PackagesMap Packages;
+  std::vector<RepositoryStruct> Repositories;
+  std::string Directory;
+};
+
+#endif // cmCPackIFWInstaller_h
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.cxx b/Source/CPack/IFW/cmCPackIFWPackage.cxx
new file mode 100644
index 0000000..3c45639
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWPackage.cxx
@@ -0,0 +1,540 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmCPackIFWPackage.h"
+
+#include "cmCPackIFWGenerator.h"
+
+#include <CPack/cmCPackLog.h>
+
+#include <cmGeneratedFileStream.h>
+#include <cmTimestamp.h>
+
+//----------------------------------------------------------------- Logger ---
+#ifdef cmCPackLogger
+# undef cmCPackLogger
+#endif
+#define cmCPackLogger(logType, msg)                                     \
+  do {                                                                  \
+  cmOStringStream cmCPackLog_msg;                                       \
+  cmCPackLog_msg << msg;                                                \
+  if(Generator) {                                                       \
+  Generator->Logger->Log(logType, __FILE__, __LINE__,                   \
+                         cmCPackLog_msg.str().c_str());                 \
+  }                                                                     \
+  } while ( 0 )
+
+//---------------------------------------------------------- CompareStruct ---
+cmCPackIFWPackage::CompareStruct::CompareStruct() :
+  Type(CompareNone)
+{
+}
+
+//------------------------------------------------------- DependenceStruct ---
+cmCPackIFWPackage::DependenceStruct::DependenceStruct()
+{
+}
+
+//----------------------------------------------------------------------------
+cmCPackIFWPackage::DependenceStruct::DependenceStruct(
+  const std::string &dependence)
+{
+  // Search compare section
+  size_t pos = std::string::npos;
+  if((pos = dependence.find("<=")) != std::string::npos)
+    {
+    Compare.Type = CompareLessOrEqual;
+    Compare.Value = dependence.substr(pos + 2);
+    }
+  else if((pos = dependence.find(">=")) != std::string::npos)
+    {
+    Compare.Type = CompareGreaterOrEqual;
+    Compare.Value = dependence.substr(pos + 2);
+    }
+  else if((pos = dependence.find("<")) != std::string::npos)
+    {
+    Compare.Type = CompareLess;
+    Compare.Value = dependence.substr(pos + 1);
+    }
+  else if((pos = dependence.find("=")) != std::string::npos)
+    {
+    Compare.Type = CompareEqual;
+    Compare.Value = dependence.substr(pos + 1);
+    }
+  else if((pos = dependence.find(">")) != std::string::npos)
+    {
+    Compare.Type = CompareGreater;
+    Compare.Value = dependence.substr(pos + 1);
+    }
+  Name = pos == std::string::npos ? dependence : dependence.substr(0, pos);
+}
+
+//----------------------------------------------------------------------------
+std::string cmCPackIFWPackage::DependenceStruct::NameWithCompare() const
+{
+  if (Compare.Type == CompareNone) return Name;
+
+  std::string result = Name;
+
+  if (Compare.Type == CompareLessOrEqual)
+    {
+    result += "<=";
+    }
+  else if (Compare.Type == CompareGreaterOrEqual)
+    {
+    result += ">=";
+    }
+  else if (Compare.Type == CompareLess)
+    {
+    result += "<";
+    }
+  else if (Compare.Type == CompareEqual)
+    {
+    result += "=";
+    }
+  else if (Compare.Type == CompareGreater)
+    {
+    result += ">";
+    }
+
+  result += Compare.Value;
+
+  return result;
+}
+
+//------------------------------------------------------ cmCPackIFWPackage ---
+cmCPackIFWPackage::cmCPackIFWPackage() :
+  Generator(0),
+  Installer(0)
+{
+}
+
+//----------------------------------------------------------------------------
+const char *cmCPackIFWPackage::GetOption(const std::string &op) const
+{
+  const char *option = Generator ? Generator->GetOption(op) : 0;
+  return option && *option ? option : 0;
+}
+
+//----------------------------------------------------------------------------
+bool cmCPackIFWPackage::IsOn(const std::string &op) const
+{
+  return Generator ? Generator->IsOn(op) : false;
+}
+
+//----------------------------------------------------------------------------
+std::string cmCPackIFWPackage::GetComponentName(cmCPackComponent *component)
+{
+  if (!component) return "";
+  const char* option = GetOption(
+    "CPACK_IFW_COMPONENT_"
+    + cmsys::SystemTools::UpperCase(component->Name)
+    + "_NAME");
+  return option ? option : component->Name;
+}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWPackage::DefaultConfiguration()
+{
+  DisplayName = "";
+  Description = "";
+  Version = "";
+  ReleaseDate = "";
+  Script = "";
+  Licenses.clear();
+  SortingPriority = "";
+  Default = "";
+  Virtual = "";
+  ForcedInstallation = "";
+}
+
+//----------------------------------------------------------------------------
+// Defaul configuration (all in one package)
+int cmCPackIFWPackage::ConfigureFromOptions()
+{
+  // Restore defaul configuration
+  DefaultConfiguration();
+
+  // Name
+  Name = Generator->GetRootPackageName();
+
+  // Display name
+  if (const char *option = this->GetOption("CPACK_PACKAGE_NAME"))
+    {
+    DisplayName = option;
+    }
+  else
+    {
+    DisplayName = "Your package";
+    }
+
+  // Description
+  if (const char* option =
+      this->GetOption("CPACK_PACKAGE_DESCRIPTION_SUMMARY"))
+    {
+    Description = option;
+    }
+  else
+    {
+    Description = "Your package description";
+    }
+
+  // Version
+  if(const char* option = GetOption("CPACK_PACKAGE_VERSION"))
+    {
+    Version = option;
+    }
+  else
+    {
+    Version = "1.0.0";
+    }
+
+  ForcedInstallation = "true";
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+int cmCPackIFWPackage::ConfigureFromComponent(cmCPackComponent *component)
+{
+  if(!component) return 0;
+
+  // Restore defaul configuration
+  DefaultConfiguration();
+
+  std::string prefix = "CPACK_IFW_COMPONENT_"
+    + cmsys::SystemTools::UpperCase(component->Name)
+    + "_";
+
+  // Display name
+  DisplayName = component->DisplayName;
+
+  // Description
+  Description = component->Description;
+
+  // Version
+  if(const char* optVERSION = GetOption(prefix + "VERSION"))
+    {
+    Version = optVERSION;
+    }
+  else if(const char* optPACKAGE_VERSION =
+          GetOption("CPACK_PACKAGE_VERSION"))
+    {
+    Version = optPACKAGE_VERSION;
+    }
+  else
+    {
+    Version = "1.0.0";
+    }
+
+  // Script
+  if (const char* option = GetOption(prefix + "SCRIPT"))
+    {
+    Script = option;
+    }
+
+  // CMake dependencies
+  if (!component->Dependencies.empty())
+    {
+    std::vector<cmCPackComponent*>::iterator dit;
+    for(dit = component->Dependencies.begin();
+        dit != component->Dependencies.end();
+        ++dit)
+      {
+      Dependencies.insert(Generator->ComponentPackages[*dit]);
+      }
+    }
+
+  // QtIFW dependencies
+  if(const char* option = this->GetOption(prefix + "DEPENDS"))
+    {
+    std::vector<std::string> deps;
+    cmSystemTools::ExpandListArgument(option,
+                                      deps);
+    for(std::vector<std::string>::iterator
+          dit = deps.begin(); dit != deps.end(); ++dit)
+      {
+      DependenceStruct dep(*dit);
+      if (!Generator->Packages.count(dep.Name))
+        {
+        bool hasDep = Generator->DependentPackages.count(dep.Name) > 0;
+        DependenceStruct &depRef =
+          Generator->DependentPackages[dep.Name];
+        if(!hasDep)
+          {
+          depRef = dep;
+          }
+        AlienDependencies.insert(&depRef);
+        }
+      }
+    }
+
+  // Licenses
+  if (const char* option = this->GetOption(prefix + "LICENSES"))
+    {
+    Licenses.clear();
+    cmSystemTools::ExpandListArgument( option, Licenses );
+    if ( Licenses.size() % 2 != 0 )
+      {
+      cmCPackLogger(cmCPackLog::LOG_WARNING, prefix << "LICENSES"
+        << " should contain pairs of <display_name> and <file_path>."
+        << std::endl);
+      Licenses.clear();
+      }
+    }
+
+  // Priority
+  if(const char* option = this->GetOption(prefix + "PRIORITY"))
+    {
+    SortingPriority = option;
+    }
+
+  // Default
+  Default = component->IsDisabledByDefault ? "false" : "true";
+
+  // Virtual
+  Virtual = component->IsHidden ? "true" : "";
+
+  // ForcedInstallation
+  ForcedInstallation = component->IsRequired ? "true" : "false";
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+int
+cmCPackIFWPackage::ConfigureFromGroup(cmCPackComponentGroup *group)
+{
+  if(!group) return 0;
+
+  // Restore defaul configuration
+  DefaultConfiguration();
+
+  std::string prefix = "CPACK_IFW_COMPONENT_GROUP_"
+    + cmsys::SystemTools::UpperCase(group->Name)
+    + "_";
+
+  DisplayName = group->DisplayName;
+  Description = group->Description;
+
+  // Version
+  if(const char* optVERSION = GetOption(prefix + "VERSION"))
+    {
+    Version = optVERSION;
+    }
+  else if(const char* optPACKAGE_VERSION =
+          GetOption("CPACK_PACKAGE_VERSION"))
+    {
+    Version = optPACKAGE_VERSION;
+    }
+  else
+    {
+    Version = "1.0.0";
+    }
+
+  // Script
+  if (const char* option = GetOption(prefix + "SCRIPT"))
+    {
+    Script = option;
+    }
+
+  // Licenses
+  if (const char* option = this->GetOption(prefix + "LICENSES"))
+    {
+    Licenses.clear();
+    cmSystemTools::ExpandListArgument( option, Licenses );
+    if ( Licenses.size() % 2 != 0 )
+      {
+      cmCPackLogger(cmCPackLog::LOG_WARNING, prefix << "LICENSES"
+        << " should contain pairs of <display_name> and <file_path>."
+        << std::endl);
+      Licenses.clear();
+      }
+    }
+
+  // Priority
+  if(const char* option = this->GetOption(prefix + "PRIORITY"))
+    {
+    SortingPriority = option;
+    }
+
+  return 1;
+}
+
+//----------------------------------------------------------------------------
+int cmCPackIFWPackage::ConfigureFromGroup(const std::string &groupName)
+{
+  // Group configuration
+
+  cmCPackComponentGroup group;
+  std::string prefix = "CPACK_COMPONENT_GROUP_"
+      + cmsys::SystemTools::UpperCase(groupName)
+      + "_";
+
+  if (const char *option = GetOption(prefix + "DISPLAY_NAME"))
+    {
+    group.DisplayName = option;
+    }
+  else
+    {
+    group.DisplayName = group.Name;
+    }
+
+  if (const char* option = GetOption(prefix + "DESCRIPTION"))
+    {
+    group.Description = option;
+    }
+  group.IsBold = IsOn(prefix + "BOLD_TITLE");
+  group.IsExpandedByDefault = IsOn(prefix + "EXPANDED");
+
+  // Package configuration
+
+  group.Name = groupName;
+
+  if(Generator)
+    {
+    Name = Generator->GetGroupPackageName(&group);
+    }
+  else
+    {
+    Name = group.Name;
+    }
+
+  return ConfigureFromGroup(&group);
+}
+
+//----------------------------------------------------------------------------
+void cmCPackIFWPackage::GeneratePackageFile()
+{
+  // Lazy directory initialization
+  if (Directory.empty())
+    {
+    if(Installer)
+      {
+      Directory = Installer->Directory + "/packages/" + Name;
+      }
+    else if (Generator)
+      {
+      Directory = Generator->toplevel + "/packages/" + Name;
+      }
+    }
+
+  // Output stream
+  cmGeneratedFileStream xout((Directory + "/meta/package.xml").data());
+
+  xout << "<?xml version=\"1.0\"?>" << std::endl;
+  xout << "<Package>" << std::endl;
+
+  xout << "    <DisplayName>" << DisplayName
+       << "</DisplayName>" << std::endl;
+
+  xout << "    <Description>" << Description
+       << "</Description>" << std::endl;
+
+  xout << "    <Name>" << Name << "</Name>" << std::endl;
+
+  xout << "    <Version>" <<  Version
+       << "</Version>" << std::endl;
+
+  xout << "    <ReleaseDate>";
+  if(ReleaseDate.empty())
+    {
+    xout << cmTimestamp().CurrentTime("%Y-%m-%d", true);
+    }
+  else
+    {
+    xout << ReleaseDate;
+    }
+  xout << "</ReleaseDate>" << std::endl;
+
+  // Script (copy to meta dir)
+  if(!Script.empty())
+    {
+    std::string name = cmSystemTools::GetFilenameName(Script);
+    std::string path = Directory + "/meta/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(Script.data(), path.data());
+    xout << "    <Script>" << name << "</Script>" << std::endl;
+    }
+
+  // Dependencies
+  std::set<DependenceStruct> compDepSet;
+  for(std::set<DependenceStruct*>::iterator ait = AlienDependencies.begin();
+      ait != AlienDependencies.end(); ++ait)
+    {
+    compDepSet.insert(*(*ait));
+    }
+  for(std::set<cmCPackIFWPackage*>::iterator it = Dependencies.begin();
+      it != Dependencies.end(); ++it)
+    {
+    compDepSet.insert(DependenceStruct((*it)->Name));
+    }
+  // Write dependencies
+  if  (!compDepSet.empty())
+    {
+    xout << "    <Dependencies>";
+    std::set<DependenceStruct>::iterator it = compDepSet.begin();
+    xout << it->NameWithCompare();
+    ++it;
+    while(it != compDepSet.end())
+      {
+      xout << "," << it->NameWithCompare();
+      ++it;
+      }
+    xout << "</Dependencies>" << std::endl;
+    }
+
+  // Licenses (copy to meta dir)
+  std::vector<std::string> licenses = Licenses;
+  for(size_t i = 1; i < licenses.size(); i += 2)
+    {
+    std::string name = cmSystemTools::GetFilenameName(licenses[i]);
+    std::string path = Directory + "/meta/" + name;
+    cmsys::SystemTools::CopyFileIfDifferent(licenses[i].data(), path.data());
+    licenses[i] = name;
+    }
+  if(!licenses.empty())
+    {
+    xout << "    <Licenses>" << std::endl;
+    for(size_t i = 0; i < licenses.size(); i += 2)
+      {
+      xout << "        <License "
+           << "name=\"" << licenses[i] << "\" "
+           << "file=\"" << licenses[i + 1] << "\" "
+           << "/>" <<std::endl;
+      }
+    xout << "    </Licenses>" << std::endl;
+    }
+
+  if (!ForcedInstallation.empty())
+    {
+    xout << "    <ForcedInstallation>" << ForcedInstallation
+         << "</ForcedInstallation>" << std::endl;
+    }
+
+  if (!Virtual.empty())
+    {
+    xout << "    <Virtual>" << Virtual << "</Virtual>" << std::endl;
+    }
+  else if (!Default.empty())
+    {
+    xout << "    <Default>" << Default << "</Default>" << std::endl;
+    }
+
+  // Priority
+  if(!SortingPriority.empty())
+    {
+    xout << "    <SortingPriority>" << SortingPriority
+         << "</SortingPriority>" << std::endl;
+    }
+
+  xout << "</Package>" << std::endl;
+}
diff --git a/Source/CPack/IFW/cmCPackIFWPackage.h b/Source/CPack/IFW/cmCPackIFWPackage.h
new file mode 100644
index 0000000..9fc9bd0
--- /dev/null
+++ b/Source/CPack/IFW/cmCPackIFWPackage.h
@@ -0,0 +1,133 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackIFWPackage_h
+#define cmCPackIFWPackage_h
+
+#include <cmStandardIncludes.h>
+
+class cmCPackComponent;
+class cmCPackComponentGroup;
+class cmCPackIFWInstaller;
+class cmCPackIFWGenerator;
+
+/** \class cmCPackIFWPackage
+ * \brief A single component to be installed by CPack IFW generator
+ */
+class cmCPackIFWPackage
+{
+public: // Types
+  enum CompareTypes
+  {
+    CompareNone           = 0x0,
+    CompareEqual          = 0x1,
+    CompareLess           = 0x2,
+    CompareLessOrEqual    = 0x3,
+    CompareGreater        = 0x4,
+    CompareGreaterOrEqual = 0x5
+  };
+
+  struct CompareStruct
+  {
+    CompareStruct();
+
+    unsigned int Type;
+    std::string Value;
+  };
+
+  struct DependenceStruct
+  {
+    DependenceStruct();
+    DependenceStruct(const std::string &dependence);
+
+    std::string Name;
+    CompareStruct Compare;
+
+    std::string NameWithCompare() const;
+
+    bool operator < (const DependenceStruct &other) const
+      {
+      return Name < other.Name;
+      }
+  };
+
+public: // [Con|De]structor
+
+  /**
+   * Construct package
+   */
+  cmCPackIFWPackage();
+
+public: // Configuration
+
+  /// Human-readable name of the component
+  std::string DisplayName;
+
+  /// Human-readable description of the component
+  std::string Description;
+
+  /// Version number of the component
+  std::string Version;
+
+  /// Date when this component version was released
+  std::string ReleaseDate;
+
+  /// Domain-like identification for this component
+  std::string Name;
+
+  /// File name of a script being loaded
+  std::string Script;
+
+  /// List of license agreements to be accepted by the installing user
+  std::vector<std::string> Licenses;
+
+  /// Priority of the component in the tree
+  std::string SortingPriority;
+
+  /// Set to true to preselect the component in the installer
+  std::string Default;
+
+  /// Set to true to hide the component from the installer
+  std::string Virtual;
+
+  /// Determines that the package must always be installed
+  std::string ForcedInstallation;
+
+public: // Internal implementation
+
+  const char* GetOption(const std::string& op) const;
+  bool IsOn(const std::string& op) const;
+
+  std::string GetComponentName(cmCPackComponent *component);
+
+  void DefaultConfiguration();
+
+  int ConfigureFromOptions();
+  int ConfigureFromComponent(cmCPackComponent *component);
+  int ConfigureFromGroup(cmCPackComponentGroup *group);
+  int ConfigureFromGroup(const std::string &groupName);
+
+  void GeneratePackageFile();
+
+  // Pointer to generator
+  cmCPackIFWGenerator* Generator;
+  // Pointer to installer
+  cmCPackIFWInstaller* Installer;
+  // Collection of dependencies
+  std::set<cmCPackIFWPackage*> Dependencies;
+  // Collection of unresolved dependencies
+  std::set<DependenceStruct*> AlienDependencies;
+  // Patch to package directory
+  std::string Directory;
+};
+
+#endif // cmCPackIFWPackage_h
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index a2995d1..7e00027 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -360,6 +360,29 @@
       includeFile.EndElement("Property");
       }
     }
+
+  if(GetOption("CPACK_WIX_PROPERTY_ARPINSTALLLOCATION") == 0)
+    {
+    includeFile.BeginElement("Property");
+    includeFile.AddAttribute("Id", "INSTALL_ROOT");
+    includeFile.AddAttribute("Secure", "yes");
+
+    includeFile.BeginElement("RegistrySearch");
+    includeFile.AddAttribute("Id", "FindInstallLocation");
+    includeFile.AddAttribute("Root", "HKLM");
+    includeFile.AddAttribute("Key", "Software\\Microsoft\\Windows\\"
+      "CurrentVersion\\Uninstall\\[WIX_UPGRADE_DETECTED]");
+    includeFile.AddAttribute("Name", "InstallLocation");
+    includeFile.AddAttribute("Type", "raw");
+    includeFile.EndElement("RegistrySearch");
+    includeFile.EndElement("Property");
+
+    includeFile.BeginElement("SetProperty");
+    includeFile.AddAttribute("Id", "ARPINSTALLLOCATION");
+    includeFile.AddAttribute("Value", "[INSTALL_ROOT]");
+    includeFile.AddAttribute("After", "CostFinalize");
+    includeFile.EndElement("SetProperty");
+    }
 }
 
 void cmCPackWIXGenerator::CopyDefinition(
@@ -824,13 +847,42 @@
   cmsys::Directory dir;
   dir.Load(topdir.c_str());
 
-  if(dir.GetNumberOfFiles() == 2)
+  std::string relativeDirectoryPath =
+    cmSystemTools::RelativePath(toplevel.c_str(), topdir.c_str());
+
+  if(relativeDirectoryPath.empty())
+    {
+    relativeDirectoryPath = ".";
+    }
+
+  cmInstalledFile const* directoryInstalledFile =
+    this->GetInstalledFile(relativeDirectoryPath);
+
+  bool emptyDirectory = dir.GetNumberOfFiles() == 2;
+  bool createDirectory = false;
+
+  if(emptyDirectory)
+    {
+    createDirectory = true;
+    }
+
+  if(directoryInstalledFile)
+    {
+    if(directoryInstalledFile->HasProperty("CPACK_WIX_ACL"))
+      {
+      createDirectory = true;
+      }
+    }
+
+  if(createDirectory)
     {
     std::string componentId = fileDefinitions.EmitComponentCreateFolder(
-      directoryId, GenerateGUID());
-
+      directoryId, GenerateGUID(), directoryInstalledFile);
     featureDefinitions.EmitComponentRef(componentId);
+    }
 
+  if(emptyDirectory)
+    {
     return;
     }
 
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.cxx b/Source/CPack/WiX/cmWIXAccessControlList.cxx
new file mode 100644
index 0000000..aeec968
--- /dev/null
+++ b/Source/CPack/WiX/cmWIXAccessControlList.cxx
@@ -0,0 +1,149 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2014 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmWIXAccessControlList.h"
+
+#include <CPack/cmCPackGenerator.h>
+
+#include <cmSystemTools.h>
+
+cmWIXAccessControlList::cmWIXAccessControlList(
+      cmCPackLog *logger,
+      cmInstalledFile const& installedFile,
+      cmWIXSourceWriter &sourceWriter):
+        Logger(logger),
+        InstalledFile(installedFile),
+        SourceWriter(sourceWriter)
+{
+
+}
+
+bool cmWIXAccessControlList::Apply()
+{
+  std::vector<std::string> entries;
+  this->InstalledFile.GetPropertyAsList("CPACK_WIX_ACL", entries);
+
+  for(size_t i = 0; i < entries.size(); ++i)
+    {
+    this->CreatePermissionElement(entries[i]);
+    }
+
+  return true;
+}
+
+void cmWIXAccessControlList::CreatePermissionElement(
+  std::string const& entry)
+{
+  std::string::size_type pos = entry.find('=');
+  if(pos == std::string::npos)
+    {
+    this->ReportError(entry, "Did not find mandatory '='");
+    return;
+    }
+
+  std::string user_and_domain = entry.substr(0, pos);
+  std::string permission_string = entry.substr(pos + 1);
+
+  pos = user_and_domain.find('@');
+  std::string user;
+  std::string domain;
+  if(pos != std::string::npos)
+    {
+    user = user_and_domain.substr(0, pos);
+    domain = user_and_domain.substr(pos + 1);
+    }
+  else
+    {
+    user = user_and_domain;
+    }
+
+  std::vector<std::string> permissions =
+    cmSystemTools::tokenize(permission_string, ",");
+
+  this->SourceWriter.BeginElement("Permission");
+  this->SourceWriter.AddAttribute("User", user);
+  if(domain.size())
+    {
+    this->SourceWriter.AddAttribute("Domain", domain);
+    }
+  for(size_t i = 0; i < permissions.size(); ++i)
+    {
+    this->EmitBooleanAttribute(entry,
+      cmSystemTools::TrimWhitespace(permissions[i]));
+    }
+  this->SourceWriter.EndElement("Permission");
+}
+
+void cmWIXAccessControlList::ReportError(
+  std::string const& entry,
+  std::string const& message)
+{
+  cmCPackLogger(cmCPackLog::LOG_ERROR,
+    "Failed processing ACL entry '" << entry <<
+    "': " << message << std::endl);
+}
+
+bool cmWIXAccessControlList::IsBooleanAttribute(std::string const& name)
+{
+  static const char* validAttributes[] =
+  {
+    "Append",
+    "ChangePermission",
+    "CreateChild",
+    "CreateFile",
+    "CreateLink",
+    "CreateSubkeys",
+    "Delete",
+    "DeleteChild",
+    "EnumerateSubkeys",
+    "Execute",
+    "FileAllRights",
+    "GenericAll",
+    "GenericExecute",
+    "GenericRead",
+    "GenericWrite",
+    "Notify",
+    "Read",
+    "ReadAttributes",
+    "ReadExtendedAttributes",
+    "ReadPermission",
+    "SpecificRightsAll",
+    "Synchronize",
+    "TakeOwnership",
+    "Traverse",
+    "Write",
+    "WriteAttributes",
+    "WriteExtendedAttributes",
+    0
+  };
+
+  size_t i = 0;
+  while(validAttributes[i])
+    {
+    if(name == validAttributes[i++]) return true;
+    }
+
+  return false;
+}
+
+void cmWIXAccessControlList::EmitBooleanAttribute(
+  std::string const& entry, std::string const& name)
+{
+  if(!this->IsBooleanAttribute(name))
+    {
+    std::stringstream message;
+    message << "Unknown boolean attribute '" << name << "'";
+    this->ReportError(entry, message.str());
+    }
+
+  this->SourceWriter.AddAttribute(name, "yes");
+}
diff --git a/Source/CPack/WiX/cmWIXAccessControlList.h b/Source/CPack/WiX/cmWIXAccessControlList.h
new file mode 100644
index 0000000..20902f7
--- /dev/null
+++ b/Source/CPack/WiX/cmWIXAccessControlList.h
@@ -0,0 +1,46 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2014 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmWIXAccessControlList_h
+#define cmWIXAccessControlList_h
+
+#include <cmInstalledFile.h>
+#include <CPack/cmCPackLog.h>
+
+#include "cmWIXSourceWriter.h"
+
+class cmWIXAccessControlList
+{
+public:
+  cmWIXAccessControlList(
+        cmCPackLog *logger,
+        cmInstalledFile const& installedFile,
+        cmWIXSourceWriter &sourceWriter);
+
+  bool Apply();
+
+private:
+  void CreatePermissionElement(std::string const& entry);
+
+  void ReportError(std::string const& entry, std::string const& message);
+
+  bool IsBooleanAttribute(std::string const& name);
+
+  void EmitBooleanAttribute(
+    std::string const& entry, std::string const& name);
+
+  cmCPackLog* Logger;
+  cmInstalledFile const& InstalledFile;
+  cmWIXSourceWriter &SourceWriter;
+};
+
+#endif
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
index 451188e..1adb06a 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.cxx
@@ -11,6 +11,7 @@
 ============================================================================*/
 
 #include "cmWIXFilesSourceWriter.h"
+#include "cmWIXAccessControlList.h"
 
 #include <cmInstalledFile.h>
 
@@ -112,7 +113,9 @@
 }
 
 std::string cmWIXFilesSourceWriter::EmitComponentCreateFolder(
-  std::string const& directoryId, std::string const& guid)
+  std::string const& directoryId,
+  std::string const& guid,
+  cmInstalledFile const* installedFile)
 {
   std::string componentId =
     std::string("CM_C_EMPTY_") + directoryId;
@@ -126,6 +129,12 @@
 
   BeginElement("CreateFolder");
 
+  if(installedFile)
+    {
+    cmWIXAccessControlList acl(Logger, *installedFile, *this);
+    acl.Apply();
+    }
+
   EndElement("CreateFolder");
   EndElement("Component");
   EndElement("DirectoryRef");
@@ -175,6 +184,12 @@
     AddAttribute("ReadOnly", "yes");
     }
 
+  if(installedFile)
+    {
+    cmWIXAccessControlList acl(Logger, *installedFile, *this);
+    acl.Apply();
+    }
+
   patch.ApplyFragment(fileId, *this);
   EndElement("File");
 
diff --git a/Source/CPack/WiX/cmWIXFilesSourceWriter.h b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
index 23ef561..b0a4af8 100644
--- a/Source/CPack/WiX/cmWIXFilesSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXFilesSourceWriter.h
@@ -47,7 +47,8 @@
 
   std::string EmitComponentCreateFolder(
     std::string const& directoryId,
-    std::string const& guid);
+    std::string const& guid,
+    cmInstalledFile const* installedFile);
 
   std::string EmitComponentFile(
     std::string const& directoryId,
diff --git a/Source/CPack/WiX/cmWIXSourceWriter.h b/Source/CPack/WiX/cmWIXSourceWriter.h
index 65b7240..3957d96 100644
--- a/Source/CPack/WiX/cmWIXSourceWriter.h
+++ b/Source/CPack/WiX/cmWIXSourceWriter.h
@@ -45,6 +45,9 @@
 
   static std::string WindowsCodepageToUtf8(std::string const& value);
 
+protected:
+   cmCPackLog* Logger;
+
 private:
   enum State
   {
@@ -58,8 +61,6 @@
 
   static std::string EscapeAttributeValue(std::string const& value);
 
-  cmCPackLog* Logger;
-
   cmsys::ofstream File;
 
   State State;
diff --git a/Source/CPack/cmCPack7zGenerator.cxx b/Source/CPack/cmCPack7zGenerator.cxx
new file mode 100644
index 0000000..ce31ad4
--- /dev/null
+++ b/Source/CPack/cmCPack7zGenerator.cxx
@@ -0,0 +1,25 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmCPack7zGenerator.h"
+
+//----------------------------------------------------------------------
+cmCPack7zGenerator::cmCPack7zGenerator()
+  :cmCPackArchiveGenerator(cmArchiveWrite::CompressNone,
+                           cmArchiveWrite::Type7Zip)
+{
+}
+
+//----------------------------------------------------------------------
+cmCPack7zGenerator::~cmCPack7zGenerator()
+{
+}
diff --git a/Source/CPack/cmCPack7zGenerator.h b/Source/CPack/cmCPack7zGenerator.h
new file mode 100644
index 0000000..f5a323f
--- /dev/null
+++ b/Source/CPack/cmCPack7zGenerator.h
@@ -0,0 +1,36 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPack7zGenerator_h
+#define cmCPack7zGenerator_h
+
+#include "cmCPackArchiveGenerator.h"
+
+/** \class cmCPack7zGenerator
+ * \brief A generator for 7z files
+ */
+class cmCPack7zGenerator : public cmCPackArchiveGenerator
+{
+public:
+  cmCPackTypeMacro(cmCPack7zGenerator, cmCPackArchiveGenerator);
+
+  /**
+   * Construct generator
+   */
+  cmCPack7zGenerator();
+  virtual ~cmCPack7zGenerator();
+
+protected:
+  virtual const char* GetOutputExtension() { return ".7z"; }
+};
+
+#endif
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index 91f92c5..1461bb1 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -637,8 +637,8 @@
       if ( globalGenerator->GetPreinstallTargetName() )
         {
         globalGenerator->FindMakeProgram(this->MakefileMap);
-        const char* cmakeMakeProgram
-          = this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
+        std::string cmakeMakeProgram
+          = this->MakefileMap->GetSafeDefinition("CMAKE_MAKE_PROGRAM");
         std::vector<std::string> buildCommand;
         globalGenerator->GenerateBuildCommand(buildCommand, cmakeMakeProgram,
             installProjectName, installDirectory,
@@ -1049,7 +1049,6 @@
 
   const char* tempPackageFileName = this->GetOption(
     "CPACK_TEMPORARY_PACKAGE_FILE_NAME");
-  const char* packageFileName = this->GetOption("CPACK_OUTPUT_FILE_PATH");
   const char* tempDirectory = this->GetOption("CPACK_TEMPORARY_DIRECTORY");
 
   cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl);
@@ -1114,7 +1113,7 @@
     std::string tmpPF(this->GetOption("CPACK_OUTPUT_FILE_PREFIX"));
     tempPackageFileName = it->c_str();
     tmpPF += "/"+cmSystemTools::GetFilenameName(*it);
-    packageFileName = tmpPF.c_str();
+    const char* packageFileName = tmpPF.c_str();
     cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy final package(s): "
         << (tempPackageFileName ? tempPackageFileName : "(NULL)" )
         << " to "
diff --git a/Source/CPack/cmCPackGeneratorFactory.cxx b/Source/CPack/cmCPackGeneratorFactory.cxx
index 9faf2b0..c8737f4 100644
--- a/Source/CPack/cmCPackGeneratorFactory.cxx
+++ b/Source/CPack/cmCPackGeneratorFactory.cxx
@@ -14,11 +14,14 @@
 
 #include "cmCPackGenerator.h"
 #include "cmCPackTGZGenerator.h"
+#include "cmCPackTXZGenerator.h"
 #include "cmCPackTarBZip2Generator.h"
 #include "cmCPackTarCompressGenerator.h"
 #include "cmCPackZIPGenerator.h"
+#include "cmCPack7zGenerator.h"
 #include "cmCPackSTGZGenerator.h"
 #include "cmCPackNSISGenerator.h"
+#include "IFW/cmCPackIFWGenerator.h"
 
 #ifdef __APPLE__
 #  include "cmCPackDragNDropGenerator.h"
@@ -56,6 +59,11 @@
     this->RegisterGenerator("TGZ", "Tar GZip compression",
       cmCPackTGZGenerator::CreateGenerator);
     }
+  if (cmCPackTXZGenerator::CanGenerate())
+    {
+    this->RegisterGenerator("TXZ", "Tar XZ compression",
+      cmCPackTXZGenerator::CreateGenerator);
+    }
   if (cmCPackSTGZGenerator::CanGenerate())
     {
     this->RegisterGenerator("STGZ", "Self extracting Tar GZip compression",
@@ -68,6 +76,11 @@
     this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
       cmCPackNSISGenerator::CreateGenerator64);
     }
+  if (cmCPackIFWGenerator::CanGenerate())
+    {
+    this->RegisterGenerator("IFW", "Qt Installer Framework",
+      cmCPackIFWGenerator::CreateGenerator);
+    }
 #ifdef __CYGWIN__
   if (cmCPackCygwinBinaryGenerator::CanGenerate())
     {
@@ -86,6 +99,11 @@
     this->RegisterGenerator("ZIP", "ZIP file format",
       cmCPackZIPGenerator::CreateGenerator);
     }
+  if (cmCPack7zGenerator::CanGenerate())
+    {
+    this->RegisterGenerator("7Z", "7-Zip file format",
+      cmCPack7zGenerator::CreateGenerator);
+    }
 #ifdef _WIN32
   if (cmCPackWIXGenerator::CanGenerate())
     {
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 0113698..a5eee6b 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -588,8 +588,8 @@
     return;
     }
 
-  cmsys::RegularExpression urlRegex;
-  urlRegex.compile("^(mailto:|(ftps?|https?|news)://).*$");
+  static cmsys::RegularExpression
+    urlRegex("^(mailto:|(ftps?|https?|news)://).*$");
 
   std::vector<std::string>::iterator it;
   for ( it = cpackMenuLinksVector.begin();
diff --git a/Source/CPack/cmCPackTXZGenerator.cxx b/Source/CPack/cmCPackTXZGenerator.cxx
new file mode 100644
index 0000000..ecfc177
--- /dev/null
+++ b/Source/CPack/cmCPackTXZGenerator.cxx
@@ -0,0 +1,25 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmCPackTXZGenerator.h"
+
+//----------------------------------------------------------------------
+cmCPackTXZGenerator::cmCPackTXZGenerator()
+  :cmCPackArchiveGenerator(cmArchiveWrite::CompressXZ,
+                           cmArchiveWrite::TypeTAR)
+{
+}
+
+//----------------------------------------------------------------------
+cmCPackTXZGenerator::~cmCPackTXZGenerator()
+{
+}
diff --git a/Source/CPack/cmCPackTXZGenerator.h b/Source/CPack/cmCPackTXZGenerator.h
new file mode 100644
index 0000000..bf8152f
--- /dev/null
+++ b/Source/CPack/cmCPackTXZGenerator.h
@@ -0,0 +1,35 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2009 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackTXZGenerator_h
+#define cmCPackTXZGenerator_h
+
+#include "cmCPackArchiveGenerator.h"
+
+/** \class cmCPackTXZGenerator
+ * \brief A generator for TXZ files
+ *
+ */
+class cmCPackTXZGenerator : public cmCPackArchiveGenerator
+{
+public:
+  cmCPackTypeMacro(cmCPackTXZGenerator, cmCPackArchiveGenerator);
+  /**
+   * Construct generator
+   */
+  cmCPackTXZGenerator();
+  virtual ~cmCPackTXZGenerator();
+protected:
+  virtual const char* GetOutputExtension() { return ".tar.xz"; }
+};
+
+#endif
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index ad37c42..c57028d 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -101,7 +101,7 @@
 // this is CPack.
 int main (int argc, char const* const* argv)
 {
-  setlocale(LC_ALL, "");
+  setlocale(LC_CTYPE, "");
   cmsys::Encoding::CommandLineArguments args =
     cmsys::Encoding::CommandLineArguments::Main(argc, argv);
   argc = args.argc();
@@ -343,7 +343,6 @@
       {
       cmCPack_Log(&log, cmCPackLog::LOG_ERROR,
         "CPack generator not specified" << std::endl);
-      parsed = 0;
       }
     else
       {
diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx
index 934481b..7f966aa 100644
--- a/Source/CTest/cmCTestBatchTestHandler.cxx
+++ b/Source/CTest/cmCTestBatchTestHandler.cxx
@@ -33,8 +33,8 @@
 {
   this->Script = this->CTest->GetBinaryDir()
     + "/Testing/CTestBatch.txt";
-  std::fstream fout;
-  fout.open(this->Script.c_str(), std::ios::out);
+  cmsys::ofstream fout;
+  fout.open(this->Script.c_str());
   fout << "#!/bin/sh\n";
 
   for(TestMap::iterator i = this->Tests.begin(); i != this->Tests.end(); ++i)
@@ -48,7 +48,7 @@
 }
 
 //---------------------------------------------------------
-void cmCTestBatchTestHandler::WriteSrunArgs(int test, std::fstream& fout)
+void cmCTestBatchTestHandler::WriteSrunArgs(int test, cmsys::ofstream& fout)
 {
   cmCTestTestHandler::cmCTestTestProperties* properties =
       this->Properties[test];
@@ -79,7 +79,7 @@
 }
 
 //---------------------------------------------------------
-void cmCTestBatchTestHandler::WriteTestCommand(int test, std::fstream& fout)
+void cmCTestBatchTestHandler::WriteTestCommand(int test, cmsys::ofstream& fout)
 {
   std::vector<std::string> args = this->Properties[test]->Args;
   std::vector<std::string> processArgs;
diff --git a/Source/CTest/cmCTestBatchTestHandler.h b/Source/CTest/cmCTestBatchTestHandler.h
index ab0d081..e0c6e48 100644
--- a/Source/CTest/cmCTestBatchTestHandler.h
+++ b/Source/CTest/cmCTestBatchTestHandler.h
@@ -17,6 +17,7 @@
 #include <cmCTestTestHandler.h>
 #include <cmCTestMultiProcessHandler.h>
 #include <cmCTestRunTest.h>
+#include <cmsys/FStream.hxx>
 
 /** \class cmCTestBatchTestHandler
  * \brief run parallel ctest
@@ -30,8 +31,8 @@
   virtual void RunTests();
 protected:
   void WriteBatchScript();
-  void WriteSrunArgs(int test, std::fstream& fout);
-  void WriteTestCommand(int test, std::fstream& fout);
+  void WriteSrunArgs(int test, cmsys::ofstream& fout);
+  void WriteTestCommand(int test, cmsys::ofstream& fout);
 
   void SubmitBatchScript();
 
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index b4818be..41db042 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -68,6 +68,12 @@
     generator += this->BuildGenerator;
     args.push_back(generator);
     }
+  if(!this->BuildGeneratorPlatform.empty())
+    {
+    std::string platform = "-A";
+    platform += this->BuildGeneratorPlatform;
+    args.push_back(platform);
+    }
   if(this->BuildGeneratorToolset.size())
     {
     std::string toolset = "-T";
@@ -246,6 +252,7 @@
     // Make the generator available for the Build call below.
     cm.SetGlobalGenerator(cm.CreateGlobalGenerator(
                             this->BuildGenerator));
+    cm.SetGeneratorPlatform(this->BuildGeneratorPlatform);
     cm.SetGeneratorToolset(this->BuildGeneratorToolset);
 
     // Load the cache to make CMAKE_MAKE_PROGRAM available.
@@ -301,7 +308,7 @@
     int retVal = cm.GetGlobalGenerator()->Build(
       this->SourceDir, this->BinaryDir,
       this->BuildProject, *tarIt,
-      &output, this->BuildMakeProgram,
+      output, this->BuildMakeProgram,
       config,
       !this->BuildNoClean,
       false, remainingTime);
@@ -490,6 +497,12 @@
     idx++;
     this->BuildGenerator = allArgs[idx];
     }
+  if(currentArg == "--build-generator-platform" &&
+     idx < allArgs.size() - 1)
+    {
+    idx++;
+    this->BuildGeneratorPlatform = allArgs[idx];
+    }
   if(currentArg == "--build-generator-toolset" &&
      idx < allArgs.size() - 1)
     {
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h
index d1e9a4d..5a7b916 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.h
+++ b/Source/CTest/cmCTestBuildAndTestHandler.h
@@ -57,6 +57,7 @@
   std::string  Output;
 
   std::string              BuildGenerator;
+  std::string              BuildGeneratorPlatform;
   std::string              BuildGeneratorToolset;
   std::vector<std::string> BuildOptions;
   bool                     BuildTwoConfig;
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 7922c9a..2ec1365 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -605,6 +605,9 @@
   typedef std::set<std::string, FragmentCompare> Fragments;
   Fragments fragments(fragmentCompare);
 
+  // only report the first 50 warnings and first 50 errors
+  int numErrorsAllowed = this->MaxErrors;
+  int numWarningsAllowed = this->MaxWarnings;
   // Identify fragments on disk.
   cmsys::Directory launchDir;
   launchDir.Load(this->CTestLaunchDir.c_str());
@@ -612,13 +615,15 @@
   for(unsigned long i=0; i < n; ++i)
     {
     const char* fname = launchDir.GetFile(i);
-    if(this->IsLaunchedErrorFile(fname))
+    if(this->IsLaunchedErrorFile(fname) && numErrorsAllowed)
       {
+      numErrorsAllowed--;
       fragments.insert(this->CTestLaunchDir + "/" + fname);
       ++this->TotalErrors;
       }
-    else if(this->IsLaunchedWarningFile(fname))
+    else if(this->IsLaunchedWarningFile(fname) && numWarningsAllowed)
       {
+      numWarningsAllowed--;
       fragments.insert(this->CTestLaunchDir + "/" + fname);
       ++this->TotalWarnings;
       }
diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx
index 1aa8768..ef62fd3 100644
--- a/Source/CTest/cmCTestConfigureCommand.cxx
+++ b/Source/CTest/cmCTestConfigureCommand.cxx
@@ -118,6 +118,15 @@
       cmakeConfigureCommand += cmakeGeneratorName;
       cmakeConfigureCommand += "\"";
 
+      const char* cmakeGeneratorPlatform =
+        this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM");
+      if(cmakeGeneratorPlatform && *cmakeGeneratorPlatform)
+        {
+        cmakeConfigureCommand += " \"-A";
+        cmakeConfigureCommand += cmakeGeneratorPlatform;
+        cmakeConfigureCommand += "\"";
+        }
+
       const char* cmakeGeneratorToolset =
         this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET");
       if(cmakeGeneratorToolset && *cmakeGeneratorToolset)
diff --git a/Source/CTest/cmCTestConfigureHandler.cxx b/Source/CTest/cmCTestConfigureHandler.cxx
index a6e39a4..c492bf0 100644
--- a/Source/CTest/cmCTestConfigureHandler.cxx
+++ b/Source/CTest/cmCTestConfigureHandler.cxx
@@ -77,7 +77,7 @@
     this->StartLogFile("Configure", ofs);
     cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Configure with command: "
       << cCommand << std::endl);
-    res = this->CTest->RunMakeCommand(cCommand.c_str(), &output,
+    res = this->CTest->RunMakeCommand(cCommand.c_str(), output,
       &retVal, buildDirectory.c_str(),
       0, ofs);
 
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index da27c8c..76f6584 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -14,6 +14,7 @@
 #include "cmParseCoberturaCoverage.h"
 #include "cmParseGTMCoverage.h"
 #include "cmParseCacheCoverage.h"
+#include "cmParseJacocoCoverage.h"
 #include "cmCTest.h"
 #include "cmake.h"
 #include "cmMakefile.h"
@@ -415,6 +416,13 @@
     return error;
     }
 
+  file_count += this->HandleJacocoCoverage(&cont);
+  error = cont.Error;
+  if ( file_count < 0 )
+    {
+    return error;
+    }
+
   std::set<std::string> uncovered = this->FindUncoveredFiles(&cont);
 
   if ( file_count == 0 )
@@ -872,6 +880,38 @@
 };
 
 //----------------------------------------------------------------------
+int cmCTestCoverageHandler::HandleJacocoCoverage(
+  cmCTestCoverageHandlerContainer* cont)
+{
+  cmParseJacocoCoverage cov =
+   cmParseJacocoCoverage(*cont, this->CTest);
+  cmsys::Glob g;
+  std::vector<std::string> files;
+  g.SetRecurse(true);
+
+  std::string SourceDir
+    = this->CTest->GetCTestConfiguration("SourceDirectory");
+  std::string coverageFile = SourceDir+ "/*jacoco.xml";
+
+  g.FindFiles(coverageFile);
+  files=g.GetFiles();
+  if (files.size() > 0)
+    {
+    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+      "Found Jacoco Files, Performing Coverage" << std::endl);
+    cov.LoadCoverageData(files);
+    }
+  else
+    {
+    cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
+      " Cannot find Jacoco coverage files: " << coverageFile
+      << std::endl);
+    }
+  return static_cast<int>(cont->TotalCoverage.size());
+}
+
+
+//----------------------------------------------------------------------
 int cmCTestCoverageHandler::HandleGCovCoverage(
   cmCTestCoverageHandlerContainer* cont)
 {
diff --git a/Source/CTest/cmCTestCoverageHandler.h b/Source/CTest/cmCTestCoverageHandler.h
index 38a3353..d0f274c 100644
--- a/Source/CTest/cmCTestCoverageHandler.h
+++ b/Source/CTest/cmCTestCoverageHandler.h
@@ -81,7 +81,10 @@
   //! Handle coverage for mumps
   int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont);
 
-  //! Handle coverage using Bullseye
+  //! Handle coverage for Jacoco
+  int HandleJacocoCoverage(cmCTestCoverageHandlerContainer* cont);
+
+//! Handle coverage using Bullseye
   int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont);
   int RunBullseyeSourceSummary(cmCTestCoverageHandlerContainer* cont);
   int RunBullseyeCoverageBranch(cmCTestCoverageHandlerContainer* cont,
diff --git a/Source/CTest/cmCTestMemCheckCommand.cxx b/Source/CTest/cmCTestMemCheckCommand.cxx
index 535c993..f144066 100644
--- a/Source/CTest/cmCTestMemCheckCommand.cxx
+++ b/Source/CTest/cmCTestMemCheckCommand.cxx
@@ -21,6 +21,10 @@
     = this->CTest->GetInitializedHandler("memcheck");
 
   this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
+    "MemoryCheckType", "CTEST_MEMORYCHECK_TYPE");
+  this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
+    "MemoryCheckSanitizerOptions", "CTEST_MEMORYCHECK_SANITIZER_OPTIONS");
+  this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
     "MemoryCheckCommand", "CTEST_MEMORYCHECK_COMMAND");
   this->CTest->SetCTestConfigurationFromCMakeVariable(this->Makefile,
     "MemoryCheckCommandOptions", "CTEST_MEMORYCHECK_COMMAND_OPTIONS");
diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx
index ecaa474..4835010 100644
--- a/Source/CTest/cmCTestMemCheckHandler.cxx
+++ b/Source/CTest/cmCTestMemCheckHandler.cxx
@@ -18,6 +18,7 @@
 #include <cmsys/Process.h>
 #include <cmsys/RegularExpression.hxx>
 #include <cmsys/Base64.h>
+#include <cmsys/Glob.hxx>
 #include <cmsys/FStream.hxx>
 #include "cmMakefile.h"
 #include "cmXMLSafe.h"
@@ -44,11 +45,23 @@
   {0,0}
 };
 
+static void xmlReportError(int line, const char* msg, void* data)
+{
+  cmCTest* ctest = (cmCTest*)data;
+  cmCTestLog(ctest, ERROR_MESSAGE,
+             "Error parsing XML in stream at line "
+             << line << ": " << msg << std::endl);
+}
+
 // parse the xml file containing the results of last BoundsChecker run
 class cmBoundsCheckerParser : public cmXMLParser
 {
 public:
-  cmBoundsCheckerParser(cmCTest* c) { this->CTest = c;}
+  cmBoundsCheckerParser(cmCTest* c)
+    {
+      this->CTest = c;
+      this->SetErrorCallback(xmlReportError, (void*)c);
+    }
   void StartElement(const std::string& name, const char** atts)
     {
       if(name == "MemoryLeak" ||
@@ -124,61 +137,8 @@
 
 #define BOUNDS_CHECKER_MARKER \
 "******######*****Begin BOUNDS CHECKER XML******######******"
-//----------------------------------------------------------------------
-static const char* cmCTestMemCheckResultStrings[] = {
-  "ABR",
-  "ABW",
-  "ABWL",
-  "COR",
-  "EXU",
-  "FFM",
-  "FIM",
-  "FMM",
-  "FMR",
-  "FMW",
-  "FUM",
-  "IPR",
-  "IPW",
-  "MAF",
-  "MLK",
-  "MPK",
-  "NPR",
-  "ODS",
-  "PAR",
-  "PLK",
-  "UMC",
-  "UMR",
-  0
-};
 
 
-//----------------------------------------------------------------------
-static const char* cmCTestMemCheckResultLongStrings[] = {
-  "Threading Problem",
-  "ABW",
-  "ABWL",
-  "COR",
-  "EXU",
-  "FFM",
-  "FIM",
-  "Mismatched deallocation",
-  "FMR",
-  "FMW",
-  "FUM",
-  "IPR",
-  "IPW",
-  "MAF",
-  "Memory Leak",
-  "Potential Memory Leak",
-  "NPR",
-  "ODS",
-  "Invalid syscall param",
-  "PLK",
-  "Uninitialized Memory Conditional",
-  "Uninitialized Memory Read",
-  0
-};
-
 
 //----------------------------------------------------------------------
 cmCTestMemCheckHandler::cmCTestMemCheckHandler()
@@ -186,12 +146,14 @@
   this->MemCheck = true;
   this->CustomMaximumPassedTestOutputSize = 0;
   this->CustomMaximumFailedTestOutputSize = 0;
+  this->LogWithPID = false;
 }
 
 //----------------------------------------------------------------------
 void cmCTestMemCheckHandler::Initialize()
 {
   this->Superclass::Initialize();
+  this->LogWithPID = false;
   this->CustomMaximumPassedTestOutputSize = 0;
   this->CustomMaximumFailedTestOutputSize = 0;
   this->MemoryTester = "";
@@ -199,12 +161,6 @@
   this->MemoryTesterOptions.clear();
   this->MemoryTesterStyle = UNKNOWN;
   this->MemoryTesterOutputFile = "";
-  int cc;
-  for ( cc = 0; cc < NO_MEMORY_FAULT; cc ++ )
-    {
-    this->MemoryTesterGlobalResults[cc] = 0;
-    }
-
 }
 
 //----------------------------------------------------------------------
@@ -249,8 +205,8 @@
   index = stream.str();
   for ( pp = 0; pp < this->MemoryTesterDynamicOptions.size(); pp ++ )
     {
-      std::string arg = this->MemoryTesterDynamicOptions[pp];
-      std::string::size_type pos = arg.find("??");
+    std::string arg = this->MemoryTesterDynamicOptions[pp];
+    std::string::size_type pos = arg.find("??");
     if (pos != std::string::npos)
       {
       arg.replace(pos, 2, index);
@@ -260,18 +216,125 @@
     memcheckcommand += arg;
     memcheckcommand += "\"";
     }
+  // Create a copy of the memory tester environment variable.
+  // This is used for memory testing programs that pass options
+  // via environment varaibles.
+  std::string memTesterEnvironmentVariable =
+    this->MemoryTesterEnvironmentVariable;
   for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ )
     {
-    args.push_back(this->MemoryTesterOptions[pp]);
-    memcheckcommand += " \"";
-    memcheckcommand += this->MemoryTesterOptions[pp];
-    memcheckcommand += "\"";
+    if(memTesterEnvironmentVariable.size())
+      {
+      // If we are using env to pass options, append all the options to
+      // this string with space separation.
+      memTesterEnvironmentVariable += " " + this->MemoryTesterOptions[pp];
+      }
+    // for regular options just add them to args and memcheckcommand
+    // which is just used for display
+    else
+      {
+      args.push_back(this->MemoryTesterOptions[pp]);
+      memcheckcommand += " \"";
+      memcheckcommand += this->MemoryTesterOptions[pp];
+      memcheckcommand += "\"";
+      }
+    }
+  // if this is an env option type, then add the env string as a single
+  // argument.
+  if(memTesterEnvironmentVariable.size())
+    {
+    std::string::size_type pos = memTesterEnvironmentVariable.find("??");
+    if (pos != std::string::npos)
+      {
+      memTesterEnvironmentVariable.replace(pos, 2, index);
+      }
+    memcheckcommand += " " + memTesterEnvironmentVariable;
+    args.push_back(memTesterEnvironmentVariable);
     }
   cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: "
     << memcheckcommand << std::endl);
 }
 
 //----------------------------------------------------------------------
+void cmCTestMemCheckHandler::InitializeResultsVectors()
+{
+  // fill these members
+//  cmsys::vector<std::string> ResultStrings;
+//  cmsys::vector<std::string> ResultStringsLong;
+//  cmsys::vector<int>         GlobalResults;
+  this->ResultStringsLong.clear();
+  this->ResultStrings.clear();
+  this->GlobalResults.clear();
+  // If we are working with style checkers that dynamically fill
+  // the results strings then return.
+  if(this->MemoryTesterStyle > cmCTestMemCheckHandler::BOUNDS_CHECKER)
+    {
+    return;
+    }
+
+  // define the standard set of errors
+  //----------------------------------------------------------------------
+  static const char* cmCTestMemCheckResultStrings[] = {
+    "ABR",
+    "ABW",
+    "ABWL",
+    "COR",
+    "EXU",
+    "FFM",
+    "FIM",
+    "FMM",
+    "FMR",
+    "FMW",
+    "FUM",
+    "IPR",
+    "IPW",
+    "MAF",
+    "MLK",
+    "MPK",
+    "NPR",
+    "ODS",
+    "PAR",
+    "PLK",
+    "UMC",
+    "UMR",
+    0
+  };
+//----------------------------------------------------------------------
+  static const char* cmCTestMemCheckResultLongStrings[] = {
+    "Threading Problem",
+    "ABW",
+    "ABWL",
+    "COR",
+    "EXU",
+    "FFM",
+    "FIM",
+    "Mismatched deallocation",
+    "FMR",
+    "FMW",
+    "FUM",
+    "IPR",
+    "IPW",
+    "MAF",
+    "Memory Leak",
+    "Potential Memory Leak",
+    "NPR",
+    "ODS",
+    "Invalid syscall param",
+    "PLK",
+    "Uninitialized Memory Conditional",
+    "Uninitialized Memory Read",
+    0
+  };
+  this->GlobalResults.clear();
+  for(int i =0; cmCTestMemCheckResultStrings[i] != 0; ++i)
+    {
+    this->ResultStrings.push_back(cmCTestMemCheckResultStrings[i]);
+    this->ResultStringsLong.push_back(cmCTestMemCheckResultLongStrings[i]);
+    this->GlobalResults.push_back(0);
+    }
+}
+
+//----------------------------------------------------------------------
 void cmCTestMemCheckHandler::PopulateCustomVectors(cmMakefile *mf)
 {
   this->cmCTestTestHandler::PopulateCustomVectors(mf);
@@ -283,6 +346,8 @@
   this->CTest->PopulateCustomVector(mf,
                              "CTEST_CUSTOM_MEMCHECK_IGNORE",
                              this->CustomTestsIgnore);
+  std::string cmake = cmSystemTools::GetCMakeCommand();
+  this->CTest->SetCTestConfiguration("CMakeCommand", cmake.c_str());
 }
 
 //----------------------------------------------------------------------
@@ -292,7 +357,6 @@
     {
     return;
     }
-
   this->CTest->StartXML(os, this->AppendXML);
   os << "<DynamicAnalysis Checker=\"";
   switch ( this->MemoryTesterStyle )
@@ -306,6 +370,18 @@
     case cmCTestMemCheckHandler::BOUNDS_CHECKER:
       os << "BoundsChecker";
       break;
+    case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
+      os << "AddressSanitizer";
+      break;
+    case cmCTestMemCheckHandler::THREAD_SANITIZER:
+      os << "ThreadSanitizer";
+      break;
+    case cmCTestMemCheckHandler::MEMORY_SANITIZER:
+      os << "MemorySanitizer";
+      break;
+    case cmCTestMemCheckHandler::UB_SANITIZER:
+      os << "UndefinedBehaviorSanitizer";
+      break;
     default:
       os << "Unknown";
     }
@@ -333,8 +409,7 @@
     {
     cmCTestTestResult *result = &this->TestResults[cc];
     std::string memcheckstr;
-    int memcheckresults[cmCTestMemCheckHandler::NO_MEMORY_FAULT];
-    int kk;
+    std::vector<int> memcheckresults(this->ResultStrings.size(), 0);
     bool res = this->ProcessMemCheckOutput(result->Output, memcheckstr,
       memcheckresults);
     if ( res && result->Status == cmCTestMemCheckHandler::COMPLETED )
@@ -345,16 +420,17 @@
       static_cast<size_t>(this->CustomMaximumFailedTestOutputSize));
     this->WriteTestResultHeader(os, result);
     os << "\t\t<Results>" << std::endl;
-    for ( kk = 0; cmCTestMemCheckResultLongStrings[kk]; kk ++ )
+    for(std::vector<int>::size_type kk = 0;
+        kk < memcheckresults.size(); ++kk)
       {
       if ( memcheckresults[kk] )
         {
-        os << "\t\t\t<Defect type=\"" << cmCTestMemCheckResultLongStrings[kk]
+        os << "\t\t\t<Defect type=\"" << this->ResultStringsLong[kk]
           << "\">"
            << memcheckresults[kk]
            << "</Defect>" << std::endl;
         }
-      this->MemoryTesterGlobalResults[kk] += memcheckresults[kk];
+      this->GlobalResults[kk] += memcheckresults[kk];
       }
 
     std::string logTag;
@@ -383,9 +459,9 @@
   cmCTestLog(this->CTest, HANDLER_OUTPUT, "Memory checking results:"
     << std::endl);
   os << "\t<DefectList>" << std::endl;
-  for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
+  for ( cc = 0; cc < this->GlobalResults.size(); cc ++ )
     {
-    if ( this->MemoryTesterGlobalResults[cc] )
+    if ( this->GlobalResults[cc] )
       {
 #ifdef cerr
 #  undef cerr
@@ -393,9 +469,9 @@
       std::cerr.width(35);
 #define cerr no_cerr
       cmCTestLog(this->CTest, HANDLER_OUTPUT,
-        cmCTestMemCheckResultLongStrings[cc] << " - "
-        << this->MemoryTesterGlobalResults[cc] << std::endl);
-      os << "\t\t<Defect Type=\"" << cmCTestMemCheckResultLongStrings[cc]
+        this->ResultStringsLong[cc] << " - "
+        << this->GlobalResults[cc] << std::endl);
+      os << "\t\t<Defect Type=\"" << this->ResultStringsLong[cc]
         << "\"/>" << std::endl;
       }
     }
@@ -410,30 +486,33 @@
 
   os << "</DynamicAnalysis>" << std::endl;
   this->CTest->EndXML(os);
-
-
 }
 
 //----------------------------------------------------------------------
 bool cmCTestMemCheckHandler::InitializeMemoryChecking()
 {
+  this->MemoryTesterEnvironmentVariable = "";
+  this->MemoryTester = "";
   // Setup the command
   if ( cmSystemTools::FileExists(this->CTest->GetCTestConfiguration(
         "MemoryCheckCommand").c_str()) )
     {
     this->MemoryTester
       = this->CTest->GetCTestConfiguration("MemoryCheckCommand").c_str();
-
+    std::string testerName =
+      cmSystemTools::GetFilenameName(this->MemoryTester);
     // determine the checker type
-    if ( this->MemoryTester.find("valgrind") != std::string::npos )
+    if ( testerName.find("valgrind") != std::string::npos ||
+         this->CTest->GetCTestConfiguration("MemoryCheckType")
+         == "Valgrind")
       {
         this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
       }
-    else if ( this->MemoryTester.find("purify") != std::string::npos )
+    else if ( testerName.find("purify") != std::string::npos )
       {
       this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
       }
-    else if ( this->MemoryTester.find("BC") != std::string::npos )
+    else if ( testerName.find("BC") != std::string::npos )
       {
       this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
       }
@@ -463,12 +542,62 @@
       = this->CTest->GetCTestConfiguration("BoundsCheckerCommand").c_str();
     this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
     }
-  else
+  if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
+       == "AddressSanitizer")
+    {
+    this->MemoryTester
+      = this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::ADDRESS_SANITIZER;
+    this->LogWithPID = true; // even if we give the log file the pid is added
+    }
+  if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
+       == "ThreadSanitizer")
+    {
+    this->MemoryTester
+      = this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::THREAD_SANITIZER;
+    this->LogWithPID = true; // even if we give the log file the pid is added
+    }
+  if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
+       == "MemorySanitizer")
+    {
+    this->MemoryTester
+      = this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::MEMORY_SANITIZER;
+    this->LogWithPID = true; // even if we give the log file the pid is added
+    }
+  if ( this->CTest->GetCTestConfiguration("MemoryCheckType")
+       == "UndefinedBehaviorSanitizer")
+    {
+    this->MemoryTester
+      = this->CTest->GetCTestConfiguration("CMakeCommand").c_str();
+    this->MemoryTesterStyle = cmCTestMemCheckHandler::UB_SANITIZER;
+    this->LogWithPID = true; // even if we give the log file the pid is added
+    }
+  // Check the MemoryCheckType
+  if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UNKNOWN)
+    {
+    std::string checkType =
+      this->CTest->GetCTestConfiguration("MemoryCheckType");
+    if(checkType == "Purify")
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY;
+      }
+    else if(checkType == "BoundsChecker")
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER;
+      }
+    else if(checkType == "Valgrind")
+      {
+      this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND;
+      }
+    }
+  if(this->MemoryTester.size() == 0 )
     {
     cmCTestLog(this->CTest, WARNING,
-      "Memory checker (MemoryCheckCommand) "
-      "not set, or cannot find the specified program."
-      << std::endl);
+               "Memory checker (MemoryCheckCommand) "
+               "not set, or cannot find the specified program."
+               << std::endl);
     return false;
     }
 
@@ -567,6 +696,46 @@
       this->MemoryTesterOptions.push_back("/M");
       break;
       }
+      // these are almost the same but the env var used is different
+    case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
+    case cmCTestMemCheckHandler::THREAD_SANITIZER:
+    case cmCTestMemCheckHandler::MEMORY_SANITIZER:
+    case cmCTestMemCheckHandler::UB_SANITIZER:
+      {
+      // To pass arguments to ThreadSanitizer the environment variable
+      // TSAN_OPTIONS is used. This is done with the cmake -E env command.
+      // The MemoryTesterDynamicOptions is setup with the -E env
+      // Then the MemoryTesterEnvironmentVariable gets the
+      // TSAN_OPTIONS string with the log_path in it.
+      this->MemoryTesterDynamicOptions.push_back("-E");
+      this->MemoryTesterDynamicOptions.push_back("env");
+      std::string envVar;
+      std::string extraOptions =
+        this->CTest->GetCTestConfiguration("MemoryCheckSanitizerOptions");
+      if(this->MemoryTesterStyle == cmCTestMemCheckHandler::ADDRESS_SANITIZER)
+        {
+        envVar = "ASAN_OPTIONS";
+        extraOptions += " detect_leaks=1";
+        }
+      else if(this->MemoryTesterStyle ==
+              cmCTestMemCheckHandler::THREAD_SANITIZER)
+        {
+        envVar = "TSAN_OPTIONS";
+        }
+      else if(this->MemoryTesterStyle ==
+              cmCTestMemCheckHandler::MEMORY_SANITIZER)
+        {
+        envVar = "MSAN_OPTIONS";
+        }
+      else if(this->MemoryTesterStyle == cmCTestMemCheckHandler::UB_SANITIZER)
+        {
+        envVar = "UBSAN_OPTIONS";
+        }
+      std::string outputFile = envVar + "=log_path=\""
+        + this->MemoryTesterOutputFile + "\" ";
+      this->MemoryTesterEnvironmentVariable = outputFile + extraOptions;
+      break;
+      }
     default:
       cmCTestLog(this->CTest, ERROR_MESSAGE,
         "Do not understand memory checker: " << this->MemoryTester
@@ -574,24 +743,20 @@
       return false;
     }
 
-  std::vector<std::string>::size_type cc;
-  for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
-    {
-    this->MemoryTesterGlobalResults[cc] = 0;
-    }
+  this->InitializeResultsVectors();
+  // std::vector<std::string>::size_type cc;
+  // for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ )
+  //   {
+  //   this->MemoryTesterGlobalResults[cc] = 0;
+  //   }
   return true;
 }
 
 //----------------------------------------------------------------------
-bool cmCTestMemCheckHandler::ProcessMemCheckOutput(const std::string& str,
-                                               std::string& log, int* results)
+bool cmCTestMemCheckHandler::
+ProcessMemCheckOutput(const std::string& str,
+                      std::string& log, std::vector<int>& results)
 {
-  std::string::size_type cc;
-  for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ )
-    {
-    results[cc] = 0;
-    }
-
   if ( this->MemoryTesterStyle == cmCTestMemCheckHandler::VALGRIND )
     {
     return this->ProcessMemCheckValgrindOutput(str, log, results);
@@ -601,6 +766,17 @@
     return this->ProcessMemCheckPurifyOutput(str, log, results);
     }
   else if ( this->MemoryTesterStyle ==
+            cmCTestMemCheckHandler::ADDRESS_SANITIZER ||
+            this->MemoryTesterStyle ==
+            cmCTestMemCheckHandler::THREAD_SANITIZER ||
+            this->MemoryTesterStyle ==
+            cmCTestMemCheckHandler::MEMORY_SANITIZER ||
+            this->MemoryTesterStyle ==
+            cmCTestMemCheckHandler::UB_SANITIZER)
+    {
+    return this->ProcessMemCheckSanitizerOutput(str, log, results);
+    }
+  else if ( this->MemoryTesterStyle ==
     cmCTestMemCheckHandler::BOUNDS_CHECKER )
     {
     return this->ProcessMemCheckBoundsCheckerOutput(str, log, results);
@@ -611,15 +787,94 @@
     log.append("None that I know");
     log = str;
     }
-
-
   return true;
 }
 
+std::vector<int>::size_type cmCTestMemCheckHandler::FindOrAddWarning(
+  const std::string& warning)
+{
+  for(std::vector<std::string>::size_type i =0;
+      i < this->ResultStrings.size(); ++i)
+    {
+    if(this->ResultStrings[i] == warning)
+      {
+      return i;
+      }
+    }
+  this->GlobalResults.push_back(0); // this must stay the same size
+  this->ResultStrings.push_back(warning);
+  this->ResultStringsLong.push_back(warning);
+  return this->ResultStrings.size()-1;
+}
+//----------------------------------------------------------------------
+bool cmCTestMemCheckHandler::ProcessMemCheckSanitizerOutput(
+  const std::string& str, std::string& log,
+  std::vector<int>& result)
+{
+  std::string regex;
+  switch ( this->MemoryTesterStyle )
+    {
+    case cmCTestMemCheckHandler::ADDRESS_SANITIZER:
+      regex = "ERROR: AddressSanitizer: (.*) on.*";
+      break;
+    case cmCTestMemCheckHandler::THREAD_SANITIZER:
+      regex = "WARNING: ThreadSanitizer: (.*) \\(pid=.*\\)";
+      break;
+    case cmCTestMemCheckHandler::MEMORY_SANITIZER:
+      regex = "WARNING: MemorySanitizer: (.*)";
+      break;
+    case cmCTestMemCheckHandler::UB_SANITIZER:
+      regex = "runtime error: (.*)";
+      break;
+    default:
+      break;
+    }
+  cmsys::RegularExpression sanitizerWarning(regex);
+  cmsys::RegularExpression leakWarning("(Direct|Indirect) leak of .*");
+  int defects = 0;
+  std::vector<std::string> lines;
+  cmSystemTools::Split(str.c_str(), lines);
+  cmOStringStream ostr;
+  log = "";
+  for( std::vector<std::string>::iterator i = lines.begin();
+       i != lines.end(); ++i)
+    {
+    std::string resultFound;
+    if(leakWarning.find(*i))
+      {
+      resultFound = leakWarning.match(1)+" leak";
+      }
+    else if (sanitizerWarning.find(*i))
+      {
+      resultFound = sanitizerWarning.match(1);
+      }
+    if(resultFound.size())
+      {
+      std::vector<int>::size_type idx = this->FindOrAddWarning(resultFound);
+      if(result.size() == 0 || idx > result.size()-1)
+        {
+        result.push_back(1);
+        }
+      else
+        {
+        result[idx]++;
+        }
+      defects++;
+      ostr << "<b>" <<  this->ResultStrings[idx] << "</b> ";
+      }
+    ostr << cmXMLSafe(*i) << std::endl;
+    }
+  log = ostr.str();
+  if(defects)
+    {
+    return false;
+    }
+  return true;
+}
 //----------------------------------------------------------------------
 bool cmCTestMemCheckHandler::ProcessMemCheckPurifyOutput(
   const std::string& str, std::string& log,
-  int* results)
+  std::vector<int>& results)
 {
   std::vector<std::string> lines;
   cmSystemTools::Split(str.c_str(), lines);
@@ -633,19 +888,19 @@
   for( std::vector<std::string>::iterator i = lines.begin();
        i != lines.end(); ++i)
     {
-    int failure = cmCTestMemCheckHandler::NO_MEMORY_FAULT;
+    std::vector<int>::size_type failure = this->ResultStrings.size();
     if ( pfW.find(*i) )
       {
-      int cc;
-      for ( cc = 0; cc < cmCTestMemCheckHandler::NO_MEMORY_FAULT; cc ++ )
+      std::vector<int>::size_type cc;
+      for ( cc = 0; cc < this->ResultStrings.size(); cc ++ )
         {
-        if ( pfW.match(1) == cmCTestMemCheckResultStrings[cc] )
+        if ( pfW.match(1) == this->ResultStrings[cc] )
           {
           failure = cc;
           break;
           }
         }
-      if ( cc == cmCTestMemCheckHandler::NO_MEMORY_FAULT )
+      if ( cc == this->ResultStrings.size() )
         {
         cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown Purify memory fault: "
           << pfW.match(1) << std::endl);
@@ -653,9 +908,9 @@
           << std::endl;
         }
       }
-    if ( failure != NO_MEMORY_FAULT )
+    if ( failure != this->ResultStrings.size() )
       {
-      ostr << "<b>" << cmCTestMemCheckResultStrings[failure] << "</b> ";
+      ostr << "<b>" <<  this->ResultStrings[failure] << "</b> ";
       results[failure] ++;
       defects ++;
       }
@@ -673,7 +928,7 @@
 //----------------------------------------------------------------------
 bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
   const std::string& str, std::string& log,
-  int* results)
+  std::vector<int>& results)
 {
   std::vector<std::string> lines;
   cmSystemTools::Split(str.c_str(), lines);
@@ -728,7 +983,6 @@
   double sttime = cmSystemTools::GetTime();
   cmCTestLog(this->CTest, DEBUG, "Start test: " << lines.size() << std::endl);
   std::string::size_type totalOutputSize = 0;
-  bool outputFull = false;
   for ( cc = 0; cc < lines.size(); cc ++ )
     {
     cmCTestLog(this->CTest, DEBUG, "test line "
@@ -802,7 +1056,7 @@
 
       if ( failure != cmCTestMemCheckHandler::NO_MEMORY_FAULT )
         {
-        ostr << "<b>" << cmCTestMemCheckResultStrings[failure] << "</b> ";
+        ostr << "<b>" << this->ResultStrings[failure] << "</b> ";
         results[failure] ++;
         defects ++;
         }
@@ -815,32 +1069,30 @@
       }
     }
   // Now put all all the non valgrind output into the test output
-  if(!outputFull)
+  // This should be last in case it gets truncated by the output
+  // limiting code
+  for(std::vector<std::string::size_type>::iterator i =
+        nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i)
     {
-    for(std::vector<std::string::size_type>::iterator i =
-          nonValGrindOutput.begin(); i != nonValGrindOutput.end(); ++i)
+    totalOutputSize += lines[*i].size();
+    cmCTestLog(this->CTest, DEBUG, "before xml safe "
+               << lines[*i] << std::endl);
+    cmCTestLog(this->CTest, DEBUG, "after  xml safe "
+               <<  cmXMLSafe(lines[*i]) << std::endl);
+    ostr << cmXMLSafe(lines[*i]) << std::endl;
+    if(!unlimitedOutput && totalOutputSize >
+       static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
       {
-      totalOutputSize += lines[*i].size();
-      cmCTestLog(this->CTest, DEBUG, "before xml safe "
-                 << lines[*i] << std::endl);
-      cmCTestLog(this->CTest, DEBUG, "after  xml safe "
-                 <<  cmXMLSafe(lines[*i]) << std::endl);
-
-      ostr << cmXMLSafe(lines[*i]) << std::endl;
-      if(!unlimitedOutput && totalOutputSize >
-         static_cast<size_t>(this->CustomMaximumFailedTestOutputSize))
-        {
-        outputFull = true;
-        ostr << "....\n";
-        ostr << "Test Output