Browse Source

Merge branch 'master' into revise-compiler-id-policies

Brad King 11 years ago
parent
commit
8018fcca6e
100 changed files with 1390 additions and 496 deletions
  1. 174 164
      CMakeLists.txt
  2. 0 5
      CTestConfig.cmake
  3. 3 0
      CTestCustom.cmake.in
  4. 0 3
      CTestCustom.ctest.in
  5. 4 0
      Help/command/add_custom_command.rst
  6. 6 6
      Help/manual/cmake-developer.7.rst
  7. 1 0
      Help/manual/cmake-modules.7.rst
  8. 4 0
      Help/manual/cmake-properties.7.rst
  9. 1 1
      Help/manual/cmake-qt.7.rst
  10. 2 0
      Help/manual/cmake-variables.7.rst
  11. 1 0
      Help/module/FindOpenCL.rst
  12. 11 0
      Help/prop_tgt/COMPILE_PDB_NAME.rst
  13. 10 0
      Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst
  14. 8 0
      Help/prop_tgt/COMPILE_PDB_NOTE.txt
  15. 13 0
      Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst
  16. 16 0
      Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst
  17. 1 3
      Help/prop_tgt/PDB_NAME.rst
  18. 2 2
      Help/prop_tgt/PDB_NAME_CONFIG.rst
  19. 7 3
      Help/prop_tgt/PDB_NOTE.txt
  20. 1 3
      Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst
  21. 2 2
      Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst
  22. 7 0
      Help/release/dev/0-sample-topic.rst
  23. 6 0
      Help/release/dev/ExternalProject-BUILD_ALWAYS.rst
  24. 6 0
      Help/release/dev/ExternalProject-no-download-progress.rst
  25. 6 0
      Help/release/dev/FeatureSummary_combine_WHAT_values.rst
  26. 7 0
      Help/release/dev/FindGTest-AUTO-SOURCES.rst
  27. 5 0
      Help/release/dev/FindHg-WC_INFO.rst
  28. 5 0
      Help/release/dev/FindPkgConfig-PKG_CONFIG.rst
  29. 4 0
      Help/release/dev/add-FindOpenCL.rst
  30. 5 0
      Help/release/dev/add_custom_command-DEPENDS-genex.rst
  31. 6 0
      Help/release/dev/cpack-deb-compression-types.rst
  32. 5 0
      Help/release/dev/ctest-coverage-extra.rst
  33. 5 0
      Help/release/dev/ctest-intel-coverage.rst
  34. 5 0
      Help/release/dev/custom-ninja-deptypes.rst
  35. 6 0
      Help/release/dev/faster-parsers.rst
  36. 5 0
      Help/release/dev/link-libraries-response-files.rst
  37. 10 0
      Help/release/dev/msvc-compiler-pdb-files.rst
  38. 2 0
      Help/release/index.rst
  39. 8 0
      Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst
  40. 11 0
      Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst
  41. 6 3
      Help/variable/CMAKE_HOST_SYSTEM.rst
  42. 3 2
      Help/variable/CMAKE_HOST_SYSTEM_NAME.rst
  43. 3 2
      Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst
  44. 4 3
      Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst
  45. 6 5
      Help/variable/CMAKE_SYSTEM.rst
  46. 3 4
      Help/variable/CMAKE_SYSTEM_NAME.rst
  47. 3 3
      Help/variable/CMAKE_SYSTEM_PROCESSOR.rst
  48. 4 4
      Help/variable/CMAKE_SYSTEM_VERSION.rst
  49. 1 1
      Modules/CMakeCCompiler.cmake.in
  50. 13 4
      Modules/CMakeCCompilerId.c.in
  51. 1 1
      Modules/CMakeCXXCompiler.cmake.in
  52. 13 4
      Modules/CMakeCXXCompilerId.cpp.in
  53. 12 6
      Modules/CMakeCommonLanguageInclude.cmake
  54. 28 0
      Modules/CMakePlatformId.h.in
  55. 3 0
      Modules/CMakePushCheckState.cmake
  56. 12 1
      Modules/CPackDeb.cmake
  57. 16 1
      Modules/CPackWIX.cmake
  58. 10 3
      Modules/CheckCSourceCompiles.cmake
  59. 10 3
      Modules/CheckCSourceRuns.cmake
  60. 10 3
      Modules/CheckCXXSourceCompiles.cmake
  61. 10 3
      Modules/CheckCXXSourceRuns.cmake
  62. 1 0
      Modules/CheckCXXSymbolExists.cmake
  63. 10 3
      Modules/CheckFunctionExists.cmake
  64. 10 3
      Modules/CheckIncludeFile.cmake
  65. 10 3
      Modules/CheckIncludeFileCXX.cmake
  66. 10 3
      Modules/CheckIncludeFiles.cmake
  67. 10 3
      Modules/CheckLibraryExists.cmake
  68. 7 2
      Modules/CheckPrototypeDefinition.cmake
  69. 1 0
      Modules/CheckStructHasMember.cmake
  70. 10 3
      Modules/CheckSymbolExists.cmake
  71. 20 6
      Modules/CheckTypeSize.cmake
  72. 10 3
      Modules/CheckVariableExists.cmake
  73. 121 10
      Modules/ExternalProject.cmake
  74. 41 17
      Modules/FeatureSummary.cmake
  75. 4 0
      Modules/FindBLAS.cmake
  76. 4 0
      Modules/FindBZip2.cmake
  77. 1 0
      Modules/FindBacktrace.cmake
  78. 2 1
      Modules/FindBoost.cmake
  79. 1 1
      Modules/FindCUDA.cmake
  80. 4 0
      Modules/FindCups.cmake
  81. 4 0
      Modules/FindCurses.cmake
  82. 2 2
      Modules/FindFreetype.cmake
  83. 1 0
      Modules/FindGIF.cmake
  84. 6 2
      Modules/FindGTest.cmake
  85. 36 1
      Modules/FindHg.cmake
  86. 5 0
      Modules/FindLAPACK.cmake
  87. 3 0
      Modules/FindLibLZMA.cmake
  88. 135 0
      Modules/FindOpenCL.cmake
  89. 10 2
      Modules/FindOpenMP.cmake
  90. 281 139
      Modules/FindPkgConfig.cmake
  91. 18 9
      Modules/FindPythonInterp.cmake
  92. 12 4
      Modules/FindPythonLibs.cmake
  93. 11 9
      Modules/FindQt4.cmake
  94. 3 1
      Modules/FindSDL_image.cmake
  95. 3 1
      Modules/FindSDL_mixer.cmake
  96. 3 1
      Modules/FindSDL_net.cmake
  97. 3 1
      Modules/FindSDL_sound.cmake
  98. 3 1
      Modules/FindSDL_ttf.cmake
  99. 19 17
      Modules/FindThreads.cmake
  100. 3 0
      Modules/FindX11.cmake

+ 174 - 164
CMakeLists.txt

@@ -21,7 +21,9 @@ if(CMAKE_BOOTSTRAP)
   unset(CMAKE_BOOTSTRAP CACHE)
 endif()
 
-set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  set(CMake_BIN_DIR ${CMake_BINARY_DIR}/bin)
+endif()
 
 if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
   # Disallow architecture-specific try_run.  It may not run on the host.
@@ -34,6 +36,13 @@ if("${CMake_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
   endmacro()
 endif()
 
+# option to set the internal encoding of CMake to UTF-8
+option(CMAKE_ENCODING_UTF8 "Use UTF-8 encoding internally (experimental)." OFF)
+mark_as_advanced(CMAKE_ENCODING_UTF8)
+if(CMAKE_ENCODING_UTF8)
+  set(KWSYS_ENCODING_DEFAULT_CODEPAGE CP_UTF8)
+endif()
+
 #-----------------------------------------------------------------------
 # a macro to deal with system libraries, implemented as a macro
 # simply to improve readability of the main script
@@ -102,9 +111,11 @@ endmacro()
 
 
 
-set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
-if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW )
-  set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  set(CMAKE_BUILD_ON_VISUAL_STUDIO 0)
+  if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW )
+    set(CMAKE_BUILD_ON_VISUAL_STUDIO 1)
+  endif()
 endif()
 
 
@@ -114,29 +125,6 @@ endif()
 #-----------------------------------------------------------------------
 macro(CMAKE_SETUP_TESTING)
   if(BUILD_TESTING)
-    set(CMAKE_TEST_GENERATOR "" CACHE STRING
-      "Generator used when running tests")
-    set(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH
-      "Generator used when running tests")
-    if(NOT CMAKE_TEST_GENERATOR)
-      set(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}")
-      set(CMAKE_TEST_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
-    else()
-      set(CMAKE_TEST_DIFFERENT_GENERATOR TRUE)
-      set(CMAKE_TEST_GENERATOR_TOOLSET "")
-    endif()
-
-    # Are we testing with the MSVC compiler?
-    set(CMAKE_TEST_MSVC 0)
-    if(MSVC AND NOT CMAKE_TEST_DIFFERENT_GENERATOR)
-      set(CMAKE_TEST_MSVC 1)
-    else()
-      if("${CMAKE_TEST_GENERATOR}" MATCHES "NMake" OR
-          "${CMAKE_TEST_GENERATOR}" MATCHES "Visual Studio")
-        set(CMAKE_TEST_MSVC 1)
-      endif()
-    endif()
-
     set(CMAKE_TEST_SYSTEM_LIBRARIES 0)
     foreach(util CURL EXPAT XMLRPC ZLIB)
       if(CMAKE_USE_SYSTEM_${util})
@@ -149,9 +137,19 @@ macro(CMAKE_SETUP_TESTING)
     # the ctest from this cmake is used for testing
     # and not the ctest from the cmake building and testing
     # cmake.
-    set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
-    set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
-    set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
+    if(CMake_TEST_EXTERNAL_CMAKE)
+      set(CMAKE_CTEST_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/ctest")
+      set(CMAKE_CMAKE_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cmake")
+      set(CMAKE_CPACK_COMMAND "${CMake_TEST_EXTERNAL_CMAKE}/cpack")
+      foreach(exe cmake ctest cpack)
+        add_executable(${exe} IMPORTED)
+        set_property(TARGET ${exe} PROPERTY IMPORTED_LOCATION ${CMake_TEST_EXTERNAL_CMAKE}/${exe})
+      endforeach()
+    else()
+      set(CMAKE_CTEST_COMMAND "${CMake_BIN_DIR}/ctest")
+      set(CMAKE_CMAKE_COMMAND "${CMake_BIN_DIR}/cmake")
+      set(CMAKE_CPACK_COMMAND "${CMake_BIN_DIR}/cpack")
+    endif()
   endif()
 
   # configure some files for testing
@@ -164,8 +162,6 @@ macro(CMAKE_SETUP_TESTING)
     ${CMake_BINARY_DIR}/Modules/.NoDartCoverage)
   configure_file(${CMake_SOURCE_DIR}/CTestCustom.cmake.in
     ${CMake_BINARY_DIR}/CTestCustom.cmake @ONLY)
-  configure_file(${CMake_SOURCE_DIR}/CTestCustom.ctest.in
-    ${CMake_BINARY_DIR}/CTestCustom.ctest @ONLY)
   if(BUILD_TESTING AND DART_ROOT)
     configure_file(${CMake_SOURCE_DIR}/CMakeLogo.gif
       ${CMake_BINARY_DIR}/Testing/HTML/TestingResults/Icons/Logo.gif COPYONLY)
@@ -387,18 +383,20 @@ macro (CMAKE_BUILD_UTILITIES)
 endmacro ()
 
 #-----------------------------------------------------------------------
-if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
-  execute_process(COMMAND ${CMAKE_CXX_COMPILER}
-    ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
-    OUTPUT_VARIABLE _GXX_VERSION
-  )
-  string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
-    _GXX_VERSION_SHORT ${_GXX_VERSION})
-  if(_GXX_VERSION_SHORT EQUAL 33)
-    message(FATAL_ERROR
-      "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n"
-      "Please use GXX 4.2 or greater to build CMake on OpenBSD\n"
-      "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD")
+    execute_process(COMMAND ${CMAKE_CXX_COMPILER}
+      ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+      OUTPUT_VARIABLE _GXX_VERSION
+    )
+    string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
+      _GXX_VERSION_SHORT ${_GXX_VERSION})
+    if(_GXX_VERSION_SHORT EQUAL 33)
+      message(FATAL_ERROR
+        "GXX 3.3 on OpenBSD is known to cause CPack to Crash.\n"
+        "Please use GXX 4.2 or greater to build CMake on OpenBSD\n"
+        "${CMAKE_CXX_COMPILER} version is: ${_GXX_VERSION}")
+    endif()
   endif()
 endif()
 
@@ -417,30 +415,32 @@ include (${CMAKE_ROOT}/Modules/Dart.cmake)
 set_directory_properties(PROPERTIES
   TEST_INCLUDE_FILE "${CMake_BINARY_DIR}/Tests/EnforceConfig.cmake")
 
-# where to write the resulting executables and libraries
-set(BUILD_SHARED_LIBS OFF)
-set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
-set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
-  "Where to put the libraries for CMake")
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  # where to write the resulting executables and libraries
+  set(BUILD_SHARED_LIBS OFF)
+  set(EXECUTABLE_OUTPUT_PATH "" CACHE INTERNAL "No configurable exe dir.")
+  set(LIBRARY_OUTPUT_PATH "" CACHE INTERNAL
+    "Where to put the libraries for CMake")
 
-# The CMake executables usually do not need any rpath to run in the build or
-# install tree.
-set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
+  # The CMake executables usually do not need any rpath to run in the build or
+  # install tree.
+  set(CMAKE_SKIP_RPATH ON CACHE INTERNAL "CMake does not need RPATHs.")
 
-# Load install destinations.
-include(Source/CMakeInstallDestinations.cmake)
+  # Load install destinations.
+  include(Source/CMakeInstallDestinations.cmake)
 
-if(BUILD_TESTING)
-  include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
-endif()
+  if(BUILD_TESTING)
+    include(${CMake_SOURCE_DIR}/Tests/CMakeInstall.cmake)
+  endif()
 
-# include special compile flags for some compilers
-include(CompileFlags.cmake)
+  # include special compile flags for some compilers
+  include(CompileFlags.cmake)
 
-# no clue why we are testing for this here
-include(CheckSymbolExists)
-CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
-CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
+  # no clue why we are testing for this here
+  include(CheckSymbolExists)
+  CHECK_SYMBOL_EXISTS(unsetenv "stdlib.h" HAVE_UNSETENV)
+  CHECK_SYMBOL_EXISTS(environ "stdlib.h" HAVE_ENVIRON_NOT_REQUIRE_PROTOTYPE)
+endif()
 
 # CMAKE_TESTS_CDASH_SERVER: CDash server used by CMake/Tests.
 #
@@ -459,69 +459,72 @@ if("x${CMAKE_TESTS_CDASH_SERVER}" STREQUAL "x")
   set(CMAKE_TESTS_CDASH_SERVER "http://www.cdash.org/CDash")
 endif()
 
-# build the utilities (a macro defined in this file)
-CMAKE_BUILD_UTILITIES()
-
-# On NetBSD ncurses is required, since curses doesn't have the wsyncup()
-# function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
-# which isn't in the default linker search path. So without RPATH ccmake
-# doesn't run and the build doesn't succeed since ccmake is executed for
-# generating the documentation.
-if(BUILD_CursesDialog)
-  get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
-  set(CURSES_NEED_RPATH FALSE)
-  if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
-    set(CURSES_NEED_RPATH TRUE)
-  endif()
-endif()
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  # build the utilities (a macro defined in this file)
+  CMAKE_BUILD_UTILITIES()
 
-if(BUILD_QtDialog)
-  if(APPLE)
-    set(CMAKE_BUNDLE_VERSION
-      "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
-    set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
-    # make sure CMAKE_INSTALL_PREFIX ends in /
-    string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
-    math(EXPR LEN "${LEN} -1" )
-    string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
-    if(NOT "${ENDCH}" STREQUAL "/")
-      set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
+  # On NetBSD ncurses is required, since curses doesn't have the wsyncup()
+  # function. ncurses is installed via pkgsrc, so the library is in /usr/pkg/lib,
+  # which isn't in the default linker search path. So without RPATH ccmake
+  # doesn't run and the build doesn't succeed since ccmake is executed for
+  # generating the documentation.
+  if(BUILD_CursesDialog)
+    get_filename_component(_CURSES_DIR "${CURSES_LIBRARY}" PATH)
+    set(CURSES_NEED_RPATH FALSE)
+    if(NOT "${_CURSES_DIR}" STREQUAL "/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib" AND NOT "${_CURSES_DIR}" STREQUAL "/lib64" AND NOT "${_CURSES_DIR}" STREQUAL "/usr/lib64")
+      set(CURSES_NEED_RPATH TRUE)
     endif()
-    set(CMAKE_INSTALL_PREFIX
-      "${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
   endif()
 
-  set(QT_NEED_RPATH FALSE)
-  if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
-    set(QT_NEED_RPATH TRUE)
+  if(BUILD_QtDialog)
+    if(APPLE)
+      set(CMAKE_BUNDLE_VERSION
+        "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}.${CMake_VERSION_PATCH}")
+      set(CMAKE_BUNDLE_LOCATION "${CMAKE_INSTALL_PREFIX}")
+      # make sure CMAKE_INSTALL_PREFIX ends in /
+      string(LENGTH "${CMAKE_INSTALL_PREFIX}" LEN)
+      math(EXPR LEN "${LEN} -1" )
+      string(SUBSTRING "${CMAKE_INSTALL_PREFIX}" ${LEN} 1 ENDCH)
+      if(NOT "${ENDCH}" STREQUAL "/")
+        set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/")
+      endif()
+      set(CMAKE_INSTALL_PREFIX
+        "${CMAKE_INSTALL_PREFIX}CMake.app/Contents")
+    endif()
+
+    set(QT_NEED_RPATH FALSE)
+    if(NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/lib64" AND NOT "${QT_LIBRARY_DIR}" STREQUAL "/usr/lib64")
+      set(QT_NEED_RPATH TRUE)
+    endif()
   endif()
-endif()
 
 
-# The same might be true on other systems for other libraries.
-# Then only enable RPATH if we have are building at least with cmake 2.4,
-# since this one has much better RPATH features than cmake 2.2.
-# The executables are then built with the RPATH for the libraries outside
-# the build tree, which is both the build and the install RPATH.
-if (UNIX)
-  if(   CMAKE_USE_SYSTEM_CURL   OR  CMAKE_USE_SYSTEM_ZLIB
-        OR  CMAKE_USE_SYSTEM_EXPAT  OR  CTEST_USE_XMLRPC  OR  CURSES_NEED_RPATH  OR  QT_NEED_RPATH)
-    set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
-    set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-    set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-  endif()
-endif ()
+  # The same might be true on other systems for other libraries.
+  # Then only enable RPATH if we have are building at least with cmake 2.4,
+  # since this one has much better RPATH features than cmake 2.2.
+  # The executables are then built with the RPATH for the libraries outside
+  # the build tree, which is both the build and the install RPATH.
+  if (UNIX)
+    if(   CMAKE_USE_SYSTEM_CURL   OR  CMAKE_USE_SYSTEM_ZLIB
+          OR  CMAKE_USE_SYSTEM_EXPAT  OR  CTEST_USE_XMLRPC  OR  CURSES_NEED_RPATH  OR  QT_NEED_RPATH)
+      set(CMAKE_SKIP_RPATH OFF CACHE INTERNAL "CMake built with RPATH.")
+      set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+      set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
+    endif()
+  endif ()
 
 
-# add the uninstall support
-configure_file(
-  "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
-  "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
-  @ONLY)
-add_custom_target(uninstall
-  "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
+  # add the uninstall support
+  configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    @ONLY)
+  add_custom_target(uninstall
+    "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
 
-include (CMakeCPack.cmake)
+  include (CMakeCPack.cmake)
+
+endif()
 
 # setup some Testing support (a macro defined in this file)
 CMAKE_SETUP_TESTING()
@@ -530,62 +533,69 @@ configure_file(
   "${CMAKE_CURRENT_BINARY_DIR}/DartLocal.conf"
   COPYONLY)
 
-if(NOT CMake_VERSION_IS_RELEASE)
-  if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
-      NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
-    set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
-                     -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
-                     -Wmissing-format-attribute -fno-common -Wundef
-    )
-    set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
-                       -Wshadow -Wpointer-arith -Wformat-security -Wundef
-    )
-
-    foreach(FLAG_LANG  C CXX)
-      foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
-        if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
-          set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
-        endif()
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  if(NOT CMake_VERSION_IS_RELEASE)
+    if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
+        NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
+      set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
+                       -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
+                       -Wmissing-format-attribute -fno-common -Wundef
+      )
+      set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
+                         -Wshadow -Wpointer-arith -Wformat-security -Wundef
+      )
+
+      foreach(FLAG_LANG  C CXX)
+        foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
+          if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
+            set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
+          endif()
+        endforeach()
       endforeach()
-    endforeach()
 
-    unset(C_FLAGS_LIST)
-    unset(CXX_FLAGS_LIST)
+      unset(C_FLAGS_LIST)
+      unset(CXX_FLAGS_LIST)
+    endif()
   endif()
+
+  # build the remaining subdirectories
+  add_subdirectory(Source)
+  add_subdirectory(Utilities)
 endif()
 
-# build the remaining subdirectories
-add_subdirectory(Source)
-add_subdirectory(Utilities)
 add_subdirectory(Tests)
 
-if(BUILD_TESTING)
-  CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
-endif()
-CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
-if(TARGET documentation)
-  CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  if(BUILD_TESTING)
+    CMAKE_SET_TARGET_FOLDER(CMakeLibTests "Tests")
+  endif()
+  CMAKE_SET_TARGET_FOLDER(cmw9xcom "Utilities/Win9xCompat")
+  if(TARGET documentation)
+    CMAKE_SET_TARGET_FOLDER(documentation "Documentation")
+  endif()
 endif()
 
 # add a test
 add_test(SystemInformationNew "${CMAKE_CMAKE_COMMAND}"
-  --system-information  -G "${CMAKE_TEST_GENERATOR}" )
-
-# Install license file as it requires.
-install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
-
-# Install script directories.
-install(
-  DIRECTORY Help Modules Templates
-  DESTINATION ${CMAKE_DATA_DIR}
-  FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
-  DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
-                        GROUP_READ GROUP_EXECUTE
-                        WORLD_READ WORLD_EXECUTE
-  PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
-                              GROUP_READ GROUP_EXECUTE
-                              WORLD_READ WORLD_EXECUTE
-  )
-
-# Install auxiliary files integrating with other tools.
-add_subdirectory(Auxiliary)
+  --system-information  -G "${CMAKE_GENERATOR}" )
+
+if(NOT CMake_TEST_EXTERNAL_CMAKE)
+  # Install license file as it requires.
+  install(FILES Copyright.txt DESTINATION ${CMAKE_DOC_DIR})
+
+  # Install script directories.
+  install(
+    DIRECTORY Help Modules Templates
+    DESTINATION ${CMAKE_DATA_DIR}
+    FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+    DIRECTORY_PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
+                          GROUP_READ GROUP_EXECUTE
+                          WORLD_READ WORLD_EXECUTE
+    PATTERN "*.sh*" PERMISSIONS OWNER_READ OWNER_EXECUTE OWNER_WRITE
+                                GROUP_READ GROUP_EXECUTE
+                                WORLD_READ WORLD_EXECUTE
+    )
+
+  # Install auxiliary files integrating with other tools.
+  add_subdirectory(Auxiliary)
+endif()

+ 0 - 5
CTestConfig.cmake

@@ -18,8 +18,3 @@ set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake")
 set(CTEST_DROP_SITE_CDASH TRUE)
 set(CTEST_CDASH_VERSION "1.6")
 set(CTEST_CDASH_QUERY_VERSION TRUE)
-
-# use old trigger stuff so that cmake 2.4 and below will not
-# get errors on trigger
-set (TRIGGER_SITE
-  "http://public.kitware.com/cgi-bin/Submit-CMake-TestingResults.cgi")

+ 3 - 0
CTestCustom.cmake.in

@@ -39,6 +39,8 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
   "Warning: public.*BZ2_bz.*in module.*bzlib.*clashes with prior module.*bzlib.*"
   "Warning: public.*_archive.*clashes with prior module.*"
   "Warning: LINN32: Last line.*is less.*"
+  "Warning: Olimit was exceeded on function.*"
+  "Warning: To override Olimit for all functions in file.*"
   "warning.*directory name.*CMake-Xcode.*/bin/.*does not exist.*"
   "stl_deque.h:1051"
   "(Lexer|Parser).*warning.*conversion.*may (alter its value|change the sign)"
@@ -52,6 +54,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
   "ld: warning: directory not found for option .-(F|L)"
   "warning.*This version of Mac OS X is unsupported"
   "clang.*: warning: argument unused during compilation: .-g"
+  "note: in expansion of macro" # diagnostic context note
 
   # Ignore clang's summary warning, assuming prior text has matched some
   # other warning expression:

+ 0 - 3
CTestCustom.ctest.in

@@ -1,3 +0,0 @@
-# This file is provided for compatibility with CMake 2.2 and lower.
-# Just include the custom file by its new name.
-INCLUDE("CTestCustom.cmake")

+ 4 - 0
Help/command/add_custom_command.rst

@@ -156,3 +156,7 @@ 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.

+ 6 - 6
Help/manual/cmake-developer.7.rst

@@ -55,7 +55,7 @@ used in a comparison with the iterator returned by ``end()``:
 
 .. code-block:: c++
 
-  const std::set<cmStdString>& someSet = getSet();
+  const std::set<std::string>& someSet = getSet();
   if (someSet.find("needle") == someSet.end()) // Wrong
     {
     // ...
@@ -66,8 +66,8 @@ The return value of ``find()`` must be assigned to an intermediate
 
 .. code-block:: c++
 
-  const std::set<cmStdString>& someSet;
-  const std::set<cmStdString>::const_iterator i = someSet.find("needle");
+  const std::set<std::string>& someSet;
+  const std::set<std::string>::const_iterator i = someSet.find("needle");
   if (i != propSet.end()) // Ok
     {
     // ...
@@ -110,7 +110,7 @@ conversion is not allowed:
 
 .. code-block:: c++
 
-  std::set<cmStdString> theSet;
+  std::set<const char*> theSet;
   std::vector<std::string> theVector;
   theVector.insert(theVector.end(), theSet.begin(), theSet.end()); // Wrong
 
@@ -118,9 +118,9 @@ A loop must be used instead:
 
 .. code-block:: c++
 
-  std::set<cmStdString> theSet;
+  std::set<const char*> theSet;
   std::vector<std::string> theVector;
-  for(std::set<cmStdString>::iterator li = theSet.begin();
+  for(std::set<const char*>::iterator li = theSet.begin();
       li != theSet.end(); ++li)
     {
     theVector.push_back(*li);

+ 1 - 0
Help/manual/cmake-modules.7.rst

@@ -138,6 +138,7 @@ All Modules
    /module/FindMPEG
    /module/FindMPI
    /module/FindOpenAL
+   /module/FindOpenCL
    /module/FindOpenGL
    /module/FindOpenMP
    /module/FindOpenSceneGraph

+ 4 - 0
Help/manual/cmake-properties.7.rst

@@ -100,6 +100,10 @@ Properties on Targets
    /prop_tgt/COMPILE_DEFINITIONS
    /prop_tgt/COMPILE_FLAGS
    /prop_tgt/COMPILE_OPTIONS
+   /prop_tgt/COMPILE_PDB_NAME
+   /prop_tgt/COMPILE_PDB_NAME_CONFIG
+   /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY
+   /prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
    /prop_tgt/CONFIG_OUTPUT_NAME
    /prop_tgt/CONFIG_POSTFIX
    /prop_tgt/DEBUG_POSTFIX

+ 1 - 1
Help/manual/cmake-qt.7.rst

@@ -173,7 +173,7 @@ The Qt 4 and 5 :prop_tgt:`IMPORTED` targets for the QtGui libraries specify
 that the qtmain.lib static library shipped with Qt will be linked by all
 dependent executables which have the :prop_tgt:`WIN32_EXECUTABLE` enabled.
 
-Do disable this behavior, enable the ``Qt5_NO_LINK_QTMAIN`` target property for
+To disable this behavior, enable the ``Qt5_NO_LINK_QTMAIN`` target property for
 Qt 5 based targets or ``QT4_NO_LINK_QTMAIN`` target property for Qt 4 based
 targets.
 

+ 2 - 0
Help/manual/cmake-variables.7.rst

@@ -201,6 +201,8 @@ Variables that Control the Build
    /variable/CMAKE_AUTOUIC
    /variable/CMAKE_AUTOUIC_OPTIONS
    /variable/CMAKE_BUILD_WITH_INSTALL_RPATH
+   /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
+   /variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG
    /variable/CMAKE_CONFIG_POSTFIX
    /variable/CMAKE_DEBUG_POSTFIX
    /variable/CMAKE_EXE_LINKER_FLAGS_CONFIG

+ 1 - 0
Help/module/FindOpenCL.rst

@@ -0,0 +1 @@
+.. cmake-module:: ../../Modules/FindOpenCL.cmake

+ 11 - 0
Help/prop_tgt/COMPILE_PDB_NAME.rst

@@ -0,0 +1,11 @@
+COMPILE_PDB_NAME
+----------------
+
+Output name for the MS debug symbol ``.pdb`` file generated by the
+compiler while building source files.
+
+This property specifies the base name for the debug symbols file.
+If not set, the default is unspecified.
+
+.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME`
+.. include:: COMPILE_PDB_NOTE.txt

+ 10 - 0
Help/prop_tgt/COMPILE_PDB_NAME_CONFIG.rst

@@ -0,0 +1,10 @@
+COMPILE_PDB_NAME_<CONFIG>
+-------------------------
+
+Per-configuration output name for the MS debug symbol ``.pdb`` file
+generated by the compiler while building source files.
+
+This is the configuration-specific version of :prop_tgt:`COMPILE_PDB_NAME`.
+
+.. |PDB_XXX| replace:: :prop_tgt:`PDB_NAME_<CONFIG>`
+.. include:: COMPILE_PDB_NOTE.txt

+ 8 - 0
Help/prop_tgt/COMPILE_PDB_NOTE.txt

@@ -0,0 +1,8 @@
+.. note::
+ The compiler-generated program database files are specified by the
+ ``/Fd`` compiler flag and are not the same as linker-generated
+ program database files specified by the ``/pdb`` linker flag.
+ Use the |PDB_XXX| property to specify the latter.
+
+ This property is not implemented by the :generator:`Visual Studio 6`
+ generator.

+ 13 - 0
Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY.rst

@@ -0,0 +1,13 @@
+COMPILE_PDB_OUTPUT_DIRECTORY
+----------------------------
+
+Output directory for the MS debug symbol ``.pdb`` file
+generated by the compiler while building source files.
+
+This property specifies the directory into which the MS debug symbols
+will be placed by the compiler.  This property is initialized by the
+value of the :variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY` variable
+if it is set when a target is created.
+
+.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY`
+.. include:: COMPILE_PDB_NOTE.txt

+ 16 - 0
Help/prop_tgt/COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst

@@ -0,0 +1,16 @@
+COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
+-------------------------------------
+
+Per-configuration output directory for the MS debug symbol ``.pdb`` file
+generated by the compiler while building source files.
+
+This is a per-configuration version of
+:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`,
+but multi-configuration generators (VS, Xcode) do NOT append a
+per-configuration subdirectory to the specified directory.  This
+property is initialized by the value of the
+:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable
+if it is set when a target is created.
+
+.. |PDB_XXX| replace:: :prop_tgt:`PDB_OUTPUT_DIRECTORY_<CONFIG>`
+.. include:: COMPILE_PDB_NOTE.txt

+ 1 - 3
Help/prop_tgt/PDB_NAME.rst

@@ -7,7 +7,5 @@ linker for an executable or shared library target.
 This property specifies the base name for the debug symbols file.
 If not set, the logical target name is used by default.
 
+.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME`
 .. include:: PDB_NOTE.txt
-
-This property is not implemented by the :generator:`Visual Studio 6`
-generator.

+ 2 - 2
Help/prop_tgt/PDB_NAME_CONFIG.rst

@@ -6,5 +6,5 @@ generated by the linker for an executable or shared library target.
 
 This is the configuration-specific version of :prop_tgt:`PDB_NAME`.
 
-This property is not implemented by the :generator:`Visual Studio 6`
-generator.
+.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_NAME_<CONFIG>`
+.. include:: PDB_NOTE.txt

+ 7 - 3
Help/prop_tgt/PDB_NOTE.txt

@@ -3,6 +3,10 @@
  is invoked to produce them so they have no linker-generated ``.pdb`` file
  containing debug symbols.
 
- The compiler-generated program database files specified by the MSVC
- ``/Fd`` flag are not the same as linker-generated program database
- files and so are not influenced by this property.
+ The linker-generated program database files are specified by the
+ ``/pdb`` linker flag and are not the same as compiler-generated
+ program database files specified by the ``/Fd`` compiler flag.
+ Use the |COMPILE_PDB_XXX| property to specify the latter.
+
+ This property is not implemented by the :generator:`Visual Studio 6`
+ generator.

+ 1 - 3
Help/prop_tgt/PDB_OUTPUT_DIRECTORY.rst

@@ -9,7 +9,5 @@ will be placed by the linker.  This property is initialized by the
 value of the :variable:`CMAKE_PDB_OUTPUT_DIRECTORY` variable if it is
 set when a target is created.
 
+.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY`
 .. include:: PDB_NOTE.txt
-
-This property is not implemented by the :generator:`Visual Studio 6`
-generator.

+ 2 - 2
Help/prop_tgt/PDB_OUTPUT_DIRECTORY_CONFIG.rst

@@ -11,5 +11,5 @@ property is initialized by the value of the
 :variable:`CMAKE_PDB_OUTPUT_DIRECTORY_<CONFIG>` variable if it is
 set when a target is created.
 
-This property is not implemented by the :generator:`Visual Studio 6`
-generator.
+.. |COMPILE_PDB_XXX| replace:: :prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
+.. include:: PDB_NOTE.txt

+ 7 - 0
Help/release/dev/0-sample-topic.rst

@@ -0,0 +1,7 @@
+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.

+ 6 - 0
Help/release/dev/ExternalProject-BUILD_ALWAYS.rst

@@ -0,0 +1,6 @@
+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.

+ 6 - 0
Help/release/dev/ExternalProject-no-download-progress.rst

@@ -0,0 +1,6 @@
+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.

+ 6 - 0
Help/release/dev/FeatureSummary_combine_WHAT_values.rst

@@ -0,0 +1,6 @@
+FeatureSummary_combine_WHAT_values
+----------------------------------
+
+* The :module:`FeatureSummary` module ``feature_summary`` API
+  learned to accept multiple values for the ``WHAT`` option and
+  combine them appropriately.

+ 7 - 0
Help/release/dev/FindGTest-AUTO-SOURCES.rst

@@ -0,0 +1,7 @@
+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.

+ 5 - 0
Help/release/dev/FindHg-WC_INFO.rst

@@ -0,0 +1,5 @@
+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.

+ 5 - 0
Help/release/dev/FindPkgConfig-PKG_CONFIG.rst

@@ -0,0 +1,5 @@
+FindPkgConfig-PKG_CONFIG
+------------------------
+
+* The :module:`FindPkgConfig` module learned to use the ``PKG_CONFIG``
+  environment variable value as the ``pkg-config`` executable, if set.

+ 4 - 0
Help/release/dev/add-FindOpenCL.rst

@@ -0,0 +1,4 @@
+add-FindOpenCL
+--------------
+
+* The :module:`FindOpenCL` module was introduced.

+ 5 - 0
Help/release/dev/add_custom_command-DEPENDS-genex.rst

@@ -0,0 +1,5 @@
+add_custom_command-DEPENDS-genex
+--------------------------------
+
+* The :command:`add_custom_command` command learned to interpret
+  :manual:`cmake-generator-expressions(7)` in arguments to ``DEPENDS``.

+ 6 - 0
Help/release/dev/cpack-deb-compression-types.rst

@@ -0,0 +1,6 @@
+cpack-deb-compression-types
+---------------------------
+
+* The :module:`CPackDeb` module learned a new
+  :variable:`CPACK_DEBIAN_COMPRESSION_TYPE` variable to set the
+  tarball compression type.

+ 5 - 0
Help/release/dev/ctest-coverage-extra.rst

@@ -0,0 +1,5 @@
+ctest-coverage-extra
+--------------------
+
+* The :command:`ctest_coverage` command learned to read variable
+  ``CTEST_COVERAGE_EXTRA_FLAGS`` to set ``CoverageExtraFlags``.

+ 5 - 0
Help/release/dev/ctest-intel-coverage.rst

@@ -0,0 +1,5 @@
+ctest-intel-coverage
+--------------------
+
+* The :command:`ctest_coverage` command learned to support
+  Intel coverage files with the ``codecov`` tool.

+ 5 - 0
Help/release/dev/custom-ninja-deptypes.rst

@@ -0,0 +1,5 @@
+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.

+ 6 - 0
Help/release/dev/faster-parsers.rst

@@ -0,0 +1,6 @@
+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.

+ 5 - 0
Help/release/dev/link-libraries-response-files.rst

@@ -0,0 +1,5 @@
+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.

+ 10 - 0
Help/release/dev/msvc-compiler-pdb-files.rst

@@ -0,0 +1,10 @@
+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``).

+ 2 - 0
Help/release/index.rst

@@ -5,6 +5,8 @@ CMake Release Notes
   This file should include the adjacent "dev.txt" file
   in development versions but not in release versions.
 
+.. include:: dev.txt
+
 Releases
 ========
 

+ 8 - 0
Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY.rst

@@ -0,0 +1,8 @@
+CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY
+----------------------------------
+
+Output directory for MS debug symbol ``.pdb`` files
+generated by the compiler while building source files.
+
+This variable is used to initialize the
+:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY` property on all the targets.

+ 11 - 0
Help/variable/CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_CONFIG.rst

@@ -0,0 +1,11 @@
+CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>
+-------------------------------------------
+
+Per-configuration output directory for MS debug symbol ``.pdb`` files
+generated by the compiler while building source files.
+
+This is a per-configuration version of
+:variable:`CMAKE_COMPILE_PDB_OUTPUT_DIRECTORY`.
+This variable is used to initialize the
+:prop_tgt:`COMPILE_PDB_OUTPUT_DIRECTORY_<CONFIG>`
+property on all the targets.

+ 6 - 3
Help/variable/CMAKE_HOST_SYSTEM.rst

@@ -1,7 +1,10 @@
 CMAKE_HOST_SYSTEM
 -----------------
 
-Name of system cmake is being run on.
+Composit Name of OS CMake is being run on.
 
-The same as CMAKE_SYSTEM but for the host system instead of the target
-system when cross compiling.
+This variable is the composite of :variable:`CMAKE_HOST_SYSTEM_NAME` and
+:variable:`CMAKE_HOST_SYSTEM_VERSION`, e.g.
+``${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_VERSION}``.  If
+:variable:`CMAKE_HOST_SYSTEM_VERSION` is not set, then this variable is
+the same as :variable:`CMAKE_HOST_SYSTEM_NAME`.

+ 3 - 2
Help/variable/CMAKE_HOST_SYSTEM_NAME.rst

@@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_NAME
 
 Name of the OS CMake is running on.
 
-The same as CMAKE_SYSTEM_NAME but for the host system instead of the
-target system when cross compiling.
+On systems that have the uname command, this variable is set to the
+output of uname -s.  ``Linux``, ``Windows``, and ``Darwin`` for Mac OS X
+are the values found on the big three operating systems.

+ 3 - 2
Help/variable/CMAKE_HOST_SYSTEM_PROCESSOR.rst

@@ -3,5 +3,6 @@ CMAKE_HOST_SYSTEM_PROCESSOR
 
 The name of the CPU CMake is running on.
 
-The same as CMAKE_SYSTEM_PROCESSOR but for the host system instead of
-the target system when cross compiling.
+On systems that support uname, this variable is set to the output of
+uname -p, on windows it is set to the value of the environment variable
+``PROCESSOR_ARCHITECTURE``.

+ 4 - 3
Help/variable/CMAKE_HOST_SYSTEM_VERSION.rst

@@ -1,7 +1,8 @@
 CMAKE_HOST_SYSTEM_VERSION
 -------------------------
 
-OS version CMake is running on.
+The OS version CMake is running on.
 
-The same as CMAKE_SYSTEM_VERSION but for the host system instead of
-the target system when cross compiling.
+A numeric version string for the system.  On systems that support
+uname, this variable is set to the output of uname -r. On other
+systems this is set to major-minor version numbers.

+ 6 - 5
Help/variable/CMAKE_SYSTEM.rst

@@ -1,9 +1,10 @@
 CMAKE_SYSTEM
 ------------
 
-Name of system cmake is compiling for.
+Composit Name of OS CMake is compiling for.
 
-This variable is the composite of CMAKE_SYSTEM_NAME and
-CMAKE_SYSTEM_VERSION, like this
-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}.  If CMAKE_SYSTEM_VERSION
-is not set, then CMAKE_SYSTEM is the same as CMAKE_SYSTEM_NAME.
+This variable is the composite of :variable:`CMAKE_SYSTEM_NAME` and
+:variable:`CMAKE_SYSTEM_VERSION`, e.g.
+``${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_VERSION}``.  If
+:variable:`CMAKE_SYSTEM_VERSION` is not set, then this variable is
+the same as :variable:`CMAKE_SYSTEM_NAME`.

+ 3 - 4
Help/variable/CMAKE_SYSTEM_NAME.rst

@@ -3,7 +3,6 @@ CMAKE_SYSTEM_NAME
 
 Name of the OS CMake is building for.
 
-This is the name of the operating system on which CMake is targeting.
-On systems that have the uname command, this variable is set to the
-output of uname -s.  Linux, Windows, and Darwin for Mac OS X are the
-values found on the big three operating systems.
+This is the name of the OS on which CMake is targeting.  This variable
+is the same as :variable:`CMAKE_HOST_SYSTEM_NAME` if you build for the
+host system instead of the target system when cross compiling.

+ 3 - 3
Help/variable/CMAKE_SYSTEM_PROCESSOR.rst

@@ -3,6 +3,6 @@ CMAKE_SYSTEM_PROCESSOR
 
 The name of the CPU CMake is building for.
 
-On systems that support uname, this variable is set to the output of
-uname -p, on windows it is set to the value of the environment
-variable PROCESSOR_ARCHITECTURE
+This variable is the same as :variable:`CMAKE_HOST_SYSTEM_PROCESSOR` if
+you build for the host system instead of the target system when
+cross compiling.

+ 4 - 4
Help/variable/CMAKE_SYSTEM_VERSION.rst

@@ -1,8 +1,8 @@
 CMAKE_SYSTEM_VERSION
 --------------------
 
-OS version CMake is building for.
+The OS version CMake is building for.
 
-A numeric version string for the system, on systems that support
-uname, this variable is set to the output of uname -r.  On other
-systems this is set to major-minor version numbers.
+This variable is the same as :variable:`CMAKE_HOST_SYSTEM_VERSION` if
+you build for the host system instead of the target system when
+cross compiling.

+ 1 - 1
Modules/CMakeCCompiler.cmake.in

@@ -26,7 +26,7 @@ if(CMAKE_COMPILER_IS_MINGW)
   set(MINGW 1)
 endif()
 set(CMAKE_C_COMPILER_ID_RUN 1)
-set(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
+set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
 set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
 set(CMAKE_C_LINKER_PREFERENCE 10)
 

+ 13 - 4
Modules/CMakeCCompilerId.c.in

@@ -68,10 +68,19 @@
 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
 
 #elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
-  /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+# if __WATCOMC__ < 1200
+#  define COMPILER_ID "Watcom"
+   /* __WATCOMC__ = VVRP */
+#  define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# else
+#  define COMPILER_ID "OpenWatcom"
+   /* __WATCOMC__ = VVRP + 1100 */
+#  define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# endif
+# define COMPILER_VERSION_MINOR  DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
 
 #elif defined(__SUNPRO_C)
 # define COMPILER_ID "SunPro"

+ 1 - 1
Modules/CMakeCXXCompiler.cmake.in

@@ -27,7 +27,7 @@ if(CMAKE_COMPILER_IS_MINGW)
 endif()
 set(CMAKE_CXX_COMPILER_ID_RUN 1)
 set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
-set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm;CPP)
+set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
 set(CMAKE_CXX_LINKER_PREFERENCE 30)
 set(CMAKE_CXX_LINKER_PREFERENCE_PROPAGATES 1)
 

+ 13 - 4
Modules/CMakeCXXCompilerId.cpp.in

@@ -73,10 +73,19 @@
 # define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
 
 #elif defined(__WATCOMC__)
-# define COMPILER_ID "Watcom"
-  /* __WATCOMC__ = VVRR */
-# define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
-# define COMPILER_VERSION_MINOR DEC(__WATCOMC__ % 100)
+# if __WATCOMC__ < 1200
+#  define COMPILER_ID "Watcom"
+   /* __WATCOMC__ = VVRP */
+#  define COMPILER_VERSION_MAJOR DEC(__WATCOMC__ / 100)
+# else
+#  define COMPILER_ID "OpenWatcom"
+   /* __WATCOMC__ = VVRP + 1100 */
+#  define COMPILER_VERSION_MAJOR DEC((__WATCOMC__ - 1100) / 100)
+# endif
+# define COMPILER_VERSION_MINOR  DEC((__WATCOMC__ / 10) % 10)
+# if (__WATCOMC__ % 10) > 0
+#  define COMPILER_VERSION_PATCH DEC(__WATCOMC__ % 10)
+# endif
 
 #elif defined(__SUNPRO_CC)
 # define COMPILER_ID "SunPro"

+ 12 - 6
Modules/CMakeCommonLanguageInclude.cmake

@@ -16,9 +16,11 @@
 # cache values that can be initialized in the platform-compiler.cmake file
 # it may be included by more than one language.
 
-set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
-     CACHE STRING "Flags used by the linker.")
-
+if(NOT "x$ENV{LDFLAGS}" STREQUAL "x")
+  set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+  set (CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+  set (CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}")
+endif()
 
 if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
 # default build type is none
@@ -82,12 +84,17 @@ if(NOT CMAKE_NOT_USING_CONFIG_FLAGS)
      ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO_INIT} CACHE STRING
      "Flags used by the linker during Release with Debug Info builds.")
 endif()
+
+# executable linker flags
+set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS_INIT}"
+     CACHE STRING "Flags used by the linker.")
+
 # shared linker flags
-set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS_INIT}"
      CACHE STRING "Flags used by the linker during the creation of dll's.")
 
 # module linker flags
-set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}"
+set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS_INIT}"
      CACHE STRING "Flags used by the linker during the creation of modules.")
 
 # static linker flags
@@ -124,4 +131,3 @@ CMAKE_STATIC_LINKER_FLAGS_MINSIZEREL
 CMAKE_STATIC_LINKER_FLAGS_RELEASE
 CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO
 )
-

+ 28 - 0
Modules/CMakePlatformId.h.in

@@ -74,6 +74,23 @@
 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
 # define PLATFORM_ID "Xenix"
 
+#elif defined(__WATCOMC__)
+# if defined(__LINUX__)
+#  define PLATFORM_ID "Linux"
+
+# elif defined(__DOS__)
+#  define PLATFORM_ID "DOS"
+
+# elif defined(__OS2__)
+#  define PLATFORM_ID "OS2"
+
+# elif defined(__WINDOWS__)
+#  define PLATFORM_ID "Windows3x"
+
+# else /* unknown platform */
+#  define PLATFORM_ID ""
+# endif
+
 #else /* unknown platform */
 # define PLATFORM_ID ""
 
@@ -107,6 +124,17 @@
 #  define ARCHITECTURE_ID ""
 # endif
 
+#elif defined(__WATCOMC__)
+# if defined(_M_I86)
+#  define ARCHITECTURE_ID "I86"
+
+# elif defined(_M_IX86)
+#  define ARCHITECTURE_ID "X86"
+
+# else /* unknown architecture */
+#  define ARCHITECTURE_ID ""
+# endif
+
 #else
 #  define ARCHITECTURE_ID ""
 #endif

+ 3 - 0
Modules/CMakePushCheckState.cmake

@@ -53,6 +53,7 @@ macro(CMAKE_RESET_CHECK_STATE)
    set(CMAKE_REQUIRED_DEFINITIONS)
    set(CMAKE_REQUIRED_LIBRARIES)
    set(CMAKE_REQUIRED_FLAGS)
+   set(CMAKE_REQUIRED_QUIET)
 
 endmacro()
 
@@ -68,6 +69,7 @@ macro(CMAKE_PUSH_CHECK_STATE)
    set(_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER} ${CMAKE_REQUIRED_DEFINITIONS})
    set(_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}   ${CMAKE_REQUIRED_LIBRARIES})
    set(_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}       ${CMAKE_REQUIRED_FLAGS})
+   set(_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}       ${CMAKE_REQUIRED_QUIET})
 
    if (ARGC GREATER 0 AND ARGV0 STREQUAL "RESET")
       cmake_reset_check_state()
@@ -84,6 +86,7 @@ macro(CMAKE_POP_CHECK_STATE)
       set(CMAKE_REQUIRED_DEFINITIONS ${_CMAKE_REQUIRED_DEFINITIONS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
       set(CMAKE_REQUIRED_LIBRARIES   ${_CMAKE_REQUIRED_LIBRARIES_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
       set(CMAKE_REQUIRED_FLAGS       ${_CMAKE_REQUIRED_FLAGS_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
+      set(CMAKE_REQUIRED_QUIET       ${_CMAKE_REQUIRED_QUIET_SAVE_${_CMAKE_PUSH_CHECK_STATE_COUNTER}})
 
       math(EXPR _CMAKE_PUSH_CHECK_STATE_COUNTER "${_CMAKE_PUSH_CHECK_STATE_COUNTER}-1")
    endif()

+ 12 - 1
Modules/CPackDeb.cmake

@@ -67,7 +67,12 @@
 #  * Mandatory : YES
 #  * Default   : 'devel'
 #
-#  The debian package section
+# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE
+#
+#  * Mandatory : YES
+#  * Default   : 'gzip'
+#
+#     Possible values are: lzma, xz, bzip2 and gzip.
 #
 # .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY
 #
@@ -390,6 +395,12 @@ if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY)
   set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
 endif()
 
+# Compression: (recommended)
+if(NOT CPACK_DEBIAN_COMPRESSION_TYPE)
+  set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip")
+endif()
+
+
 # Recommends:
 # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS
 

+ 16 - 1
Modules/CPackWIX.cmake

@@ -216,9 +216,24 @@
 #  allow other CMake projects to find your package with
 #  the :command:`find_package` command.
 #
+# .. variable:: CPACK_WIX_PROPERTY_<PROPERTY>
+#
+#  This variable can be used to provide a value for
+#  the Windows Installer property ``<PROPERTY>``
+#
+#  The follwing list contains some example properties that can be used to
+#  customize information under
+#  "Programs and Features" (also known as "Add or Remove Programs")
+#
+#  * ARPCOMMENTS - Comments
+#  * ARPHELPLINK - Help and support information URL
+#  * ARPURLINFOABOUT - General information URL
+#  * URLUPDATEINFO - Update information URL
+#  * ARPHELPTELEPHONE - Help and support telephone number
+#  * ARPSIZE - Size (in kilobytes) of the application
 
 #=============================================================================
-# Copyright 2013 Kitware, Inc.
+# Copyright 2014 Kitware, Inc.
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.

+ 10 - 3
Modules/CheckCSourceCompiles.cmake

@@ -21,6 +21,7 @@
 #   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.
@@ -67,7 +68,9 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
     file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
       "${SOURCE}\n")
 
-    message(STATUS "Performing Test ${VAR}")
+    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.c
@@ -85,13 +88,17 @@ macro(CHECK_C_SOURCE_COMPILES SOURCE VAR)
 
     if(${VAR})
       set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      message(STATUS "Performing Test ${VAR} - Success")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
         "${OUTPUT}\n"
         "Source file was:\n${SOURCE}\n")
     else()
-      message(STATUS "Performing Test ${VAR} - Failed")
+      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 C SOURCE FILE Test ${VAR} failed with the following output:\n"

+ 10 - 3
Modules/CheckCSourceRuns.cmake

@@ -21,6 +21,7 @@
 #   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 2006-2009 Kitware, Inc.
@@ -56,7 +57,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
     file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c"
       "${SOURCE}\n")
 
-    message(STATUS "Performing Test ${VAR}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Performing Test ${VAR}")
+    endif()
     try_run(${VAR}_EXITCODE ${VAR}_COMPILED
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c
@@ -73,7 +76,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
     # if the return value was 0 then it worked
     if("${${VAR}_EXITCODE}" EQUAL 0)
       set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      message(STATUS "Performing Test ${VAR} - Success")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
         "${OUTPUT}\n"
@@ -86,7 +91,9 @@ macro(CHECK_C_SOURCE_RUNS SOURCE VAR)
         set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
       endif()
 
-      message(STATUS "Performing Test ${VAR} - Failed")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Failed")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
         "${OUTPUT}\n"

+ 10 - 3
Modules/CheckCXXSourceCompiles.cmake

@@ -21,6 +21,7 @@
 #   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.
@@ -68,7 +69,9 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
     file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
       "${SOURCE}\n")
 
-    message(STATUS "Performing Test ${VAR}")
+    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.cxx
@@ -86,13 +89,17 @@ macro(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
 
     if(${VAR})
       set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      message(STATUS "Performing Test ${VAR} - Success")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
         "${OUTPUT}\n"
         "Source file was:\n${SOURCE}\n")
     else()
-      message(STATUS "Performing Test ${VAR} - Failed")
+      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 C++ SOURCE FILE Test ${VAR} failed with the following output:\n"

+ 10 - 3
Modules/CheckCXXSourceRuns.cmake

@@ -21,6 +21,7 @@
 #   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 2006-2009 Kitware, Inc.
@@ -56,7 +57,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
     file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx"
       "${SOURCE}\n")
 
-    message(STATUS "Performing Test ${VAR}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Performing Test ${VAR}")
+    endif()
     try_run(${VAR}_EXITCODE ${VAR}_COMPILED
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx
@@ -74,7 +77,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
     # if the return value was 0 then it worked
     if("${${VAR}_EXITCODE}" EQUAL 0)
       set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
-      message(STATUS "Performing Test ${VAR} - Success")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Success")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Performing C++ SOURCE FILE Test ${VAR} succeded with the following output:\n"
         "${OUTPUT}\n"
@@ -87,7 +92,9 @@ macro(CHECK_CXX_SOURCE_RUNS SOURCE VAR)
         set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
       endif()
 
-      message(STATUS "Performing Test ${VAR} - Failed")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Performing Test ${VAR} - Failed")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Performing C++ SOURCE FILE Test ${VAR} failed with the following output:\n"
         "${OUTPUT}\n"

+ 1 - 0
Modules/CheckCXXSymbolExists.cmake

@@ -27,6 +27,7 @@
 #   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 2003-2011 Kitware, Inc.

+ 10 - 3
Modules/CheckFunctionExists.cmake

@@ -20,6 +20,7 @@
 #   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 2002-2011 Kitware, Inc.
@@ -40,7 +41,9 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
   if("${VARIABLE}" MATCHES "^${VARIABLE}$")
     set(MACRO_CHECK_FUNCTION_DEFINITIONS
       "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
-    message(STATUS "Looking for ${FUNCTION}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${FUNCTION}")
+    endif()
     if(CMAKE_REQUIRED_LIBRARIES)
       set(CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
         LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -63,12 +66,16 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
       OUTPUT_VARIABLE OUTPUT)
     if(${VARIABLE})
       set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
-      message(STATUS "Looking for ${FUNCTION} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${FUNCTION} - found")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the function ${FUNCTION} exists passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
-      message(STATUS "Looking for ${FUNCTION} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${FUNCTION} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have function ${FUNCTION}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the function ${FUNCTION} exists failed with the following output:\n"

+ 10 - 3
Modules/CheckIncludeFile.cmake

@@ -24,6 +24,7 @@
 #   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_QUIET = execute quietly without messages
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
@@ -49,7 +50,9 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
     set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
     configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.c.in
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.c)
-    message(STATUS "Looking for ${INCLUDE}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${INCLUDE}")
+    endif()
     if(${ARGC} EQUAL 3)
       set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS})
       set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}")
@@ -69,14 +72,18 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE)
     endif()
 
     if(${VARIABLE})
-      message(STATUS "Looking for ${INCLUDE} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${INCLUDE} - found")
+      endif()
       set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the include file ${INCLUDE} "
         "exists passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
-      message(STATUS "Looking for ${INCLUDE} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${INCLUDE} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the include file ${INCLUDE} "

+ 10 - 3
Modules/CheckIncludeFileCXX.cmake

@@ -28,6 +28,7 @@
 #   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_QUIET = execute quietly without messages
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
@@ -53,7 +54,9 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
     set(CHECK_INCLUDE_FILE_VAR ${INCLUDE})
     configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
-    message(STATUS "Looking for C++ include ${INCLUDE}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for C++ include ${INCLUDE}")
+    endif()
     if(${ARGC} EQUAL 3)
       set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}")
@@ -73,14 +76,18 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE)
     endif()
 
     if(${VARIABLE})
-      message(STATUS "Looking for C++ include ${INCLUDE} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for C++ include ${INCLUDE} - found")
+      endif()
       set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the include file ${INCLUDE} "
         "exists passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
-      message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for C++ include ${INCLUDE} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have include ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the include file ${INCLUDE} "

+ 10 - 3
Modules/CheckIncludeFiles.cmake

@@ -23,6 +23,7 @@
 #   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_QUIET = execute quietly without messages
 
 #=============================================================================
 # Copyright 2003-2012 Kitware, Inc.
@@ -66,7 +67,9 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
       set(_description "include file ${_INCLUDE}")
     endif()
 
-    message(STATUS "Looking for ${_description}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${_description}")
+    endif()
     try_compile(${VARIABLE}
       ${CMAKE_BINARY_DIR}
       ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c
@@ -76,14 +79,18 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE)
       "${CHECK_INCLUDE_FILES_INCLUDE_DIRS}"
       OUTPUT_VARIABLE OUTPUT)
     if(${VARIABLE})
-      message(STATUS "Looking for ${_description} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${_description} - found")
+      endif()
       set(${VARIABLE} 1 CACHE INTERNAL "Have include ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if files ${INCLUDE} "
         "exist passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
-      message(STATUS "Looking for ${_description} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${_description} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have includes ${INCLUDE}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if files ${INCLUDE} "

+ 10 - 3
Modules/CheckLibraryExists.cmake

@@ -23,6 +23,7 @@
 #   CMAKE_REQUIRED_FLAGS = string of compile command line flags
 #   CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
@@ -43,7 +44,9 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
   if("${VARIABLE}" MATCHES "^${VARIABLE}$")
     set(MACRO_CHECK_LIBRARY_EXISTS_DEFINITION
       "-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
-    message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${FUNCTION} in ${LIBRARY}")
+    endif()
     set(CHECK_LIBRARY_EXISTS_LIBRARIES ${LIBRARY})
     if(CMAKE_REQUIRED_LIBRARIES)
       set(CHECK_LIBRARY_EXISTS_LIBRARIES
@@ -60,14 +63,18 @@ macro(CHECK_LIBRARY_EXISTS LIBRARY FUNCTION LOCATION VARIABLE)
       OUTPUT_VARIABLE OUTPUT)
 
     if(${VARIABLE})
-      message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - found")
+      endif()
       set(${VARIABLE} 1 CACHE INTERNAL "Have library ${LIBRARY}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the function ${FUNCTION} exists in the ${LIBRARY} "
         "passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
-      message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${FUNCTION} in ${LIBRARY} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have library ${LIBRARY}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the function ${FUNCTION} exists in the ${LIBRARY} "

+ 7 - 2
Modules/CheckPrototypeDefinition.cmake

@@ -33,6 +33,7 @@
 #   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.
@@ -97,12 +98,16 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB
 
     if (${_VARIABLE})
       set(${_VARIABLE} 1 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
-      message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - True")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} passed with the following output:\n"
         "${OUTPUT}\n\n")
     else ()
-      message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Checking prototype ${_FUNCTION} for ${_VARIABLE} - False")
+      endif()
       set(${_VARIABLE} 0 CACHE INTERNAL "Have correct prototype for ${_FUNCTION}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the prototype ${_FUNCTION} exists for ${_VARIABLE} failed with the following output:\n"

+ 1 - 0
Modules/CheckStructHasMember.cmake

@@ -28,6 +28,7 @@
 #   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
 #
 #
 #

+ 10 - 3
Modules/CheckSymbolExists.cmake

@@ -28,6 +28,7 @@
 #   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 2003-2011 Kitware, Inc.
@@ -74,7 +75,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
     configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in"
       "${SOURCEFILE}" @ONLY)
 
-    message(STATUS "Looking for ${SYMBOL}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${SYMBOL}")
+    endif()
     try_compile(${VARIABLE}
       ${CMAKE_BINARY_DIR}
       "${SOURCEFILE}"
@@ -85,7 +88,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
       "${CMAKE_SYMBOL_EXISTS_INCLUDES}"
       OUTPUT_VARIABLE OUTPUT)
     if(${VARIABLE})
-      message(STATUS "Looking for ${SYMBOL} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${SYMBOL} - found")
+      endif()
       set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the ${SYMBOL} "
@@ -93,7 +98,9 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE)
         "${OUTPUT}\nFile ${SOURCEFILE}:\n"
         "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n")
     else()
-      message(STATUS "Looking for ${SYMBOL} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${SYMBOL} - not found")
+      endif()
       set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}")
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the ${SYMBOL} "

+ 20 - 6
Modules/CheckTypeSize.cmake

@@ -59,6 +59,7 @@
 #   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
 #   CMAKE_EXTRA_INCLUDE_FILES = list of extra headers to include
 
 #=============================================================================
@@ -75,6 +76,7 @@
 #  License text for the above reference.)
 
 include(CheckIncludeFile)
+include(CheckIncludeFileCXX)
 
 cmake_policy(PUSH)
 cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
@@ -84,7 +86,9 @@ get_filename_component(__check_type_size_dir "${CMAKE_CURRENT_LIST_FILE}" PATH)
 #-----------------------------------------------------------------------------
 # Helper function.  DO NOT CALL DIRECTLY.
 function(__check_type_size_impl type var map builtin language)
-  message(STATUS "Check size of ${type}")
+  if(NOT CMAKE_REQUIRED_QUIET)
+    message(STATUS "Check size of ${type}")
+  endif()
 
   # Include header files.
   set(headers)
@@ -168,13 +172,17 @@ function(__check_type_size_impl type var map builtin language)
       message(SEND_ERROR "CHECK_TYPE_SIZE found different results, consider setting CMAKE_OSX_ARCHITECTURES or CMAKE_TRY_COMPILE_OSX_ARCHITECTURES to one or no architecture !")
     endif()
 
-    message(STATUS "Check size of ${type} - done")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Check size of ${type} - done")
+    endif()
     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
       "Determining size of ${type} passed with the following output:\n${output}\n\n")
     set(${var} "${${var}}" CACHE INTERNAL "CHECK_TYPE_SIZE: sizeof(${type})")
   else()
     # The check failed to compile.
-    message(STATUS "Check size of ${type} - failed")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Check size of ${type} - failed")
+    endif()
     file(READ ${src} content)
     file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
       "Determining size of ${type} failed with the following output:\n${output}\n${src}:\n${content}\n\n")
@@ -218,9 +226,15 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE)
     set(_builtin 0)
   else()
     set(_builtin 1)
-    check_include_file(sys/types.h HAVE_SYS_TYPES_H)
-    check_include_file(stdint.h HAVE_STDINT_H)
-    check_include_file(stddef.h HAVE_STDDEF_H)
+    if("${_language}" STREQUAL "C")
+      check_include_file(sys/types.h HAVE_SYS_TYPES_H)
+      check_include_file(stdint.h HAVE_STDINT_H)
+      check_include_file(stddef.h HAVE_STDDEF_H)
+    elseif("${_language}" STREQUAL "CXX")
+      check_include_file_cxx(sys/types.h HAVE_SYS_TYPES_H)
+      check_include_file_cxx(stdint.h HAVE_STDINT_H)
+      check_include_file_cxx(stddef.h HAVE_STDDEF_H)
+    endif()
   endif()
   unset(_CHECK_TYPE_SIZE_BUILTIN_TYPES_ONLY)
   unset(_CHECK_TYPE_SIZE_LANGUAGE)

+ 10 - 3
Modules/CheckVariableExists.cmake

@@ -27,6 +27,7 @@
 #   CMAKE_REQUIRED_FLAGS = string of compile command line flags
 #   CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
 #   CMAKE_REQUIRED_LIBRARIES = list of libraries to link
+#   CMAKE_REQUIRED_QUIET = execute quietly without messages
 
 #=============================================================================
 # Copyright 2002-2009 Kitware, Inc.
@@ -47,7 +48,9 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
   if("${VARIABLE}" MATCHES "^${VARIABLE}$")
     set(MACRO_CHECK_VARIABLE_DEFINITIONS
       "-DCHECK_VARIABLE_EXISTS=${VAR} ${CMAKE_REQUIRED_FLAGS}")
-    message(STATUS "Looking for ${VAR}")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Looking for ${VAR}")
+    endif()
     if(CMAKE_REQUIRED_LIBRARIES)
       set(CHECK_VARIABLE_EXISTS_ADD_LIBRARIES
         LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
@@ -63,13 +66,17 @@ macro(CHECK_VARIABLE_EXISTS VAR VARIABLE)
       OUTPUT_VARIABLE OUTPUT)
     if(${VARIABLE})
       set(${VARIABLE} 1 CACHE INTERNAL "Have variable ${VAR}")
-      message(STATUS "Looking for ${VAR} - found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${VAR} - found")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Determining if the variable ${VAR} exists passed with the following output:\n"
         "${OUTPUT}\n\n")
     else()
       set(${VARIABLE} "" CACHE INTERNAL "Have variable ${VAR}")
-      message(STATUS "Looking for ${VAR} - not found")
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for ${VAR} - not found")
+      endif()
       file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
         "Determining if the variable ${VAR} exists failed with the following output:\n"
         "${OUTPUT}\n\n")

+ 121 - 10
Modules/ExternalProject.cmake

@@ -20,6 +20,7 @@
 #    [DOWNLOAD_NAME fname]       # File name to store (if not end of URL)
 #    [DOWNLOAD_DIR dir]          # Directory to store downloaded files
 #    [DOWNLOAD_COMMAND cmd...]   # Command to download source tree
+#    [DOWNLOAD_NO_PROGRESS 1]    # Disable download progress reports
 #    [CVS_REPOSITORY cvsroot]    # CVSROOT of CVS repository
 #    [CVS_MODULE mod]            # Module to checkout from CVS repo
 #    [CVS_TAG tag]               # Tag to checkout from CVS repo
@@ -54,6 +55,7 @@
 #    [BINARY_DIR dir]            # Specify build dir location
 #    [BUILD_COMMAND cmd...]      # Command to drive the native build
 #    [BUILD_IN_SOURCE 1]         # Use source dir for build dir
+#    [BUILD_ALWAYS 1]            # No stamp file, build step always runs
 #   #--Install step---------------
 #    [INSTALL_DIR dir]           # Installation prefix
 #    [INSTALL_COMMAND cmd...]    # Command to drive install after build
@@ -452,6 +454,7 @@ execute_process(
   WORKING_DIRECTORY \"${work_dir}\"
   RESULT_VARIABLE error_code
   OUTPUT_VARIABLE head_sha
+  OUTPUT_STRIP_TRAILING_WHITESPACE
   )
 if(error_code)
   message(FATAL_ERROR \"Failed to get the hash for HEAD\")
@@ -470,6 +473,17 @@ else()
   set(is_remote_ref 0)
 endif()
 
+# Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip
+# the remote from the tag.
+if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\")
+  string(REGEX MATCH \"^([^/]+)/(.+)$\" _unused \"${git_tag}\")
+  set(git_remote \"\${CMAKE_MATCH_1}\")
+  set(git_tag \"\${CMAKE_MATCH_2}\")
+else()
+  set(git_remote \"origin\")
+  set(git_tag \"${git_tag}\")
+endif()
+
 # This will fail if the tag does not exist (it probably has not been fetched
 # yet).
 execute_process(
@@ -477,6 +491,7 @@ execute_process(
   WORKING_DIRECTORY \"${work_dir}\"
   RESULT_VARIABLE error_code
   OUTPUT_VARIABLE tag_sha
+  OUTPUT_STRIP_TRAILING_WHITESPACE
   )
 
 # Is the hash checkout out that we want?
@@ -490,13 +505,94 @@ if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"
     message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\")
   endif()
 
-  execute_process(
-    COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
-    WORKING_DIRECTORY \"${work_dir}\"
-    RESULT_VARIABLE error_code
-    )
-  if(error_code)
-    message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+  if(is_remote_ref)
+    # Check if stash is needed
+    execute_process(
+      COMMAND \"${git_EXECUTABLE}\" status --porcelain
+      WORKING_DIRECTORY \"${work_dir}\"
+      RESULT_VARIABLE error_code
+      OUTPUT_VARIABLE repo_status
+      )
+    if(error_code)
+      message(FATAL_ERROR \"Failed to get the status\")
+    endif()
+    string(LENGTH \"\${repo_status}\" need_stash)
+
+    # If not in clean state, stash changes in order to be able to be able to
+    # perform git pull --rebase
+    if(need_stash)
+      execute_process(
+        COMMAND \"${git_EXECUTABLE}\" stash save --all --quiet
+        WORKING_DIRECTORY \"${work_dir}\"
+        RESULT_VARIABLE error_code
+        )
+      if(error_code)
+        message(FATAL_ERROR \"Failed to stash changes\")
+      endif()
+    endif()
+
+    # Pull changes from the remote branch
+    execute_process(
+      COMMAND \"${git_EXECUTABLE}\" rebase \${git_remote}/\${git_tag}
+      WORKING_DIRECTORY \"${work_dir}\"
+      RESULT_VARIABLE error_code
+      )
+    if(error_code)
+      # Rebase failed: Restore previous state.
+      execute_process(
+        COMMAND \"${git_EXECUTABLE}\" rebase --abort
+        WORKING_DIRECTORY \"${work_dir}\"
+      )
+      if(need_stash)
+        execute_process(
+          COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+          WORKING_DIRECTORY \"${work_dir}\"
+          )
+      endif()
+      message(FATAL_ERROR \"\\nFailed to rebase in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+    endif()
+
+    if(need_stash)
+      execute_process(
+        COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+        WORKING_DIRECTORY \"${work_dir}\"
+        RESULT_VARIABLE error_code
+        )
+      if(error_code)
+        # Stash pop --index failed: Try again dropping the index
+        execute_process(
+          COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet
+          WORKING_DIRECTORY \"${work_dir}\"
+          RESULT_VARIABLE error_code
+          )
+        execute_process(
+          COMMAND \"${git_EXECUTABLE}\" stash pop --quiet
+          WORKING_DIRECTORY \"${work_dir}\"
+          RESULT_VARIABLE error_code
+          )
+        if(error_code)
+          # Stash pop failed: Restore previous state.
+          execute_process(
+            COMMAND \"${git_EXECUTABLE}\" reset --hard --quiet \${head_sha}
+            WORKING_DIRECTORY \"${work_dir}\"
+          )
+          execute_process(
+            COMMAND \"${git_EXECUTABLE}\" stash pop --index --quiet
+            WORKING_DIRECTORY \"${work_dir}\"
+          )
+          message(FATAL_ERROR \"\\nFailed to unstash changes in: '${work_dir}/${src_name}'.\\nYou will have to resolve the conflicts manually\")
+        endif()
+      endif()
+    endif()
+  else()
+    execute_process(
+      COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+      WORKING_DIRECTORY \"${work_dir}\"
+      RESULT_VARIABLE error_code
+      )
+    if(error_code)
+      message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+    endif()
   endif()
 
   execute_process(
@@ -514,7 +610,7 @@ endif()
 
 endfunction(_ep_write_gitupdate_script)
 
-function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo)
+function(_ep_write_downloadfile_script script_filename remote local timeout no_progress hash tls_verify tls_cainfo)
   if(timeout)
     set(timeout_args TIMEOUT ${timeout})
     set(timeout_msg "${timeout} seconds")
@@ -523,6 +619,12 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash
     set(timeout_msg "none")
   endif()
 
+  if(no_progress)
+    set(show_progress "")
+  else()
+    set(show_progress "SHOW_PROGRESS")
+  endif()
+
   if("${hash}" MATCHES "${_ep_hash_regex}")
     set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1}=${CMAKE_MATCH_2})
   else()
@@ -562,7 +664,7 @@ ${tls_cainfo}
 file(DOWNLOAD
   \"${remote}\"
   \"${local}\"
-  SHOW_PROGRESS
+  ${show_progress}
   ${hash_args}
   ${timeout_args}
   STATUS status
@@ -1442,10 +1544,11 @@ function(_ep_add_download_command name)
         string(REPLACE ";" "-" fname "${fname}")
         set(file ${download_dir}/${fname})
         get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT)
+        get_property(no_progress TARGET ${name} PROPERTY _EP_DOWNLOAD_NO_PROGRESS)
         get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
         get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO)
         set(download_script "${stamp_dir}/download-${name}.cmake")
-        _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}")
+        _ep_write_downloadfile_script("${download_script}" "${url}" "${file}" "${timeout}" "${no_progress}" "${hash}" "${tls_verify}" "${tls_cainfo}")
         set(cmd ${CMAKE_COMMAND} -P "${download_script}"
           COMMAND)
         set(retries 3)
@@ -1716,10 +1819,18 @@ function(_ep_add_build_command name)
     set(log "")
   endif()
 
+  get_property(build_always TARGET ${name} PROPERTY _EP_BUILD_ALWAYS)
+  if(build_always)
+    set(always 1)
+  else()
+    set(always 0)
+  endif()
+
   ExternalProject_Add_Step(${name} build
     COMMAND ${cmd}
     WORKING_DIRECTORY ${binary_dir}
     DEPENDEES configure
+    ALWAYS ${always}
     ${log}
     )
 endfunction()

+ 41 - 17
Modules/FeatureSummary.cmake

@@ -71,6 +71,13 @@
 #     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:
+#
+# ::
+#
+#    feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES)
+#
 #
 #
 # If a FILENAME is given, the information is printed into this file.  If
@@ -417,8 +424,8 @@ endfunction()
 function(FEATURE_SUMMARY)
 # CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
   set(options APPEND INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
-  set(oneValueArgs FILENAME VAR DESCRIPTION WHAT)
-  set(multiValueArgs ) # none
+  set(oneValueArgs FILENAME VAR DESCRIPTION)
+  set(multiValueArgs WHAT)
 
   CMAKE_PARSE_ARGUMENTS(_FS "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${_FIRST_ARG} ${ARGN})
 
@@ -451,23 +458,42 @@ function(FEATURE_SUMMARY)
       set(requiredPackagesNotFound TRUE)
     endif()
 
-  elseif("${_FS_WHAT}" STREQUAL "ALL")
-
-    set(allWhatParts "ENABLED_FEATURES"
-                     "RUNTIME_PACKAGES_FOUND"
-                     "OPTIONAL_PACKAGES_FOUND"
-                     "RECOMMENDED_PACKAGES_FOUND"
-                     "REQUIRED_PACKAGES_FOUND"
+  else()
+    if("${_FS_WHAT}" STREQUAL "ALL")
+
+      set(allWhatParts "ENABLED_FEATURES"
+                       "RUNTIME_PACKAGES_FOUND"
+                       "OPTIONAL_PACKAGES_FOUND"
+                       "RECOMMENDED_PACKAGES_FOUND"
+                       "REQUIRED_PACKAGES_FOUND"
+
+                       "DISABLED_FEATURES"
+                       "RUNTIME_PACKAGES_NOT_FOUND"
+                       "OPTIONAL_PACKAGES_NOT_FOUND"
+                       "RECOMMENDED_PACKAGES_NOT_FOUND"
+                       "REQUIRED_PACKAGES_NOT_FOUND"
+      )
 
-                     "DISABLED_FEATURES"
-                     "RUNTIME_PACKAGES_NOT_FOUND"
-                     "OPTIONAL_PACKAGES_NOT_FOUND"
-                     "RECOMMENDED_PACKAGES_NOT_FOUND"
-                     "REQUIRED_PACKAGES_NOT_FOUND"
-       )
+    else()
+      set(allWhatParts)
+      foreach(part ${_FS_WHAT})
+        list(FIND validWhatParts "${part}" indexInList)
+        if(NOT "${indexInList}" STREQUAL "-1")
+          list(APPEND allWhatParts "${part}")
+        else()
+          if("${part}" STREQUAL "ALL")
+            message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ALL, which cannot be combined with other values.")
+          else()
+            message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() contains ${part}, which is not a valid value.")
+          endif()
+        endif()
+      endforeach()
+    endif()
 
     set(title_ENABLED_FEATURES               "The following features have been enabled:")
     set(title_DISABLED_FEATURES              "The following features have been disabled:")
+    set(title_PACKAGES_FOUND                 "The following packages have been found:")
+    set(title_PACKAGES_NOT_FOUND             "The following packages have not been found:")
     set(title_OPTIONAL_PACKAGES_FOUND        "The following OPTIONAL packages have been found:")
     set(title_OPTIONAL_PACKAGES_NOT_FOUND    "The following OPTIONAL packages have not been found:")
     set(title_RECOMMENDED_PACKAGES_FOUND     "The following RECOMMENDED packages have been found:")
@@ -488,8 +514,6 @@ function(FEATURE_SUMMARY)
         endif()
       endif()
     endforeach()
-  else()
-    message(FATAL_ERROR "The WHAT argument of FEATURE_SUMMARY() is set to ${_FS_WHAT}, which is not a valid value.")
   endif()
 
   if(_FS_FILENAME)

+ 4 - 0
Modules/FindBLAS.cmake

@@ -52,6 +52,9 @@
 
 include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${BLAS_FIND_QUIETLY})
 
 set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 
@@ -687,4 +690,5 @@ else()
   endif()
 endif()
 
+cmake_pop_check_state()
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})

+ 4 - 0
Modules/FindBZip2.cmake

@@ -57,7 +57,11 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
 
 if (BZIP2_FOUND)
    include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+   include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+   cmake_push_check_state()
+   set(CMAKE_REQUIRED_QUIET ${BZip2_FIND_QUIETLY})
    CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
+   cmake_pop_check_state()
 endif ()
 
 mark_as_advanced(BZIP2_INCLUDE_DIR)

+ 1 - 0
Modules/FindBacktrace.cmake

@@ -62,6 +62,7 @@ if (NOT DEFINED Backtrace_LIBRARY)
   # First, check if we already have backtrace(), e.g., in libc
   cmake_push_check_state(RESET)
   set(CMAKE_REQUIRED_INCLUDES ${Backtrace_INCLUDE_DIRS})
+  set(CMAKE_REQUIRED_QUIET ${Backtrace_FIND_QUIETLY})
   check_symbol_exists("backtrace" "${_Backtrace_HEADER_TRY}" _Backtrace_SYM_FOUND)
   cmake_pop_check_state()
 endif()

+ 2 - 1
Modules/FindBoost.cmake

@@ -954,7 +954,8 @@ foreach(COMPONENT ${Boost_FIND_COMPONENTS})
 
   # Compute component-specific hints.
   set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "")
-  if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python")
+  if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR
+     ${COMPONENT} STREQUAL "graph_parallel")
     foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES})
       if(IS_ABSOLUTE "${lib}")
         get_filename_component(libdir "${lib}" PATH)

+ 1 - 1
Modules/FindCUDA.cmake

@@ -987,7 +987,7 @@ function(CUDA_COMPUTE_BUILD_PATH path build_path)
     endif()
   endif()
 
-  # This recipie is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
+  # This recipe is from cmLocalGenerator::CreateSafeUniqueObjectFileName in the
   # CMake source.
 
   # Remove leading /

+ 4 - 0
Modules/FindCups.cmake

@@ -36,9 +36,13 @@ find_library(CUPS_LIBRARIES NAMES cups )
 
 if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
     include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+    include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+    cmake_push_check_state()
+    set(CMAKE_REQUIRED_QUIET ${Cups_FIND_QUIETLY})
 
     # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
     CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)
+    cmake_pop_check_state()
 endif ()
 
 if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h")

+ 4 - 0
Modules/FindCurses.cmake

@@ -67,6 +67,9 @@ endif()
 # default search paths.
 if(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)
   include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+  include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+  cmake_push_check_state()
+  set(CMAKE_REQUIRED_QUIET ${Curses_FIND_QUIETLY})
   CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
     wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
 
@@ -77,6 +80,7 @@ if(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)
       set(CURSES_USE_NCURSES TRUE)
     endif()
   endif()
+  cmake_pop_check_state()
 
 endif()
 

+ 2 - 2
Modules/FindFreetype.cmake

@@ -62,7 +62,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
     ENV GTKMM_BASEPATH
     [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
-  PATH_SUFFIXES include/freetype2 include
+  PATH_SUFFIXES include/freetype2 include freetype2
 )
 
 find_path(FREETYPE_INCLUDE_DIR_freetype2
@@ -79,7 +79,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2
     ENV GTKMM_BASEPATH
     [HKEY_CURRENT_USER\\SOFTWARE\\gtkmm\\2.4;Path]
     [HKEY_LOCAL_MACHINE\\SOFTWARE\\gtkmm\\2.4;Path]
-  PATH_SUFFIXES include/freetype2 include
+  PATH_SUFFIXES include/freetype2 include freetype2
 )
 
 find_library(FREETYPE_LIBRARY

+ 1 - 0
Modules/FindGIF.cmake

@@ -66,6 +66,7 @@ if(GIF_INCLUDE_DIR)
   include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
   include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
   CMAKE_PUSH_CHECK_STATE()
+  set(CMAKE_REQUIRED_QUIET ${GIF_FIND_QUIETLY})
   set(GIF_VERSION 3)
   set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")
   CHECK_STRUCT_HAS_MEMBER(GifFileType UserData gif_lib.h GIF_GifFileType_UserData )

+ 6 - 2
Modules/FindGTest.cmake

@@ -79,7 +79,7 @@
 #     extra_args = Pass a list of extra arguments to be passed to
 #                  executable enclosed in quotes (or "" for none)
 #     ARGN =       A list of source files to search for tests & test
-#                  fixtures.
+#                  fixtures. Or AUTO to find them from executable target.
 #
 #
 #
@@ -88,7 +88,7 @@
 #   Example:
 #      set(FooTestArgs --foo 1 --bar 2)
 #      add_executable(FooTest FooUnitTest.cc)
-#      GTEST_ADD_TESTS(FooTest "${FooTestArgs}" FooUnitTest.cc)
+#      GTEST_ADD_TESTS(FooTest "${FooTestArgs}" AUTO)
 
 #=============================================================================
 # Copyright 2009 Kitware, Inc.
@@ -111,6 +111,10 @@ function(GTEST_ADD_TESTS executable extra_args)
     if(NOT ARGN)
         message(FATAL_ERROR "Missing ARGN: Read the documentation for GTEST_ADD_TESTS")
     endif()
+    if(ARGN STREQUAL "AUTO")
+        # obtain sources used for building that executable
+        get_property(ARGN TARGET ${executable} PROPERTY SOURCES)
+    endif()
     foreach(source ${ARGN})
         file(READ "${source}" contents)
         string(REGEX MATCHALL "TEST_?F?\\(([A-Za-z_0-9 ,]+)\\)" found_tests ${contents})

+ 36 - 1
Modules/FindHg.cmake

@@ -2,7 +2,7 @@
 # FindHg
 # ------
 #
-#
+# Extract information from a mercurial working copy.
 #
 # The module defines the following variables:
 #
@@ -12,6 +12,20 @@
 #    HG_FOUND - true if the command line client was found
 #    HG_VERSION_STRING - the version of mercurial found
 #
+# If the command line client executable is found the following macro is defined:
+#
+# ::
+#
+#   HG_WC_INFO(<dir> <var-prefix>)
+#
+# Hg_WC_INFO extracts information of a mercurial working copy
+# at a given location.  This macro defines the following variables:
+#
+# ::
+#
+#   <var-prefix>_WC_CHANGESET - current changeset
+#   <var-prefix>_WC_REVISION - current revision
+#
 # Example usage:
 #
 # ::
@@ -19,11 +33,15 @@
 #    find_package(Hg)
 #    if(HG_FOUND)
 #      message("hg found: ${HG_EXECUTABLE}")
+#      HG_WC_INFO(${PROJECT_SOURCE_DIR} Project)
+#      message("Current revision is ${Project_WC_REVISION}")
+#      message("Current changeset is ${Project_WC_CHANGESET}")
 #    endif()
 
 #=============================================================================
 # Copyright 2010-2012 Kitware, Inc.
 # Copyright 2012      Rolf Eike Beer <[email protected]>
+# Copyright 2014      Matthaeus G. Chajdas
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -37,6 +55,8 @@
 
 find_program(HG_EXECUTABLE
   NAMES hg
+  PATHS
+    [HKEY_LOCAL_MACHINE\\Software\\TortoiseHG]
   PATH_SUFFIXES Mercurial
   DOC "hg command line client"
   )
@@ -51,6 +71,21 @@ if(HG_EXECUTABLE)
     set(HG_VERSION_STRING "${CMAKE_MATCH_1}")
   endif()
   unset(hg_version)
+
+  macro(HG_WC_INFO dir prefix)
+    execute_process(COMMAND ${HG_EXECUTABLE} id -i -n
+      WORKING_DIRECTORY ${dir}
+      RESULT_VARIABLE hg_id_result
+      ERROR_VARIABLE hg_id_error
+      OUTPUT_VARIABLE ${prefix}_WC_DATA
+      OUTPUT_STRIP_TRAILING_WHITESPACE)
+    if(NOT ${hg_id_result} EQUAL 0)
+      message(SEND_ERROR "Command \"${HG_EXECUTBALE} id -n\" in directory ${dir} failed with output:\n${hg_id_error}")
+    endif()
+
+    string(REGEX REPLACE "([0-9a-f]+)\\+? [0-9]+\\+?" "\\1" ${prefix}_WC_CHANGESET ${${prefix}_WC_DATA})
+    string(REGEX REPLACE "[0-9a-f]+\\+? ([0-9]+)\\+?" "\\1" ${prefix}_WC_REVISION ${${prefix}_WC_DATA})
+  endmacro(HG_WC_INFO)
 endif()
 
 # Handle the QUIETLY and REQUIRED arguments and set HG_FOUND to TRUE if

+ 5 - 0
Modules/FindLAPACK.cmake

@@ -54,6 +54,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
 else ()
 include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
 endif ()
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+
+cmake_push_check_state()
+set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY})
 
 set(LAPACK_FOUND FALSE)
 set(LAPACK95_FOUND FALSE)
@@ -347,4 +351,5 @@ else()
  endif()
 endif()
 
+cmake_pop_check_state()
 set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})

+ 3 - 0
Modules/FindLibLZMA.cmake

@@ -55,9 +55,12 @@ endif()
 # Avoid using old codebase
 if (LIBLZMA_LIBRARY)
    include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
+   set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+   set(CMAKE_REQUIRED_QUIET ${LibLZMA_FIND_QUIETLY})
    CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER)
    CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER)
    CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET)
+   set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
 endif ()
 
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)

+ 135 - 0
Modules/FindOpenCL.cmake

@@ -0,0 +1,135 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define::
+#
+#   OpenCL_FOUND          - True if OpenCL was found
+#   OpenCL_INCLUDE_DIRS   - include directories for OpenCL
+#   OpenCL_LIBRARIES      - link against this library to use OpenCL
+#   OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+#   OpenCL_VERSION_MAJOR  - The major version of the OpenCL implementation
+#   OpenCL_VERSION_MINOR  - The minor version of the OpenCL implementation
+#
+# The module will also define two cache variables::
+#
+#   OpenCL_INCLUDE_DIR    - the OpenCL include directory
+#   OpenCL_LIBRARY        - the path to the OpenCL library
+#
+
+#=============================================================================
+# Copyright 2014 Matthaeus G. Chajdas
+#
+# 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(_FIND_OPENCL_VERSION)
+  include(CheckSymbolExists)
+  include(CMakePushCheckState)
+  set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
+
+  CMAKE_PUSH_CHECK_STATE()
+  foreach(VERSION "2_0" "1_2" "1_1" "1_0")
+    set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+    if(APPLE)
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    else()
+      CHECK_SYMBOL_EXISTS(
+        CL_VERSION_${VERSION}
+        "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+        OPENCL_VERSION_${VERSION})
+    endif()
+
+    if(OPENCL_VERSION_${VERSION})
+      string(REPLACE "_" "." VERSION "${VERSION}")
+      set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
+      string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
+      list(GET version_components 0 major_version)
+      list(GET version_components 1 minor_version)
+      set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
+      set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
+      break()
+    endif()
+  endforeach()
+  CMAKE_POP_CHECK_STATE()
+endfunction()
+
+find_path(OpenCL_INCLUDE_DIR
+  NAMES
+    CL/cl.h OpenCL/cl.h
+  PATHS ENV
+    "PROGRAMFILES(X86)"
+    AMDAPPSDKROOT
+    INTELOCLSDKROOT
+    NVSDKCOMPUTE_ROOT
+    CUDA_PATH
+    ATISTREAMSDKROOT
+  PATH_SUFFIXES
+    OpenCL/common/inc
+    "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+if(WIN32)
+  if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+    find_library(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS ENV
+        "PROGRAMFILES(X86)"
+        AMDAPPSDKROOT
+        INTELOCLSDKROOT
+        CUDA_PATH
+        NVSDKCOMPUTE_ROOT
+        ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86"
+        lib/x86
+        lib/Win32
+        OpenCL/common/lib/Win32)
+  elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    find_library(OpenCL_LIBRARY
+      NAMES OpenCL
+      PATHS ENV
+        "PROGRAMFILES(X86)"
+        AMDAPPSDKROOT
+        INTELOCLSDKROOT
+        CUDA_PATH
+        NVSDKCOMPUTE_ROOT
+        ATISTREAMSDKROOT
+      PATH_SUFFIXES
+        "AMD APP/lib/x86_64"
+        lib/x86_64
+        lib/x64
+        OpenCL/common/lib/x64)
+  endif()
+else()
+  find_library(OpenCL_LIBRARY
+    NAMES OpenCL)
+endif()
+
+set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
+
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+find_package_handle_standard_args(
+  OpenCL
+  FOUND_VAR OpenCL_FOUND
+  REQUIRED_VARS OpenCL_LIBRARY OpenCL_INCLUDE_DIR
+  VERSION_VAR OpenCL_VERSION_STRING)
+
+mark_as_advanced(
+  OpenCL_INCLUDE_DIR
+  OpenCL_LIBRARY)

+ 10 - 2
Modules/FindOpenMP.cmake

@@ -39,6 +39,8 @@
 #  License text for the above reference.)
 
 set(_OPENMP_REQUIRED_VARS)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${OpenMP_FIND_QUIETLY})
 
 function(_OPENMP_FLAG_CANDIDATES LANG)
   set(OpenMP_FLAG_CANDIDATES
@@ -116,7 +118,9 @@ if(CMAKE_C_COMPILER_LOADED)
     set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_REQUIRED_FLAGS "${FLAG}")
     unset(OpenMP_FLAG_DETECTED CACHE)
-    message(STATUS "Try OpenMP C flag = [${FLAG}]")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Try OpenMP C flag = [${FLAG}]")
+    endif()
     check_c_source_compiles("${OpenMP_C_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
     set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
     if(OpenMP_FLAG_DETECTED)
@@ -150,7 +154,9 @@ if(CMAKE_CXX_COMPILER_LOADED)
     set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
     set(CMAKE_REQUIRED_FLAGS "${FLAG}")
     unset(OpenMP_FLAG_DETECTED CACHE)
-    message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+    if(NOT CMAKE_REQUIRED_QUIET)
+      message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
+    endif()
     check_cxx_source_compiles("${OpenMP_CXX_TEST_SOURCE}" OpenMP_FLAG_DETECTED)
     set(CMAKE_REQUIRED_FLAGS "${SAFE_CMAKE_REQUIRED_FLAGS}")
     if(OpenMP_FLAG_DETECTED)
@@ -167,6 +173,8 @@ if(CMAKE_CXX_COMPILER_LOADED)
   unset(OpenMP_CXX_TEST_SOURCE)
 endif()
 
+set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
+
 if(_OPENMP_REQUIRED_VARS)
   include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 

+ 281 - 139
Modules/FindPkgConfig.cmake

@@ -2,140 +2,20 @@
 # FindPkgConfig
 # -------------
 #
-# a pkg-config module for CMake
+# A `pkg-config` module for CMake.
 #
+# Finds the ``pkg-config`` executable and add the
+# :command:`pkg_check_modules` and :command:`pkg_search_module`
+# commands.
 #
-#
-# Usage:
-#
-# ::
-#
-#    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-#      checks for all the given modules
-#
-#
-#
-# ::
-#
-#    pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-#      checks for given modules and uses the first working one
-#
-#
-#
-# When the 'REQUIRED' argument was set, macros will fail with an error
-# when module(s) could not be found
-#
-# When the 'QUIET' argument is set, no status messages will be printed.
-#
-# It sets the following variables:
-#
-# ::
-#
-#    PKG_CONFIG_FOUND          ... if pkg-config executable was found
-#    PKG_CONFIG_EXECUTABLE     ... pathname of the pkg-config program
-#    PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
-#                                  (since CMake 2.8.8)
-#
-#
-#
-# For the following variables two sets of values exist; first one is the
-# common one and has the given PREFIX.  The second set contains flags
-# which are given out when pkgconfig was called with the '--static'
-# option.
-#
-# ::
-#
-#    <XPREFIX>_FOUND          ... set to 1 if module(s) exist
-#    <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
-#    <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
-#    <XPREFIX>_LDFLAGS        ... all required linker flags
-#    <XPREFIX>_LDFLAGS_OTHER  ... all other linker flags
-#    <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
-#    <XPREFIX>_CFLAGS         ... all required cflags
-#    <XPREFIX>_CFLAGS_OTHER   ... the other compiler flags
-#
-#
-#
-# ::
-#
-#    <XPREFIX> = <PREFIX>        for common case
-#    <XPREFIX> = <PREFIX>_STATIC for static linking
-#
-#
-#
-# There are some special variables whose prefix depends on the count of
-# given modules.  When there is only one module, <PREFIX> stays
-# unchanged.  When there are multiple modules, the prefix will be
-# changed to <PREFIX>_<MODNAME>:
-#
-# ::
-#
-#    <XPREFIX>_VERSION    ... version of the module
-#    <XPREFIX>_PREFIX     ... prefix-directory of the module
-#    <XPREFIX>_INCLUDEDIR ... include-dir of the module
-#    <XPREFIX>_LIBDIR     ... lib-dir of the module
-#
-#
-#
-# ::
-#
-#    <XPREFIX> = <PREFIX>  when |MODULES| == 1, else
-#    <XPREFIX> = <PREFIX>_<MODNAME>
-#
-#
-#
-# A <MODULE> parameter can have the following formats:
-#
-# ::
-#
-#    {MODNAME}            ... matches any version
-#    {MODNAME}>={VERSION} ... at least version <VERSION> is required
-#    {MODNAME}={VERSION}  ... exactly version <VERSION> is required
-#    {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
-#
-#
-#
-# Examples
-#
-# ::
-#
-#    pkg_check_modules (GLIB2   glib-2.0)
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (GLIB2   glib-2.0>=2.10)
-#      requires at least version 2.10 of glib2 and defines e.g.
-#        GLIB2_VERSION=2.10.3
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)
-#      requires both glib2 and gtk2, and defines e.g.
-#        FOO_glib-2.0_VERSION=2.10.3
-#        FOO_gtk+-2.0_VERSION=2.8.20
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (XRENDER REQUIRED xrender)
-#      defines e.g.:
-#        XRENDER_LIBRARIES=Xrender;X11
-#        XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
-#
-#
-#
-# ::
-#
-#    pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)
+# In order to find the ``pkg-config`` executable, it uses the
+# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
+# environment variable first.
 
 #=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
-# Copyright 2006 Enrico Scholz <[email protected]>
+# Copyright 2006-2014 Kitware, Inc.
+# Copyright 2014      Christoph Grüninger <[email protected]>
+# Copyright 2006      Enrico Scholz <[email protected]>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -150,6 +30,10 @@
 ### Common stuff ####
 set(PKG_CONFIG_VERSION 1)
 
+# find pkg-config, use PKG_CONFIG if set
+if((NOT PKG_CONFIG_EXECUTABLE) AND (NOT "$ENV{PKG_CONFIG}" STREQUAL ""))
+  set(PKG_CONFIG_EXECUTABLE "$ENV{PKG_CONFIG}" CACHE FILEPATH "pkg-config executable")
+endif()
 find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
 mark_as_advanced(PKG_CONFIG_EXECUTABLE)
 
@@ -215,9 +99,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
 endmacro()
 
 # Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req _is_silent)
+macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path)
   set(${_is_req} 0)
   set(${_is_silent} 0)
+  set(${_no_cmake_path} 0)
+  set(${_no_cmake_environment_path} 0)
+  if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+    if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+      set(${_no_cmake_path} 1)
+      set(${_no_cmake_environment_path} 1)
+    endif()
+  elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1)
+    set(${_no_cmake_path} 1)
+    set(${_no_cmake_environment_path} 1)
+  endif()
 
   foreach(_pkg ${ARGN})
     if (_pkg STREQUAL "REQUIRED")
@@ -226,15 +121,48 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent)
     if (_pkg STREQUAL "QUIET")
       set(${_is_silent} 1)
     endif ()
+    if (_pkg STREQUAL "NO_CMAKE_PATH")
+      set(${_no_cmake_path} 1)
+    endif()
+    if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH")
+      set(${_no_cmake_environment_path} 1)
+    endif()
   endforeach()
 
   set(${_result} ${ARGN})
   list(REMOVE_ITEM ${_result} "REQUIRED")
   list(REMOVE_ITEM ${_result} "QUIET")
+  list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
+  list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
 endmacro()
 
+# Add the content of a variable or an environment variable to a list of
+# paths
+# Usage:
+#  - _pkgconfig_add_extra_path(_extra_paths VAR)
+#  - _pkgconfig_add_extra_path(_extra_paths ENV VAR)
+function(_pkgconfig_add_extra_path _extra_paths_var _var)
+  set(_is_env 0)
+  if(_var STREQUAL "ENV")
+    set(_var ${ARGV2})
+    set(_is_env 1)
+  endif()
+  if(NOT _is_env)
+    if(NOT "${${_var}}" STREQUAL "")
+      list(APPEND ${_extra_paths_var} ${CMAKE_PREFIX_PATH})
+    endif()
+  else()
+    if(NOT "$ENV{${_var}}" STREQUAL "")
+      file(TO_CMAKE_PATH "$ENV{${_var}}" _path)
+      list(APPEND ${_extra_paths_var} ${_path})
+      unset(_path)
+    endif()
+  endif()
+  set(${_extra_paths_var} ${${_extra_paths_var}} PARENT_SCOPE)
+endfunction()
+
 ###
-macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
   _pkgconfig_unset(${_prefix}_FOUND)
   _pkgconfig_unset(${_prefix}_VERSION)
   _pkgconfig_unset(${_prefix}_PREFIX)
@@ -273,6 +201,77 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
     set(_pkg_check_modules_packages)
     set(_pkg_check_modules_failed)
 
+    set(_extra_paths)
+
+    if(NOT _no_cmake_path)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
+      _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
+    endif()
+
+    if(NOT _no_cmake_environment_path)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
+      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
+    endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Save the PKG_CONFIG_PATH environment variable, and add paths
+      # from the CMAKE_PREFIX_PATH variables
+      set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
+      set(_pkgconfig_path ${_pkgconfig_path_old})
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+      endif()
+
+      # Create a list of the possible pkgconfig subfolder (depending on
+      # the system
+      set(_lib_dirs)
+      if(NOT DEFINED CMAKE_SYSTEM_NAME
+          OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+              AND NOT CMAKE_CROSSCOMPILING))
+        if(EXISTS "/etc/debian_version") # is this a debian system ?
+          if(CMAKE_LIBRARY_ARCHITECTURE)
+            list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+          endif()
+        else()
+          # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+          get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+          if(uselib64)
+            list(APPEND _lib_dirs "lib64/pkgconfig")
+          endif()
+        endif()
+      endif()
+      list(APPEND _lib_dirs "lib/pkgconfig")
+
+      # Check if directories exist and eventually append them to the
+      # pkgconfig path list
+      foreach(_prefix_dir ${_extra_paths})
+        foreach(_lib_dir ${_lib_dirs})
+          if(EXISTS "${_prefix_dir}/${_lib_dir}")
+            list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+            list(REMOVE_DUPLICATES _pkgconfig_path)
+          endif()
+        endforeach()
+      endforeach()
+
+      # Prepare and set the environment variable
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        # remove empty values from the list
+        list(REMOVE_ITEM _pkgconfig_path "")
+        file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+        if(UNIX)
+          string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+          string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
+        endif()
+        set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+      endif()
+
+      # Unset variables
+      unset(_lib_dirs)
+      unset(_pkgconfig_path)
+    endif()
+
     # iterate through module list and check whether they exist and match the required version
     foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
       set(_pkg_check_modules_exist_query)
@@ -338,7 +337,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
     if(_pkg_check_modules_failed)
       # fail when requested
       if (${_is_required})
-        message(SEND_ERROR "A required package was not found")
+        message(FATAL_ERROR "A required package was not found")
       endif ()
     else()
       # when we are here, we checked whether requested modules
@@ -376,6 +375,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
       _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS              ""        --cflags )
       _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER        ""        --cflags-only-other )
     endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Restore the environment variable
+      set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+    endif()
+
+    unset(_extra_paths)
+    unset(_pkgconfig_path_old)
   else()
     if (${_is_required})
       message(SEND_ERROR "pkg-config tool not found")
@@ -387,23 +394,138 @@ endmacro()
 ### User visible macros start here
 ###
 
-###
+#[========================================[.rst:
+.. command:: pkg_check_modules
+
+ Checks for all the given modules. ::
+
+    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
+                      [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+                      <MODULE> [<MODULE>]*)
+
+
+ When the ``REQUIRED`` argument was set, macros will fail with an error
+ when module(s) could not be found.
+
+ When the ``QUIET`` argument is set, no status messages will be printed.
+
+ By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or
+ later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the
+ :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and
+ :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will
+ be added to ``pkg-config`` search path.
+ The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
+ disable this behavior for the cache variables and the environment
+ variables, respectively.
+
+ It sets the following variables: ::
+
+    PKG_CONFIG_FOUND          ... if pkg-config executable was found
+    PKG_CONFIG_EXECUTABLE     ... pathname of the pkg-config program
+    PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+                                  (since CMake 2.8.8)
+
+ For the following variables two sets of values exist; first one is the
+ common one and has the given PREFIX.  The second set contains flags
+ which are given out when ``pkg-config`` was called with the ``--static``
+ option. ::
+
+    <XPREFIX>_FOUND          ... set to 1 if module(s) exist
+    <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
+    <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
+    <XPREFIX>_LDFLAGS        ... all required linker flags
+    <XPREFIX>_LDFLAGS_OTHER  ... all other linker flags
+    <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
+    <XPREFIX>_CFLAGS         ... all required cflags
+    <XPREFIX>_CFLAGS_OTHER   ... the other compiler flags
+
+ ::
+
+    <XPREFIX> = <PREFIX>        for common case
+    <XPREFIX> = <PREFIX>_STATIC for static linking
+
+ There are some special variables whose prefix depends on the count of
+ given modules.  When there is only one module, <PREFIX> stays
+ unchanged.  When there are multiple modules, the prefix will be
+ changed to <PREFIX>_<MODNAME>: ::
+
+    <XPREFIX>_VERSION    ... version of the module
+    <XPREFIX>_PREFIX     ... prefix-directory of the module
+    <XPREFIX>_INCLUDEDIR ... include-dir of the module
+    <XPREFIX>_LIBDIR     ... lib-dir of the module
+
+ ::
+
+    <XPREFIX> = <PREFIX>  when |MODULES| == 1, else
+    <XPREFIX> = <PREFIX>_<MODNAME>
+
+ A <MODULE> parameter can have the following formats: ::
+
+    {MODNAME}            ... matches any version
+    {MODNAME}>={VERSION} ... at least version <VERSION> is required
+    {MODNAME}={VERSION}  ... exactly version <VERSION> is required
+    {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+
+ Examples
+
+ .. code-block:: cmake
+
+    pkg_check_modules (GLIB2   glib-2.0)
+
+ .. code-block:: cmake
+
+    pkg_check_modules (GLIB2   glib-2.0>=2.10)
+
+ Requires at least version 2.10 of glib2 and defines e.g.
+ ``GLIB2_VERSION=2.10.3``
+
+ .. code-block:: cmake
+
+    pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)
+
+ Requires both glib2 and gtk2, and defines e.g.
+ ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20``
+
+ .. code-block:: cmake
+
+    pkg_check_modules (XRENDER REQUIRED xrender)
+
+ Defines e.g.:
+ ``XRENDER_LIBRARIES=Xrender;X11`` and
+ ``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp``
+#]========================================]
 macro(pkg_check_modules _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
-    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
-    _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
+    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
+    _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
 
     _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
   endif()
 endmacro()
 
-###
+
+#[========================================[.rst:
+.. command:: pkg_search_module
+
+ Same as :command:`pkg_check_modules`, but instead it checks for given
+ modules and uses the first working one. ::
+
+    pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
+                      [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+                      <MODULE> [<MODULE>]*)
+
+ Examples
+
+ .. code-block:: cmake
+
+    pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)
+#]========================================]
 macro(pkg_search_module _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
     set(_pkg_modules_found 0)
-    _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
+    _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
 
     if (NOT ${_pkg_is_silent})
       message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
@@ -412,7 +534,7 @@ macro(pkg_search_module _prefix _module0)
     # iterate through all modules and stop at the first working one.
     foreach(_pkg_alt ${_pkg_modules_alt})
       if(NOT _pkg_modules_found)
-        _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+        _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}")
       endif()
 
       if (${_prefix}_FOUND)
@@ -430,6 +552,26 @@ macro(pkg_search_module _prefix _module0)
   endif()
 endmacro()
 
+
+#[========================================[.rst:
+.. variable:: PKG_CONFIG_EXECUTABLE
+
+ Path to the pkg-config executable.
+
+
+.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
+
+ Whether :command:`pkg_check_modules` and :command:`pkg_search_module`
+ should add the paths in :variable:`CMAKE_PREFIX_PATH`,
+ :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH`
+ cache and environment variables to ``pkg-config`` search path.
+
+ If this variable is not set, this behavior is enabled by default if
+ :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled
+ otherwise.
+#]========================================]
+
+
 ### Local Variables:
 ### mode: cmake
 ### End:

+ 18 - 9
Modules/FindPythonInterp.cmake

@@ -27,6 +27,10 @@
 # of version numbers that should be taken into account when searching
 # for Python.  You need to set this variable before calling
 # find_package(PythonInterp).
+#
+# If also calling find_package(PythonLibs), call find_package(PythonInterp)
+# first to get the currently active Python version by default with a consistent
+# version of PYTHON_LIBRARIES.
 
 #=============================================================================
 # Copyright 2005-2010 Kitware, Inc.
@@ -71,18 +75,23 @@ if(PythonInterp_FIND_VERSION)
 else()
     set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
 endif()
-
-list(APPEND _Python_NAMES python)
-
-# Search for the current active python version first
 find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})
 
 # Set up the versions we know about, in the order we will search. Always add
 # the user supplied additional versions to the front.
-set(_Python_VERSIONS
-  ${Python_ADDITIONAL_VERSIONS}
-  ${_PYTHON_FIND_OTHER_VERSIONS}
-  )
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+# If FindPythonInterp has already found the major and minor version,
+# insert that version next to get consistent versions of the interpreter and
+# library.
+if(DEFINED PYTHONLIBS_VERSION_STRING)
+  string(REPLACE "." ";" _PYTHONLIBS_VERSION "${PYTHONLIBS_VERSION_STRING}")
+  list(GET _PYTHONLIBS_VERSION 0 _PYTHONLIBS_VERSION_MAJOR)
+  list(GET _PYTHONLIBS_VERSION 1 _PYTHONLIBS_VERSION_MINOR)
+  list(APPEND _Python_VERSIONS ${_PYTHONLIBS_VERSION_MAJOR}.${_PYTHONLIBS_VERSION_MINOR})
+endif()
+# Search for the current active python version first
+list(APPEND _Python_VERSIONS ";")
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
 
 unset(_PYTHON_FIND_OTHER_VERSIONS)
 unset(_PYTHON1_VERSIONS)
@@ -91,7 +100,7 @@ unset(_PYTHON3_VERSIONS)
 
 # Search for newest python version if python executable isn't found
 if(NOT PYTHON_EXECUTABLE)
-    foreach(_CURRENT_VERSION ${_Python_VERSIONS})
+    foreach(_CURRENT_VERSION IN LISTS _Python_VERSIONS)
       set(_Python_NAMES python${_CURRENT_VERSION})
       if(WIN32)
         list(APPEND _Python_NAMES python)

+ 12 - 4
Modules/FindPythonLibs.cmake

@@ -31,6 +31,10 @@
 #
 #   PYTHON_LIBRARY             - path to the python library
 #   PYTHON_INCLUDE_DIR         - path to where Python.h is found
+#
+# If also calling find_package(PythonInterp), call find_package(PythonInterp)
+# first to get the currently active Python version by default with a consistent
+# version of PYTHON_LIBRARIES.
 
 #=============================================================================
 # Copyright 2001-2009 Kitware, Inc.
@@ -80,10 +84,14 @@ endif()
 
 # Set up the versions we know about, in the order we will search. Always add
 # the user supplied additional versions to the front.
-set(_Python_VERSIONS
-  ${Python_ADDITIONAL_VERSIONS}
-  ${_PYTHON_FIND_OTHER_VERSIONS}
-  )
+# If FindPythonInterp has already found the major and minor version,
+# insert that version between the user supplied versions and the stock
+# version list.
+set(_Python_VERSIONS ${Python_ADDITIONAL_VERSIONS})
+if(DEFINED PYTHON_VERSION_MAJOR AND DEFINED PYTHON_VERSION_MINOR)
+  list(APPEND _Python_VERSIONS ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR})
+endif()
+list(APPEND _Python_VERSIONS ${_PYTHON_FIND_OTHER_VERSIONS})
 
 unset(_PYTHON_FIND_OTHER_VERSIONS)
 unset(_PYTHON1_VERSIONS)

+ 11 - 9
Modules/FindQt4.cmake

@@ -335,6 +335,7 @@ endif()
 include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
 
 set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
 
@@ -613,9 +614,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     set(QT_LIBRARY_DIR ${QT_LIBRARY_DIR_TMP} CACHE INTERNAL "Qt library dir" FORCE)
     set(QT_QTCORE_FOUND 1)
   else()
-    message(WARNING "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as \"${QT_LIBRARY_DIR_TMP}\" "
-                    "but QtCore could not be found there.  "
-                    "Qt is NOT installed correctly for the target build environment.")
+    if(NOT Qt4_FIND_QUIETLY)
+      message(WARNING
+        "${QT_QMAKE_EXECUTABLE} reported QT_INSTALL_LIBS as "
+        "\"${QT_LIBRARY_DIR_TMP}\" "
+        "but QtCore could not be found there.  "
+        "Qt is NOT installed correctly for the target build environment.")
+    endif()
     set(Qt4_FOUND FALSE)
     if(Qt4_FIND_REQUIRED)
       message( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details.")
@@ -747,11 +752,10 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
   # Find out what window system we're using
   #
   #############################################
-  # Save required variable
-  set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
-  set(CMAKE_REQUIRED_FLAGS_SAVE    ${CMAKE_REQUIRED_FLAGS})
+  cmake_push_check_state()
   # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
   set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}")
+  set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY})
   # Check for Window system symbols (note: only one should end up being set)
   CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11)
   CHECK_CXX_SYMBOL_EXISTS(Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN)
@@ -771,9 +775,7 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
      endif ()
   endif ()
 
-  # Restore CMAKE_REQUIRED_INCLUDES and CMAKE_REQUIRED_FLAGS variables
-  set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
-  set(CMAKE_REQUIRED_FLAGS    ${CMAKE_REQUIRED_FLAGS_SAVE})
+  cmake_pop_check_state()
   #
   #############################################
 

+ 3 - 1
Modules/FindSDL_image.cmake

@@ -54,7 +54,9 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
   HINTS
     ENV SDLIMAGEDIR
     ENV SDLDIR
-  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+  PATH_SUFFIXES SDL
+                # path suffixes to search inside ENV{SDLDIR}
+                include/SDL include/SDL12 include/SDL11 include
 )
 
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)

+ 3 - 1
Modules/FindSDL_mixer.cmake

@@ -54,7 +54,9 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
   HINTS
     ENV SDLMIXERDIR
     ENV SDLDIR
-  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+  PATH_SUFFIXES SDL
+                # path suffixes to search inside ENV{SDLDIR}
+                include/SDL include/SDL12 include/SDL11 include
 )
 
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)

+ 3 - 1
Modules/FindSDL_net.cmake

@@ -54,7 +54,9 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
   HINTS
     ENV SDLNETDIR
     ENV SDLDIR
-  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+  PATH_SUFFIXES SDL
+                # path suffixes to search inside ENV{SDLDIR}
+                include/SDL include/SDL12 include/SDL11 include
 )
 
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)

+ 3 - 1
Modules/FindSDL_sound.cmake

@@ -98,7 +98,9 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
   HINTS
     ENV SDLSOUNDDIR
     ENV SDLDIR
-  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+  PATH_SUFFIXES SDL
+                # path suffixes to search inside ENV{SDLDIR}
+                include/SDL include/SDL12 include/SDL11 include
   )
 
 find_library(SDL_SOUND_LIBRARY

+ 3 - 1
Modules/FindSDL_ttf.cmake

@@ -54,7 +54,9 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
   HINTS
     ENV SDLTTFDIR
     ENV SDLDIR
-  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
+  PATH_SUFFIXES SDL
+                # path suffixes to search inside ENV{SDLDIR}
+                include/SDL include/SDL12 include/SDL11 include
 )
 
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)

+ 19 - 17
Modules/FindThreads.cmake

@@ -37,6 +37,8 @@ include (CheckIncludeFiles)
 include (CheckLibraryExists)
 include (CheckSymbolExists)
 set(Threads_FOUND FALSE)
+set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+set(CMAKE_REQUIRED_QUIET ${Threads_FIND_QUIETLY})
 
 # Do we have sproc?
 if(CMAKE_SYSTEM MATCHES IRIX AND NOT CMAKE_THREAD_PREFER_PTHREAD)
@@ -63,32 +65,31 @@ else()
         set(CMAKE_THREAD_LIBS_INIT "")
         set(CMAKE_HAVE_THREADS_LIBRARY 1)
         set(Threads_FOUND TRUE)
-      endif()
+      else()
 
-      if(NOT CMAKE_HAVE_THREADS_LIBRARY)
         # 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)
-        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)
-        endif()
+        else()
 
-        if(CMAKE_SYSTEM 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")
+          # 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")
+            # 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()
         endif()
       endif()
@@ -96,7 +97,7 @@ else()
 
     if(NOT CMAKE_HAVE_THREADS_LIBRARY)
       # If we did not found -lpthread, -lpthread, or -lthread, look for -pthread
-      if("THREADS_HAVE_PTHREAD_ARG" MATCHES "^THREADS_HAVE_PTHREAD_ARG")
+      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}
@@ -174,5 +175,6 @@ if(CMAKE_USE_PTHREADS_INIT)
   endif()
 endif()
 
+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)

+ 3 - 0
Modules/FindX11.cmake

@@ -73,6 +73,8 @@ if (UNIX)
   # found in tcl on the mac
   set(CMAKE_FIND_FRAMEWORK_SAVE ${CMAKE_FIND_FRAMEWORK})
   set(CMAKE_FIND_FRAMEWORK NEVER)
+  set(CMAKE_REQUIRED_QUIET_SAVE ${CMAKE_REQUIRED_QUIET})
+  set(CMAKE_REQUIRED_QUIET ${X11_FIND_QUIETLY})
   set(X11_INC_SEARCH_PATH
     /usr/pkg/xorg/include
     /usr/X11R6/include
@@ -507,6 +509,7 @@ if (UNIX)
     X11_XSync_INCLUDE_PATH
   )
   set(CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK_SAVE})
+  set(CMAKE_REQUIRED_QUIET ${CMAKE_REQUIRED_QUIET_SAVE})
 endif ()
 
 # X11_FIND_REQUIRED_<component> could be checked too

Some files were not shown because too many files changed in this diff