Browse Source

Merge topic 'LINK_LIBRARIES-property' into rpath-use-implicit-link-dirs

Resolve a logical conflict in the signature of cmTarget::GetLinkClosure.
Brad King 12 years ago
parent
commit
95a9c80cac
100 changed files with 1575 additions and 993 deletions
  1. 24 0
      CMakeCPackOptions.cmake.in
  2. 23 2
      CMakeLists.txt
  3. 1 0
      CTestCustom.cmake.in
  4. 6 0
      CompileFlags.cmake
  5. 1 1
      Modules/BundleUtilities.cmake
  6. 16 0
      Modules/CMakeAddNewLanguage.txt
  7. 13 9
      Modules/CMakeDetermineCompilerId.cmake
  8. 2 0
      Modules/CMakeDetermineJavaCompiler.cmake
  9. 6 0
      Modules/CMakeDetermineSystem.cmake
  10. 1 1
      Modules/CMakeExpandImportedTargets.cmake
  11. 2 0
      Modules/CMakeFindEclipseCDT4.cmake
  12. 5 0
      Modules/CMakePackageConfigHelpers.cmake
  13. 6 1
      Modules/CPack.cmake
  14. 2 4
      Modules/CPackDeb.cmake
  15. 2 4
      Modules/CPackRPM.cmake
  16. 109 0
      Modules/CPackWIX.cmake
  17. 1 1
      Modules/CTestUseLaunchers.cmake
  18. 8 0
      Modules/Compiler/TI_DSP-ASM.cmake
  19. 10 0
      Modules/Compiler/TI_DSP-C.cmake
  20. 10 0
      Modules/Compiler/TI_DSP-CXX.cmake
  21. 3 3
      Modules/CompilerId/VS-7.vcproj.in
  22. 1 1
      Modules/DeployQt4.cmake
  23. 78 5
      Modules/ExternalProject.cmake
  24. 1 1
      Modules/FeatureSummary.cmake
  25. 1 1
      Modules/FindBISON.cmake
  26. 2 2
      Modules/FindBLAS.cmake
  27. 1 1
      Modules/FindBZip2.cmake
  28. 748 813
      Modules/FindBoost.cmake
  29. 2 0
      Modules/FindBullet.cmake
  30. 1 1
      Modules/FindCups.cmake
  31. 1 1
      Modules/FindCurses.cmake
  32. 6 4
      Modules/FindFLEX.cmake
  33. 1 1
      Modules/FindFLTK.cmake
  34. 3 0
      Modules/FindFreetype.cmake
  35. 2 2
      Modules/FindGIF.cmake
  36. 1 1
      Modules/FindGLU.cmake
  37. 1 1
      Modules/FindGnuplot.cmake
  38. 1 1
      Modules/FindHDF5.cmake
  39. 56 0
      Modules/FindIcotool.cmake
  40. 9 0
      Modules/FindJNI.cmake
  41. 7 0
      Modules/FindJava.cmake
  42. 1 1
      Modules/FindKDE3.cmake
  43. 2 2
      Modules/FindLAPACK.cmake
  44. 1 1
      Modules/FindLua51.cmake
  45. 1 1
      Modules/FindMPEG2.cmake
  46. 1 1
      Modules/FindMPI.cmake
  47. 1 1
      Modules/FindOpenGL.cmake
  48. 2 2
      Modules/FindOpenMP.cmake
  49. 1 1
      Modules/FindOpenSceneGraph.cmake
  50. 6 3
      Modules/FindPackageHandleStandardArgs.cmake
  51. 1 1
      Modules/FindPerl.cmake
  52. 1 1
      Modules/FindPerlLibs.cmake
  53. 1 1
      Modules/FindPythonLibs.cmake
  54. 24 6
      Modules/FindQt.cmake
  55. 4 2
      Modules/FindQt3.cmake
  56. 12 8
      Modules/FindQt4.cmake
  57. 1 1
      Modules/FindSDL.cmake
  58. 2 1
      Modules/FindSDL_image.cmake
  59. 2 1
      Modules/FindSDL_mixer.cmake
  60. 2 1
      Modules/FindSDL_net.cmake
  61. 2 1
      Modules/FindSDL_sound.cmake
  62. 2 1
      Modules/FindSDL_ttf.cmake
  63. 1 1
      Modules/FindSelfPackers.cmake
  64. 147 12
      Modules/FindSquish.cmake
  65. 11 3
      Modules/FindTCL.cmake
  66. 1 1
      Modules/FindTclStub.cmake
  67. 1 1
      Modules/FindUnixCommands.cmake
  68. 2 2
      Modules/FindVTK.cmake
  69. 1 1
      Modules/FindWget.cmake
  70. 3 3
      Modules/FindX11.cmake
  71. 1 1
      Modules/Findosg.cmake
  72. 1 1
      Modules/FindosgAnimation.cmake
  73. 1 1
      Modules/FindosgDB.cmake
  74. 1 1
      Modules/FindosgFX.cmake
  75. 1 1
      Modules/FindosgGA.cmake
  76. 1 1
      Modules/FindosgIntrospection.cmake
  77. 1 1
      Modules/FindosgManipulator.cmake
  78. 1 1
      Modules/FindosgParticle.cmake
  79. 1 1
      Modules/FindosgPresentation.cmake
  80. 1 1
      Modules/FindosgProducer.cmake
  81. 1 1
      Modules/FindosgQt.cmake
  82. 1 1
      Modules/FindosgShadow.cmake
  83. 1 1
      Modules/FindosgSim.cmake
  84. 1 1
      Modules/FindosgTerrain.cmake
  85. 1 1
      Modules/FindosgText.cmake
  86. 1 1
      Modules/FindosgUtil.cmake
  87. 1 1
      Modules/FindosgViewer.cmake
  88. 1 1
      Modules/FindosgVolume.cmake
  89. 1 1
      Modules/FindosgWidget.cmake
  90. 1 1
      Modules/FindwxWindows.cmake
  91. 5 2
      Modules/NSIS.template.in
  92. 17 0
      Modules/Platform/Darwin.cmake
  93. 11 13
      Modules/Platform/FreeBSD.cmake
  94. 11 13
      Modules/Platform/NetBSD.cmake
  95. 4 0
      Modules/Platform/OpenBSD.cmake
  96. 1 1
      Modules/Platform/Windows-Intel.cmake
  97. 8 3
      Modules/Platform/Windows-MSVC.cmake
  98. 24 0
      Modules/Squish4RunTestCase.bat
  99. 28 0
      Modules/Squish4RunTestCase.sh
  100. 35 17
      Modules/SquishTestScript.cmake

+ 24 - 0
CMakeCPackOptions.cmake.in

@@ -51,3 +51,27 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
     set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
   endif()
 endif()
+
+if("${CPACK_GENERATOR}" STREQUAL "WIX")
+  # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction.
+  # But the file names still use the full CMake_VERSION value:
+  set(CPACK_PACKAGE_FILE_NAME
+    "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}")
+  set(CPACK_SOURCE_PACKAGE_FILE_NAME
+    "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source")
+
+  if(NOT CPACK_WIX_SIZEOF_VOID_P)
+    set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
+  endif()
+
+  set(CPACK_PACKAGE_VERSION
+    "@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@")
+  # WIX installers require at most a 4 component version number, where
+  # each component is an integer between 0 and 65534 inclusive
+  set(tweak "@CMake_VERSION_TWEAK@")
+  if(tweak MATCHES "^[0-9]+$")
+    if(tweak GREATER 0 AND tweak LESS 65535)
+      set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${tweak}")
+    endif()
+  endif()
+endif()

+ 23 - 2
CMakeLists.txt

@@ -234,8 +234,6 @@ macro (CMAKE_BUILD_UTILITIES)
   set(kwsys_folder "Utilities/KWSys")
   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
-  CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}")
-  CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}")
   if(BUILD_TESTING)
     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
@@ -585,6 +583,29 @@ option(CMAKE_STRICT
   "Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
 mark_as_advanced(CMAKE_STRICT)
 
+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
+    )
+    set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
+                       -Wshadow -Wpointer-arith -Wformat-security
+    )
+
+    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()
+
+    unset(C_FLAGS_LIST)
+    unset(CXX_FLAGS_LIST)
+  endif()
+endif()
 
 # build the remaining subdirectories
 add_subdirectory(Source)

+ 1 - 0
CTestCustom.cmake.in

@@ -31,6 +31,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
   "remark: .*LOOP WAS VECTORIZED"
   "warning .980: wrong number of actual arguments to intrinsic function .std::basic_"
   "LINK : warning LNK4089: all references to.*ADVAPI32.dll.*discarded by /OPT:REF"
+  "LINK : warning LNK4089: all references to.*PSAPI.DLL.*discarded by /OPT:REF"
   "LINK : warning LNK4089: all references to.*USER32.dll.*discarded by /OPT:REF"
   "Warning: library was too large for page size.*"
   "Warning: public.*_archive_.*in module.*archive_*clashes with prior module.*archive_.*"

+ 6 - 0
CompileFlags.cmake

@@ -62,3 +62,9 @@ endif ()
 if (CMAKE_ANSI_CFLAGS)
   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
 endif ()
+
+# avoid binutils problem with large binaries, e.g. when building CMake in debug mode
+# See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
+if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
+  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*")
+endif ()

+ 1 - 1
Modules/BundleUtilities.cmake

@@ -369,7 +369,7 @@ function(set_bundle_key_values keys_var context item exepath dirs copyflag)
       # For frameworks, construct the name under the embedded path from the
       # opening "${item_name}.framework/" to the closing "/${item_name}":
       #
-      string(REGEX REPLACE "^.*(${item_name}.framework/.*/${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}")
+      string(REGEX REPLACE "^.*(${item_name}.framework/.*/?${item_name}).*$" "${default_embedded_path}/\\1" embedded_item "${item}")
     else()
       # For other items, just use the same name as the original, but in the
       # embedded path:

+ 16 - 0
Modules/CMakeAddNewLanguage.txt

@@ -1,3 +1,19 @@
+This file provides a few notes to CMake developers about how to add
+support for a new language to CMake.  It is also possible to place
+these files in CMAKE_MODULE_PATH within an outside project to add
+languages not supported by upstream CMake.  However, this is not
+a fully supported use case.
+
+The implementation behind the scenes of project/enable_language,
+including the compiler/platform modules, is an *internal* API that
+does not make any compatibility guarantees.  It is not covered in the
+official reference documentation that is versioned with the source code.
+Maintainers of external language support are responsible for porting
+it to each version of CMake as upstream changes are made.  Since
+the API is internal we will not necessarily include notice of any
+changes in release notes.
+
+
 CMakeDetermine(LANG)Compiler.cmake  -> this should find the compiler for LANG and configure CMake(LANG)Compiler.cmake.in
 
 CMake(LANG)Compiler.cmake.in  -> used by CMakeDetermine(LANG)Compiler.cmake

+ 13 - 9
Modules/CMakeDetermineCompilerId.cmake

@@ -107,11 +107,14 @@ Id flags: ${testflags}
 ")
 
   # Compile the compiler identification source.
-  if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?")
+  if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
     set(vs_version ${CMAKE_MATCH_1})
-    set(vs_arch ${CMAKE_MATCH_4})
+    set(id_arch ${CMAKE_VS_PLATFORM_NAME})
     set(id_lang "${lang}")
     set(id_cl cl.exe)
+    if(NOT id_arch)
+      set(id_arch Win32)
+    endif()
     if(NOT "${vs_version}" VERSION_LESS 10)
       set(v 10)
       set(ext vcxproj)
@@ -123,25 +126,26 @@ Id flags: ${testflags}
       set(v 6)
       set(ext dsp)
     endif()
-    if("${vs_arch}" STREQUAL "Win64")
-      set(id_machine_7 17)
+    if("${id_arch}" STREQUAL "x64")
       set(id_machine_10 MachineX64)
-      set(id_arch x64)
-    elseif("${vs_arch}" STREQUAL "IA64")
-      set(id_machine_7 5)
+    elseif("${id_arch}" STREQUAL "Itanium")
       set(id_machine_10 MachineIA64)
       set(id_arch ia64)
     else()
       set(id_machine_6 x86)
-      set(id_machine_7 1)
       set(id_machine_10 MachineX86)
-      set(id_arch Win32)
     endif()
     if(CMAKE_VS_PLATFORM_TOOLSET)
       set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
     else()
       set(id_toolset "")
     endif()
+    if(CMAKE_VS_WINCE_VERSION)
+      set(id_entrypoint "mainACRTStartup")
+      set(id_subsystem 9)
+    else()
+      set(id_subsystem 1)
+    endif()
     if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
       set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0)
     elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")

+ 2 - 0
Modules/CMakeDetermineJavaCompiler.cmake

@@ -63,6 +63,8 @@ if(NOT CMAKE_Java_COMPILER)
     /usr/java/j2sdk1.4.2_09/bin
     /usr/lib/j2sdk1.5-sun/bin
     /opt/sun-jdk-1.5.0.04/bin
+    /usr/local/jdk-1.7.0/bin
+    /usr/local/jdk-1.6.0/bin
     )
   # if no compiler has been specified yet, then look for one
   if(CMAKE_Java_COMPILER_INIT)

+ 6 - 0
Modules/CMakeDetermineSystem.cmake

@@ -106,6 +106,12 @@ if(CMAKE_SYSTEM_NAME)
     set(CMAKE_CROSSCOMPILING TRUE)
   endif()
   set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_VS_WINCE_VERSION)
+  set(CMAKE_SYSTEM_NAME      "WindowsCE")
+  set(CMAKE_SYSTEM_VERSION   "${CMAKE_VS_WINCE_VERSION}")
+  set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
+  set(CMAKE_CROSSCOMPILING TRUE)
+  set(PRESET_CMAKE_SYSTEM_NAME TRUE)
 else()
   set(CMAKE_SYSTEM_NAME      "${CMAKE_HOST_SYSTEM_NAME}")
   set(CMAKE_SYSTEM_VERSION   "${CMAKE_HOST_SYSTEM_VERSION}")

+ 1 - 1
Modules/CMakeExpandImportedTargets.cmake

@@ -30,7 +30,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(CMakeParseArguments)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
 
 function(CMAKE_EXPAND_IMPORTED_TARGETS _RESULT )
 

+ 2 - 0
Modules/CMakeFindEclipseCDT4.cmake

@@ -77,6 +77,8 @@ endif()
 # This variable is used by the Eclipse generator and appended to the make invocation commands.
 set(CMAKE_ECLIPSE_MAKE_ARGUMENTS "${_CMAKE_ECLIPSE_INITIAL_MAKE_ARGS}" CACHE STRING "Additional command line arguments when Eclipse invokes make. Enter e.g. -j<some_number> to get parallel builds")
 
+set(CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES TRUE CACHE BOOL "If disabled, CMake will not generate linked resource to the subprojects and to the source files within targets")
+
 # This variable is used by the Eclipse generator in out-of-source builds only.
 set(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT FALSE CACHE BOOL "If enabled, CMake will generate a source project for Eclipse in CMAKE_SOURCE_DIR")
 mark_as_advanced(CMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT)

+ 5 - 0
Modules/CMakePackageConfigHelpers.cmake

@@ -188,8 +188,13 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
     endif()
   endforeach()
 
+  get_filename_component(inputFileName "${_inputFile}" NAME)
+
   set(PACKAGE_INIT "
 ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
+####### Any changes to this file will be overwritten by the next CMake run ####
+####### The input file was ${inputFileName}                            ########
+
 get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
 ")
 

+ 6 - 1
Modules/CPack.cmake

@@ -438,6 +438,7 @@ if(NOT CPACK_GENERATOR)
     endif()
   else()
     option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+    option(CPACK_BINARY_WIX  "Enable to build WiX packages" OFF)
     option(CPACK_BINARY_ZIP  "Enable to build ZIP packages" OFF)
   endif()
 
@@ -453,6 +454,7 @@ if(NOT CPACK_GENERATOR)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_WIX          WIX)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)
 
 endif()
@@ -483,7 +485,7 @@ endif()
 mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
                  CPACK_BINARY_STGZ   CPACK_BINARY_TGZ          CPACK_BINARY_TBZ2
                  CPACK_BINARY_DEB    CPACK_BINARY_RPM          CPACK_BINARY_TZ
-                 CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
+                 CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
                  CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
                  CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
 
@@ -522,6 +524,9 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
 cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
 cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
 
+# WiX specific variables
+cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+
 if(DEFINED CPACK_COMPONENTS_ALL)
   if(CPACK_MONOLITHIC_INSTALL)
     message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")

+ 2 - 4
Modules/CPackDeb.cmake

@@ -385,15 +385,13 @@ endif()
 # Are we packaging components ?
 if(CPACK_DEB_PACKAGE_COMPONENT)
   set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "-${CPACK_DEB_PACKAGE_COMPONENT}")
-  set(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "/${CPACK_DEB_PACKAGE_COMPONENT}")
-  set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_DEB_PACKAGE_COMPONENT}")
   string(TOLOWER "${CPACK_PACKAGE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_NAME}" CPACK_DEBIAN_PACKAGE_NAME)
 else()
   set(CPACK_DEB_PACKAGE_COMPONENT_PART_NAME "")
-  set(CPACK_DEB_PACKAGE_COMPONENT_PART_PATH "")
-  set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
 endif()
 
+set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}")
+
 # Print out some debug information if we were asked for that
 if(CPACK_DEBIAN_PACKAGE_DEBUG)
    message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY          = ${CPACK_TOPLEVEL_DIRECTORY}")

+ 2 - 4
Modules/CPackRPM.cmake

@@ -311,14 +311,12 @@ endif()
 # Are we packaging components ?
 if(CPACK_RPM_PACKAGE_COMPONENT)
   set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}")
-  set(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "/${CPACK_RPM_PACKAGE_COMPONENT}")
-  set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${CPACK_RPM_PACKAGE_COMPONENT}")
 else()
   set(CPACK_RPM_PACKAGE_COMPONENT_PART_NAME "")
-  set(CPACK_RPM_PACKAGE_COMPONENT_PART_PATH "")
-  set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}")
 endif()
 
+set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}")
+
 #
 # Use user-defined RPM specific variables value
 # or generate reasonable default value from

+ 109 - 0
Modules/CPackWIX.cmake

@@ -0,0 +1,109 @@
+##section Variables specific to CPack WiX generator
+##end
+##module
+# - CPack WiX generator specific options
+#
+# The following variables are specific to the installers built
+# on Windows using WiX.
+##end
+##variable
+#  CPACK_WIX_UPGRADE_GUID - Upgrade GUID (Product/@UpgradeCode)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# It should be explicitly set to a constant generated
+# gloabally unique identifier (GUID) to allow your installers
+# to replace existing installations that use the same GUID.
+#
+# You may for example explicitly set this variable in
+# your CMakeLists.txt to the value that has been generated per default.
+# You should not use GUIDs that you did not generate yourself or which may
+# belong to other projects.
+#
+# A GUID shall have the following fixed length syntax:
+# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+#  (each X represents an uppercase hexadecimal digit)
+##end
+##variable
+#  CPACK_WIX_PRODUCT_GUID - Product GUID (Product/@Id)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# If explicitly provided this will set the Product Id of your installer.
+#
+# The installer will abort if it detects a pre-existing installation that uses
+# the same GUID.
+#
+# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
+##end
+##variable
+#  CPACK_WIX_LICENSE_RTF - RTF License File
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension
+# it is used as-is.
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension
+# it is implicitly converted to RTF by the WiX Generator.
+#
+# With CPACK_WIX_LICENSE_RTF you can override the license file used
+# by the WiX Generator in case CPACK_RESOURCE_FILE_LICENSE
+# is in an unsupported format or the .txt -> .rtf
+# conversion does not work as expected.
+#
+##end
+#
+##variable
+# CPACK_WIX_PRODUCT_ICON - The Icon shown next to the program name in Add/Remove programs.
+#
+# If set, this icon is used in place of the default icon.
+#
+##end
+#
+##variable
+# CPACK_WIX_UI_BANNER - The bitmap will appear at the top of all installer pages other than the welcome and completion dialogs.
+#
+# If set, this image will replace the default banner image.
+#
+# This image must be 493 by 58 pixels.
+#
+##end
+#
+##variable
+# CPACK_WIX_UI_DIALOG - Background bitmap used on the welcome and completion dialogs.
+#
+# If this variable is set, the installer will replace the default dialog image.
+#
+# This image must be 493 by 312 pixels.
+#
+##end
+
+#=============================================================================
+# Copyright 2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if(NOT CPACK_WIX_ROOT)
+  file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
+endif()
+
+find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
+  PATHS "${CPACK_WIX_ROOT}/bin")
+
+if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
+  message(FATAL_ERROR "Could not find the WiX candle executable.")
+endif()
+
+find_program(CPACK_WIX_LIGHT_EXECUTABLE light
+  PATHS "${CPACK_WIX_ROOT}/bin")
+
+if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
+  message(FATAL_ERROR "Could not find the WiX light executable.")
+endif()

+ 1 - 1
Modules/CTestUseLaunchers.cmake

@@ -35,7 +35,7 @@ if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
     CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV")
 endif()
 
-if(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
+if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
   set(CTEST_USE_LAUNCHERS 0)
 endif()
 

+ 8 - 0
Modules/Compiler/TI_DSP-ASM.cmake

@@ -0,0 +1,8 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_ASM "--include_path=")
+
+set(CMAKE_ASM_COMPILE_OBJECT  "<CMAKE_ASM_COMPILER> --compile_only --asm_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_ASM_LINK_EXECUTABLE "<CMAKE_ASM_COMPILER> <OBJECTS> --run_linker --output_file=<TARGET> <CMAKE_ASM_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>")
+
+set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS asm;s;abs)

+ 10 - 0
Modules/Compiler/TI_DSP-C.cmake

@@ -0,0 +1,10 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_C "--include_path=")
+
+set(CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> --compile_only --skip_assembler --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> --preproc_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+
+set(CMAKE_C_COMPILE_OBJECT  "<CMAKE_C_COMPILER> --compile_only --c_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
+set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_C_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")

+ 10 - 0
Modules/Compiler/TI_DSP-CXX.cmake

@@ -0,0 +1,10 @@
+set(CMAKE_LIBRARY_PATH_FLAG "--search_path=")
+set(CMAKE_LINK_LIBRARY_FLAG "--library=")
+set(CMAKE_INCLUDE_FLAG_CXX "--include_path=")
+
+set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> --compile_only --skip_assembler --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<ASSEMBLY_SOURCE>")
+set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> --preproc_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<PREPROCESSED_SOURCE>")
+
+set(CMAKE_CXX_COMPILE_OBJECT  "<CMAKE_CXX_COMPILER> --compile_only --cpp_file=<SOURCE> <DEFINES> <FLAGS> --output_file=<OBJECT>")
+set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> -r <TARGET> <OBJECTS>")
+set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> --run_linker --output_file=<TARGET> --map_file=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_LIBRARIES> <LINK_FLAGS> <OBJECTS>")

+ 3 - 3
Modules/CompilerId/VS-7.vcproj.in

@@ -24,7 +24,6 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				PreprocessorDefinitions=""
 				MinimalRebuild="false"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -35,9 +34,10 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkIncremental="1"
+				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="false"
-				SubSystem="1"
-				TargetMachine="@id_machine_7@"
+				SubSystem="@id_subsystem@"
+				EntryPointSymbol="@id_entrypoint@"
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"

+ 1 - 1
Modules/DeployQt4.cmake

@@ -80,7 +80,7 @@
 # The functions defined in this file depend on the fixup_bundle function
 # (and others) found in BundleUtilities.cmake
 
-include(BundleUtilities)
+include("${CMAKE_CURRENT_LIST_DIR}/BundleUtilities.cmake")
 set(DeployQt4_cmake_dir "${CMAKE_CURRENT_LIST_DIR}")
 set(DeployQt4_apple_plugins_dir "PlugIns")
 

+ 78 - 5
Modules/ExternalProject.cmake

@@ -402,6 +402,79 @@ endif()
 endfunction()
 
 
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_repository work_dir)
+  file(WRITE ${script_filename}
+"if(\"${git_tag}\" STREQUAL \"\")
+  message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
+endif()
+
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 HEAD
+  WORKING_DIRECTORY \"${work_dir}\"
+  RESULT_VARIABLE error_code
+  OUTPUT_VARIABLE head_sha
+  )
+if(error_code)
+  message(FATAL_ERROR \"Failed to get the hash for HEAD\")
+endif()
+
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" show-ref ${git_tag}
+  WORKING_DIRECTORY \"${work_dir}\"
+  OUTPUT_VARIABLE show_ref_output
+  )
+# If a remote ref is asked for, which can possibly move around,
+# we must always do a fetch and checkout.
+if(\"\${show_ref_output}\" MATCHES \"remotes\")
+  set(is_remote_ref 1)
+else()
+  set(is_remote_ref 0)
+endif()
+
+# This will fail if the tag does not exist (it probably has not been fetched
+# yet).
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 ${git_tag}
+  WORKING_DIRECTORY \"${work_dir}\"
+  RESULT_VARIABLE error_code
+  OUTPUT_VARIABLE tag_sha
+  )
+
+# Is the hash checkout out that we want?
+if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"))
+  execute_process(
+    COMMAND \"${git_EXECUTABLE}\" fetch
+    WORKING_DIRECTORY \"${work_dir}\"
+    RESULT_VARIABLE error_code
+    )
+  if(error_code)
+    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}'\")
+  endif()
+
+  execute_process(
+    COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+    WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+    RESULT_VARIABLE error_code
+    )
+  if(error_code)
+    message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
+  endif()
+endif()
+
+"
+)
+
+endfunction(_ep_write_gitupdate_script)
+
 function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo)
   if(timeout)
     set(timeout_args TIMEOUT ${timeout})
@@ -1354,7 +1427,7 @@ endfunction()
 
 
 function(_ep_add_update_command name)
-  ExternalProject_Get_Property(${name} source_dir)
+  ExternalProject_Get_Property(${name} source_dir tmp_dir)
 
   get_property(cmd_set TARGET ${name} PROPERTY _EP_UPDATE_COMMAND SET)
   get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND)
@@ -1406,15 +1479,15 @@ function(_ep_add_update_command name)
       message(FATAL_ERROR "error: could not find git for fetch of ${name}")
     endif()
     set(work_dir ${source_dir})
-    set(comment "Performing update step (git fetch) for '${name}'")
+    set(comment "Performing update step for '${name}'")
     get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
     if(NOT git_tag)
       set(git_tag "master")
     endif()
-    set(cmd ${GIT_EXECUTABLE} fetch
-      COMMAND ${GIT_EXECUTABLE} checkout ${git_tag}
-      COMMAND ${GIT_EXECUTABLE} submodule update --recursive
+    _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
+      ${GIT_EXECUTABLE} ${git_tag} ${git_repository} ${work_dir}
       )
+    set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
     set(always 1)
   elseif(hg_repository)
     if(NOT HG_EXECUTABLE)

+ 1 - 1
Modules/FeatureSummary.cmake

@@ -177,7 +177,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(CMakeParseArguments)
+include("${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake")
 
 
 function(ADD_FEATURE_INFO _name _enabled _desc)

+ 1 - 1
Modules/FindBISON.cmake

@@ -47,7 +47,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(BISON_EXECUTABLE bison DOC "path to the bison executable")
+find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
 mark_as_advanced(BISON_EXECUTABLE)
 
 if(BISON_EXECUTABLE)

+ 2 - 2
Modules/FindBLAS.cmake

@@ -40,8 +40,8 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(CheckFunctionExists)
-include(CheckFortranFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
 
 set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 

+ 1 - 1
Modules/FindBZip2.cmake

@@ -49,7 +49,7 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZip2
                                   VERSION_VAR BZIP2_VERSION_STRING)
 
 if (BZIP2_FOUND)
-   include(CheckLibraryExists)
+   include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
    CHECK_LIBRARY_EXISTS("${BZIP2_LIBRARIES}" BZ2_bzCompressInit "" BZIP2_NEED_PREFIX)
 endif ()
 

+ 748 - 813
Modules/FindBoost.cmake

@@ -1,248 +1,141 @@
-# - Try to find Boost include dirs and libraries
-# Usage of this module as follows:
-#
-# NOTE: Take note of the Boost_ADDITIONAL_VERSIONS variable below.
-# Due to Boost naming conventions and limitations in CMake this find
-# module is NOT future safe with respect to Boost version numbers,
-# and may break.
-#
-# == Using Header-Only libraries from within Boost: ==
-#
-#   find_package( Boost 1.36.0 )
-#   if(Boost_FOUND)
-#      include_directories(${Boost_INCLUDE_DIRS})
-#      add_executable(foo foo.cc)
-#   endif()
-#
-#
-# == Using actual libraries from within Boost: ==
-#
-#   set(Boost_USE_STATIC_LIBS        ON)
-#   set(Boost_USE_MULTITHREADED      ON)
-#   set(Boost_USE_STATIC_RUNTIME    OFF)
-#   find_package( Boost 1.36.0 COMPONENTS date_time filesystem system ... )
-#
-#   if(Boost_FOUND)
-#      include_directories(${Boost_INCLUDE_DIRS})
-#      add_executable(foo foo.cc)
-#      target_link_libraries(foo ${Boost_LIBRARIES})
-#   endif()
-#
-#
-# The components list needs to contain actual names of boost libraries only,
-# such as "date_time" for "libboost_date_time".  If you're using parts of
-# Boost that contain header files only (e.g. foreach) you do not need to
-# specify COMPONENTS.
-#
-# You should provide a minimum version number that should be used. If you provide this
-# version number and specify the REQUIRED attribute, this module will fail if it
-# can't find the specified or a later version. If you specify a version number this is
-# automatically put into the considered list of version numbers and thus doesn't need
-# to be specified in the Boost_ADDITIONAL_VERSIONS variable (see below).
-#
-# NOTE for Visual Studio Users:
-#     Automatic linking is used on MSVC & Borland compilers by default when
-#     #including things in Boost.  It's important to note that setting
-#     Boost_USE_STATIC_LIBS to OFF is NOT enough to get you dynamic linking,
-#     should you need this feature.  Automatic linking typically uses static
-#     libraries with a few exceptions (Boost.Python is one).
-#
-#     Please see the section below near Boost_LIB_DIAGNOSTIC_DEFINITIONS for
-#     more details.  Adding a target_link_libraries() as shown in the example
-#     above appears to cause VS to link dynamically if Boost_USE_STATIC_LIBS
-#     gets set to OFF.  It is suggested you avoid automatic linking since it
-#     will make your application less portable.
-#
-# =========== The mess that is Boost_ADDITIONAL_VERSIONS (sorry?) ============
-#
-# OK, so the Boost_ADDITIONAL_VERSIONS variable can be used to specify a list of
-# boost version numbers that should be taken into account when searching
-# for Boost. Unfortunately boost puts the version number into the
-# actual filename for the libraries, so this variable will certainly be needed
-# in the future when new Boost versions are released.
-#
-# Currently this module searches for the following version numbers:
-# 1.33, 1.33.0, 1.33.1, 1.34, 1.34.0, 1.34.1, 1.35, 1.35.0, 1.35.1,
-# 1.36, 1.36.0, 1.36.1, 1.37, 1.37.0, 1.38, 1.38.0, 1.39, 1.39.0,
-# 1.40, 1.40.0, 1.41, 1.41.0, 1.42, 1.42.0, 1.43, 1.43.0, 1.44, 1.44.0,
-# 1.45, 1.45.0, 1.46, 1.46.0, 1.46.1, 1.47, 1.47.0, 1.48, 1.48.0,
-# 1.49, 1.49.0, 1.50, 1.50.0, 1.51, 1.51.0, 1.52, 1.52.0,
-# 1.53, 1.53.0, 1.54, 1.54.0, 1.55, 1.55.0, 1.56, 1.56.0
-#
-# NOTE: If you add a new major 1.x version in Boost_ADDITIONAL_VERSIONS you should
-# add both 1.x and 1.x.0 as shown above.  Official Boost include directories
-# omit the 3rd version number from include paths if it is 0 although not all
-# binary Boost releases do so.
-#
-# set(Boost_ADDITIONAL_VERSIONS "1.78" "1.78.0" "1.79" "1.79.0")
-#
-# ===================================== ============= ========================
-#
-# Variables used by this module, they can change the default behaviour and
-# need to be set before calling find_package:
-#
-#   Boost_USE_MULTITHREADED      Can be set to OFF to use the non-multithreaded
-#                                boost libraries.  If not specified, defaults
-#                                to ON.
-#
-#   Boost_USE_STATIC_LIBS        Can be set to ON to force the use of the static
-#                                boost libraries. Defaults to OFF.
-#
-#   Boost_NO_SYSTEM_PATHS        Set to TRUE to suppress searching in system
-#                                paths (or other locations outside of BOOST_ROOT
-#                                or BOOST_INCLUDEDIR).  Useful when specifying
-#                                BOOST_ROOT. Defaults to OFF.
-#                                  [Since CMake 2.8.3]
-#
-#   Boost_NO_BOOST_CMAKE         Do not do a find_package call in config mode
-#                                before searching for a regular boost install.
-#                                This will avoid finding boost-cmake installs.
-#                                Defaults to OFF.
-#                                  [Since CMake 2.8.6]
-#
-#   Boost_USE_STATIC_RUNTIME     If enabled, searches for boost libraries
-#                                linked against a static C++ standard library
-#                                ('s' ABI tag). This option should be set to
-#                                ON or OFF because the default behavior
-#                                if not specified is platform dependent
-#                                for backwards compatibility.
-#                                  [Since CMake 2.8.3]
-#
-#   Boost_USE_DEBUG_PYTHON       If enabled, searches for boost libraries
-#                                compiled against a special debug build of
-#                                Python ('y' ABI tag). Defaults to OFF.
-#                                  [Since CMake 2.8.3]
-#
-#   Boost_USE_STLPORT            If enabled, searches for boost libraries
-#                                compiled against the STLPort standard
-#                                library ('p' ABI tag). Defaults to OFF.
-#                                  [Since CMake 2.8.3]
-#
-#   Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
-#                                If enabled, searches for boost libraries
-#                                compiled against the deprecated STLPort
-#                                "native iostreams" feature ('n' ABI tag).
-#                                Defaults to OFF.
-#                                  [Since CMake 2.8.3]
-#
-# Other Variables used by this module which you may want to set.
-#
-#   Boost_ADDITIONAL_VERSIONS    A list of version numbers to use for searching
-#                                the boost include directory.  Please see
-#                                the documentation above regarding this
-#                                annoying, but necessary variable :(
-#
-#   Boost_DEBUG                  Set this to TRUE to enable debugging output
-#                                of FindBoost.cmake if you are having problems.
-#                                Please enable this before filing any bug
-#                                reports.
-#
-#   Boost_DETAILED_FAILURE_MSG   FindBoost doesn't output detailed information
-#                                about why it failed or how to fix the problem
-#                                unless this is set to TRUE or the REQUIRED
-#                                keyword is specified in find_package().
-#                                  [Since CMake 2.8.0]
-#
-#   Boost_COMPILER               Set this to the compiler suffix used by Boost
-#                                (e.g. "-gcc43") if FindBoost has problems finding
-#                                the proper Boost installation
-#
-#   Boost_THREADAPI                When building boost.thread, sometimes the name of the
-#                                library contains an additional "pthread" or "win32"
-#                                string known as the threadapi.  This can happen when
-#                                compiling against pthreads on Windows or win32 threads
-#                                on Cygwin.  You may specify this variable and if set
-#                                when FindBoost searches for the Boost threading library
-#                                it will first try to match the threadapi you specify.
-#                                  For Example: libboost_thread_win32-mgw45-mt-1_43.a
-#                                might be found if you specified "win32" here before
-#                                falling back on libboost_thread-mgw45-mt-1_43.a.
-#                                  [Since CMake 2.8.3]
-#
-#   Boost_REALPATH               Resolves symbolic links for discovered boost libraries
-#                                to assist with packaging.  For example, instead of
-#                                Boost_SYSTEM_LIBRARY_RELEASE being resolved to
-#                                "/usr/lib/libboost_system.so" it would be
-#                                "/usr/lib/libboost_system.so.1.42.0" instead.
-#                                This does not affect linking and should not be
-#                                enabled unless the user needs this information.
-#                                  [Since CMake 2.8.3]
-#
-
-
-#
-# These last three variables are available also as environment variables:
-# Also, note they are completely UPPERCASE, except Boost_DIR.
-#
-#   Boost_DIR or                 The preferred installation prefix for searching for
-#   BOOST_ROOT or BOOSTROOT      Boost.  Set this if the module has problems finding
-#                                the proper Boost installation.
-#
-#                                Note that Boost_DIR behaves exactly as <package>_DIR
-#                                variables are documented to behave in find_package's
-#                                Config mode.  That is, if it is set as a -D argument
-#                                to CMake, it must point to the location of the
-#                                BoostConfig.cmake or Boost-config.cmake file.  If it
-#                                is set as an environment variable, it must point to
-#                                the root of the boost installation.  BOOST_ROOT and
-#                                BOOSTROOT, on the other hand, will point to the root
-#                                in either case.
-#
-#                                To prevent falling back on the system paths, set
-#                                Boost_NO_SYSTEM_PATHS to true.
-#
-#                                To avoid finding boost-cmake installations, set
-#                                Boost_NO_BOOST_CMAKE to true.
-#
-#   BOOST_INCLUDEDIR             Set this to the include directory of Boost, if the
-#                                module has problems finding the proper Boost installation
-#
-#   BOOST_LIBRARYDIR             Set this to the lib directory of Boost, if the
-#                                module has problems finding the proper Boost installation
-#
-# Variables defined by this module:
-#
-#   Boost_FOUND                         System has Boost, this means the include dir was
-#                                       found, as well as all the libraries specified in
-#                                       the COMPONENTS list.
-#
-#   Boost_INCLUDE_DIRS                  Boost include directories: not cached
-#
-#   Boost_INCLUDE_DIR                   This is almost the same as above, but this one is
-#                                       cached and may be modified by advanced users
-#
-#   Boost_LIBRARIES                     Link to these to use the Boost libraries that you
-#                                       specified: not cached
-#
-#   Boost_LIBRARY_DIRS                  The path to where the Boost library files are.
-#
-#   Boost_VERSION                       The version number of the boost libraries that
-#                                       have been found, same as in version.hpp from Boost
-#
-#   Boost_LIB_VERSION                   The version number in filename form as
-#                                       it's appended to the library filenames
-#
-#   Boost_MAJOR_VERSION                 major version number of boost
-#   Boost_MINOR_VERSION                 minor version number of boost
-#   Boost_SUBMINOR_VERSION              subminor version number of boost
-#
-#   Boost_LIB_DIAGNOSTIC_DEFINITIONS    [WIN32 Only] You can call
-#                                       add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
-#                                       to have diagnostic information about Boost's
-#                                       automatic linking outputted during compilation time.
-#
-# For each component you specify in find_package(), the following (UPPER-CASE)
-# variables are set.  You can use these variables if you would like to pick and
-# choose components for your targets instead of just using Boost_LIBRARIES.
-#
-#   Boost_${COMPONENT}_FOUND            True IF the Boost library "component" was found.
-#
-#   Boost_${COMPONENT}_LIBRARY          Contains the libraries for the specified Boost
-#                                       "component" (includes debug and optimized keywords
-#                                       when needed).
+# - Find Boost include dirs and libraries
+# Use this module by invoking find_package with the form:
+#  find_package(Boost
+#    [version] [EXACT]      # Minimum or EXACT version e.g. 1.36.0
+#    [REQUIRED]             # Fail with error if Boost is not found
+#    [COMPONENTS <libs>...] # Boost libraries by their canonical name
+#    )                      # e.g. "date_time" for "libboost_date_time"
+# This module finds headers and requested component libraries OR a CMake
+# package configuration file provided by a "Boost CMake" build.  For the
+# latter case skip to the "Boost CMake" section below.  For the former
+# case results are reported in variables:
+#  Boost_FOUND            - True if headers and requested libraries were found
+#  Boost_INCLUDE_DIRS     - Boost include directories
+#  Boost_LIBRARY_DIRS     - Link directories for Boost libraries
+#  Boost_LIBRARIES        - Boost component libraries to be linked
+#  Boost_<C>_FOUND        - True if component <C> was found (<C> is upper-case)
+#  Boost_<C>_LIBRARY      - Libraries to link for component <C> (may include
+#                           target_link_libraries debug/optimized keywords)
+#  Boost_VERSION          - BOOST_VERSION value from boost/version.hpp
+#  Boost_LIB_VERSION      - Version string appended to library filenames
+#  Boost_MAJOR_VERSION    - Boost major version number (X in X.y.z)
+#  Boost_MINOR_VERSION    - Boost minor version number (Y in x.Y.z)
+#  Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z)
+#  Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows)
+#                         - Pass to add_definitions() to have diagnostic
+#                           information about Boost's automatic linking
+#                           displayed during compilation
+#
+# This module reads hints about search locations from variables:
+#  BOOST_ROOT             - Preferred installation prefix
+#   (or BOOSTROOT)
+#  BOOST_INCLUDEDIR       - Preferred include directory e.g. <prefix>/include
+#  BOOST_LIBRARYDIR       - Preferred library directory e.g. <prefix>/lib
+#  Boost_NO_SYSTEM_PATHS  - Set to ON to disable searching in locations not
+#                           specified by these hint variables. Default is OFF.
+#  Boost_ADDITIONAL_VERSIONS
+#                         - List of Boost versions not known to this module
+#                           (Boost install locations may contain the version)
+# and saves search results persistently in CMake cache entries:
+#  Boost_INCLUDE_DIR         - Directory containing Boost headers
+#  Boost_LIBRARY_DIR         - Directory containing Boost libraries
+#  Boost_<C>_LIBRARY_DEBUG   - Component <C> library debug variant
+#  Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant
+# Users may set the these hints or results as cache entries.  Projects should
+# not read these entries directly but instead use the above result variables.
+# Note that some hint names start in upper-case "BOOST".  One may specify
+# these as environment variables if they are not specified as CMake variables
+# or cache entries.
+#
+# This module first searches for the Boost header files using the above hint
+# variables (excluding BOOST_LIBRARYDIR) and saves the result in
+# Boost_INCLUDE_DIR.  Then it searches for requested component libraries using
+# the above hints (excluding BOOST_INCLUDEDIR and Boost_ADDITIONAL_VERSIONS),
+# "lib" directories near Boost_INCLUDE_DIR, and the library name configuration
+# settings below.  It saves the library directory in Boost_LIBRARY_DIR and
+# individual library locations in Boost_<C>_LIBRARY_DEBUG and
+# Boost_<C>_LIBRARY_RELEASE.  When one changes settings used by previous
+# searches in the same build tree (excluding environment variables) this
+# module discards previous search results affected by the changes and searches
+# again.
+#
+# Boost libraries come in many variants encoded in their file name.  Users or
+# projects may tell this module which variant to find by setting variables:
+#  Boost_USE_MULTITHREADED  - Set to OFF to use the non-multithreaded
+#                             libraries ('mt' tag).  Default is ON.
+#  Boost_USE_STATIC_LIBS    - Set to ON to force the use of the static
+#                             libraries.  Default is OFF.
+#  Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use
+#                             libraries linked statically to the C++ runtime
+#                             ('s' tag).  Default is platform dependent.
+#  Boost_USE_DEBUG_PYTHON   - Set to ON to use libraries compiled with a
+#                             debug Python build ('y' tag). Default is OFF.
+#  Boost_USE_STLPORT        - Set to ON to use libraries compiled with
+#                             STLPort ('p' tag).  Default is OFF.
+#  Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
+#                           - Set to ON to use libraries compiled with
+#                             STLPort deprecated "native iostreams"
+#                             ('n' tag).  Default is OFF.
+#  Boost_COMPILER           - Set to the compiler-specific library suffix
+#                             (e.g. "-gcc43").  Default is auto-computed
+#                             for the C++ compiler in use.
+#  Boost_THREADAPI          - Suffix for "thread" component library name,
+#                             such as "pthread" or "win32".  Names with
+#                             and without this suffix will both be tried.
+# Other variables one may set to control this module are:
+#  Boost_DEBUG              - Set to ON to enable debug output from FindBoost.
+#                             Please enable this before filing any bug report.
+#  Boost_DETAILED_FAILURE_MSG
+#                           - Set to ON to add detailed information to the
+#                             failure message even when the REQUIRED option
+#                             is not given to the find_package call.
+#  Boost_REALPATH           - Set to ON to resolve symlinks for discovered
+#                             libraries to assist with packaging.  For example,
+#                             the "system" component library may be resolved to
+#                             "/usr/lib/libboost_system.so.1.42.0" instead of
+#                             "/usr/lib/libboost_system.so".  This does not
+#                             affect linking and should not be enabled unless
+#                             the user needs this information.
+# On Visual Studio and Borland compilers Boost headers request automatic
+# linking to corresponding libraries.  This requires matching libraries to be
+# linked explicitly or available in the link library search path.  In this
+# case setting Boost_USE_STATIC_LIBS to OFF may not achieve dynamic linking.
+# Boost automatic linking typically requests static libraries with a few
+# exceptions (such as Boost.Python).  Use
+#  add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
+# to ask Boost to report information about automatic linking requests.
+#
+# Example to find Boost headers only:
+#  find_package(Boost 1.36.0)
+#  if(Boost_FOUND)
+#    include_directories(${Boost_INCLUDE_DIRS})
+#    add_executable(foo foo.cc)
+#  endif()
+# Example to find Boost headers and some libraries:
+#  set(Boost_USE_STATIC_LIBS        ON)
+#  set(Boost_USE_MULTITHREADED      ON)
+#  set(Boost_USE_STATIC_RUNTIME    OFF)
+#  find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...)
+#  if(Boost_FOUND)
+#    include_directories(${Boost_INCLUDE_DIRS})
+#    add_executable(foo foo.cc)
+#    target_link_libraries(foo ${Boost_LIBRARIES})
+#  endif()
+#
+# Boost CMake ----------------------------------------------------------
+#
+# If Boost was built using the boost-cmake project it provides a package
+# configuration file for use with find_package's Config mode.  This module
+# looks for the package configuration file called BoostConfig.cmake or
+# boost-config.cmake and stores the result in cache entry "Boost_DIR".  If
+# found, the package configuration file is loaded and this module returns with
+# no further action.  See documentation of the Boost CMake package
+# configuration for details on what it provides.
+#
+# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
 
 #=============================================================================
-# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006-2012 Kitware, Inc.
 # Copyright 2006-2008 Andreas Schneider <[email protected]>
 # Copyright 2007      Wengo
 # Copyright 2007      Mike Jackson
@@ -282,6 +175,7 @@ if (NOT Boost_NO_BOOST_CMAKE)
   # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no
   # need to delegate them to this find_package call.
   find_package(Boost QUIET NO_MODULE)
+  mark_as_advanced(Boost_DIR)
 
   # If we found boost-cmake, then we're done.  Print out what we found.
   # Otherwise let the rest of the module try to find it.
@@ -349,29 +243,54 @@ macro(_Boost_ADJUST_LIB_VARS basename)
     endif()
 
     if(Boost_${basename}_LIBRARY)
-      set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY} CACHE FILEPATH "The Boost ${basename} library")
-
-      # Remove superfluous "debug" / "optimized" keywords from
-      # Boost_LIBRARY_DIRS
-      foreach(_boost_my_lib ${Boost_${basename}_LIBRARY})
-        get_filename_component(_boost_my_lib_path "${_boost_my_lib}" PATH)
-        list(APPEND Boost_LIBRARY_DIRS ${_boost_my_lib_path})
-      endforeach()
-      list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS)
-
-      set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIRS} CACHE FILEPATH "Boost library directory")
-      set(Boost_${basename}_FOUND ON CACHE INTERNAL "Whether the Boost ${basename} library found")
+      set(Boost_${basename}_FOUND ON)
     endif()
 
   endif()
   # Make variables changeble to the advanced user
   mark_as_advanced(
-      Boost_${basename}_LIBRARY
       Boost_${basename}_LIBRARY_RELEASE
       Boost_${basename}_LIBRARY_DEBUG
   )
 endmacro()
 
+macro(_Boost_CHANGE_DETECT changed_var)
+  set(${changed_var} 0)
+  foreach(v ${ARGN})
+    if(DEFINED _Boost_COMPONENTS_SEARCHED)
+      if(${v})
+        if(_${v}_LAST)
+          string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED)
+        else()
+          set(_${v}_CHANGED 1)
+        endif()
+      elseif(_${v}_LAST)
+        set(_${v}_CHANGED 1)
+      endif()
+      if(_${v}_CHANGED)
+        set(${changed_var} 1)
+      endif()
+    else()
+      set(_${v}_CHANGED 0)
+    endif()
+  endforeach()
+endmacro()
+
+macro(_Boost_FIND_LIBRARY var)
+  find_library(${var} ${ARGN})
+
+  # If we found the first library save Boost_LIBRARY_DIR.
+  if(${var} AND NOT Boost_LIBRARY_DIR)
+    get_filename_component(_dir "${${var}}" PATH)
+    set(Boost_LIBRARY_DIR "${_dir}" CACHE PATH "Boost library directory" FORCE)
+  endif()
+
+  # If Boost_LIBRARY_DIR is known then search only there.
+  if(Boost_LIBRARY_DIR)
+    set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
+  endif()
+endmacro()
+
 #-------------------------------------------------------------------------------
 
 #
@@ -390,17 +309,6 @@ function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION)
   set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE)
 endfunction()
 
-#
-# A convenience function for marking desired components
-# as found or not
-#
-function(_Boost_MARK_COMPONENTS_FOUND _yes_or_no)
-  foreach(COMPONENT ${Boost_FIND_COMPONENTS})
-    string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
-    set(Boost_${UPPERCOMPONENT}_FOUND ${_yes_or_no} CACHE INTERNAL "Whether the Boost ${COMPONENT} library found" FORCE)
-  endforeach()
-endfunction()
-
 #
 # Take a list of libraries with "thread" in it
 # and prepend duplicates with "thread_${Boost_THREADAPI}"
@@ -561,652 +469,679 @@ endif()
 # Boost.
 set(Boost_ERROR_REASON)
 
-  if(Boost_DEBUG)
-    # Output some of their choices
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
-  endif()
-
-  if(WIN32)
-    # In windows, automatic linking is performed, so you do not have
-    # to specify the libraries.  If you are linking to a dynamic
-    # runtime, then you can choose to link to either a static or a
-    # dynamic Boost library, the default is to do a static link.  You
-    # can alter this for a specific library "whatever" by defining
-    # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
-    # linked dynamically.  Alternatively you can force all Boost
-    # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
-
-    # This feature can be disabled for Boost library "whatever" by
-    # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
-    # BOOST_ALL_NO_LIB.
-
-    # If you want to observe which libraries are being linked against
-    # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
-    # code to emit a #pragma message each time a library is selected
-    # for linking.
-    set(Boost_LIB_DIAGNOSTIC_DEFINITIONS
-      "-DBOOST_LIB_DIAGNOSTIC" CACHE STRING "Boost diagnostic define")
-  endif()
+if(Boost_DEBUG)
+  # Output some of their choices
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}")
+endif()
 
-  set(_boost_INCLUDE_SEARCH_DIRS_SYSTEM
-    C:/boost/include
-    C:/boost
-    "$ENV{ProgramFiles}/boost/include"
-    "$ENV{ProgramFiles}/boost"
-    /sw/local/include
-  )
+if(WIN32)
+  # In windows, automatic linking is performed, so you do not have
+  # to specify the libraries.  If you are linking to a dynamic
+  # runtime, then you can choose to link to either a static or a
+  # dynamic Boost library, the default is to do a static link.  You
+  # can alter this for a specific library "whatever" by defining
+  # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be
+  # linked dynamically.  Alternatively you can force all Boost
+  # libraries to dynamic link by defining BOOST_ALL_DYN_LINK.
+
+  # This feature can be disabled for Boost library "whatever" by
+  # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining
+  # BOOST_ALL_NO_LIB.
+
+  # If you want to observe which libraries are being linked against
+  # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking
+  # code to emit a #pragma message each time a library is selected
+  # for linking.
+  set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
+endif()
 
-  _Boost_CHECK_SPELLING(Boost_ROOT)
-  _Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
-  _Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
+_Boost_CHECK_SPELLING(Boost_ROOT)
+_Boost_CHECK_SPELLING(Boost_LIBRARYDIR)
+_Boost_CHECK_SPELLING(Boost_INCLUDEDIR)
 
-  # If BOOST_ROOT was defined in the environment, use it.
-  if (NOT BOOST_ROOT AND NOT $ENV{Boost_DIR} STREQUAL "")
-    set(BOOST_ROOT $ENV{Boost_DIR})
+# Collect environment variable inputs as hints.  Do not consider changes.
+foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR)
+  set(_env $ENV{${v}})
+  if(_env)
+    file(TO_CMAKE_PATH "${_env}" _ENV_${v})
+  else()
+    set(_ENV_${v} "")
   endif()
+endforeach()
+if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT)
+  set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}")
+endif()
 
-  # If BOOST_ROOT was defined in the environment, use it.
-  if (NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
-    set(BOOST_ROOT $ENV{BOOST_ROOT})
-  endif()
+# Collect inputs and cached results.  Detect changes since the last run.
+if(NOT BOOST_ROOT AND BOOSTROOT)
+  set(BOOST_ROOT "${BOOSTROOT}")
+endif()
+set(_Boost_VARS_DIR
+  BOOST_ROOT
+  Boost_NO_SYSTEM_PATHS
+  )
 
-  # If BOOSTROOT was defined in the environment, use it.
-  if (NOT BOOST_ROOT AND NOT $ENV{BOOSTROOT} STREQUAL "")
-    set(BOOST_ROOT $ENV{BOOSTROOT})
-  endif()
+if(Boost_DEBUG)
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "Declared as CMake or Environmental Variables:")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "  BOOST_ROOT = ${BOOST_ROOT}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "  BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "  BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                 "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+endif()
 
-  # If BOOST_INCLUDEDIR was defined in the environment, use it.
-  if( NOT $ENV{BOOST_INCLUDEDIR} STREQUAL "" )
-    set(BOOST_INCLUDEDIR $ENV{BOOST_INCLUDEDIR})
-  endif()
+# ------------------------------------------------------------------------
+#  Search for Boost include DIR
+# ------------------------------------------------------------------------
 
-  # If BOOST_LIBRARYDIR was defined in the environment, use it.
-  if( NOT $ENV{BOOST_LIBRARYDIR} STREQUAL "" )
-    set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
-  endif()
+set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC})
+# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the
+# location did.  We will find a new one based on the new inputs.
+if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED)
+  unset(Boost_INCLUDE_DIR CACHE)
+endif()
 
-  if( BOOST_ROOT )
-    file(TO_CMAKE_PATH ${BOOST_ROOT} BOOST_ROOT)
+if(NOT Boost_INCLUDE_DIR)
+  set(_boost_INCLUDE_SEARCH_DIRS "")
+  if(BOOST_INCLUDEDIR)
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR})
+  elseif(_ENV_BOOST_INCLUDEDIR)
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR})
   endif()
 
-  if(Boost_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "Declared as CMake or Environmental Variables:")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "  BOOST_ROOT = ${BOOST_ROOT}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "  BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "  BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                   "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}")
+  if( BOOST_ROOT )
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT})
+  elseif( _ENV_BOOST_ROOT )
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT})
   endif()
 
   if( Boost_NO_SYSTEM_PATHS)
-    set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
   else()
-    set(_boost_INCLUDE_SEARCH_DIRS ${_boost_INCLUDE_SEARCH_DIRS_SYSTEM})
-  endif()
-
-  if( BOOST_ROOT )
-    set(_boost_INCLUDE_SEARCH_DIRS
-      ${BOOST_ROOT}/include
-      ${BOOST_ROOT}
-      ${_boost_INCLUDE_SEARCH_DIRS})
-  endif()
-
-  # prepend BOOST_INCLUDEDIR to search path if specified
-  if( BOOST_INCLUDEDIR )
-    file(TO_CMAKE_PATH ${BOOST_INCLUDEDIR} BOOST_INCLUDEDIR)
-    set(_boost_INCLUDE_SEARCH_DIRS
-      ${BOOST_INCLUDEDIR} ${_boost_INCLUDE_SEARCH_DIRS})
+    list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS
+      C:/boost/include
+      C:/boost
+      /sw/local/include
+      )
   endif()
 
-  # ------------------------------------------------------------------------
-  #  Search for Boost include DIR
-  # ------------------------------------------------------------------------
   # Try to find Boost by stepping backwards through the Boost versions
   # we know about.
-  if( NOT Boost_INCLUDE_DIR )
-    # Build a list of path suffixes for each version.
-    set(_boost_PATH_SUFFIXES)
-    foreach(_boost_VER ${_boost_TEST_VERSIONS})
-      # Add in a path suffix, based on the required version, ideally
-      # we could read this from version.hpp, but for that to work we'd
-      # need to know the include dir already
-      set(_boost_BOOSTIFIED_VERSION)
-
-      # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
-      if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
-          string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
-            _boost_BOOSTIFIED_VERSION ${_boost_VER})
-      elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
-          string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
-            _boost_BOOSTIFIED_VERSION ${_boost_VER})
-      endif()
-
-      list(APPEND _boost_PATH_SUFFIXES "boost-${_boost_BOOSTIFIED_VERSION}")
-      list(APPEND _boost_PATH_SUFFIXES "boost_${_boost_BOOSTIFIED_VERSION}")
-
-    endforeach()
-
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "Include debugging info:")
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "  _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "  _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
+  # Build a list of path suffixes for each version.
+  set(_boost_PATH_SUFFIXES)
+  foreach(_boost_VER ${_boost_TEST_VERSIONS})
+    # Add in a path suffix, based on the required version, ideally
+    # we could read this from version.hpp, but for that to work we'd
+    # need to know the include dir already
+    set(_boost_BOOSTIFIED_VERSION)
+
+    # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0
+    if(_boost_VER MATCHES "[0-9]+\\.[0-9]+\\.[0-9]+")
+        string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1_\\2_\\3"
+          _boost_BOOSTIFIED_VERSION ${_boost_VER})
+    elseif(_boost_VER MATCHES "[0-9]+\\.[0-9]+")
+        string(REGEX REPLACE "([0-9]+)\\.([0-9]+)" "\\1_\\2"
+          _boost_BOOSTIFIED_VERSION ${_boost_VER})
     endif()
 
-    # Look for a standard boost header file.
-    find_path(Boost_INCLUDE_DIR
-      NAMES         boost/config.hpp
-      HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
-      PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
-      ${_boost_FIND_OPTIONS}
+    list(APPEND _boost_PATH_SUFFIXES
+      "boost-${_boost_BOOSTIFIED_VERSION}"
+      "boost_${_boost_BOOSTIFIED_VERSION}"
+      "boost/boost-${_boost_BOOSTIFIED_VERSION}"
+      "boost/boost_${_boost_BOOSTIFIED_VERSION}"
       )
-  endif()
 
-  # ------------------------------------------------------------------------
-  #  Extract version information from version.hpp
-  # ------------------------------------------------------------------------
-
-  if(Boost_INCLUDE_DIR)
-    # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
-    # Read the whole file:
-    #
-    set(BOOST_VERSION 0)
-    set(BOOST_LIB_VERSION "")
-    file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
-    endif()
+  endforeach()
 
-    string(REGEX REPLACE ".*#define BOOST_VERSION ([0-9]+).*" "\\1" Boost_VERSION "${_boost_VERSION_HPP_CONTENTS}")
-    string(REGEX REPLACE ".*#define BOOST_LIB_VERSION \"([0-9_]+)\".*" "\\1" Boost_LIB_VERSION "${_boost_VERSION_HPP_CONTENTS}")
-    unset(_boost_VERSION_HPP_CONTENTS)
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "Include debugging info:")
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "  _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}")
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "  _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}")
+  endif()
 
-    set(Boost_LIB_VERSION ${Boost_LIB_VERSION} CACHE INTERNAL "The library version string for boost libraries")
-    set(Boost_VERSION ${Boost_VERSION} CACHE INTERNAL "The version number for boost libraries")
+  # Look for a standard boost header file.
+  find_path(Boost_INCLUDE_DIR
+    NAMES         boost/config.hpp
+    HINTS         ${_boost_INCLUDE_SEARCH_DIRS}
+    PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
+    )
+endif()
 
-    if(NOT "${Boost_VERSION}" STREQUAL "0")
-      math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
-      math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
-      math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
+# ------------------------------------------------------------------------
+#  Extract version information from version.hpp
+# ------------------------------------------------------------------------
 
-      set(Boost_ERROR_REASON
-          "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
-    endif()
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "version.hpp reveals boost "
-                     "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
-    endif()
-  else()
-    set(Boost_ERROR_REASON
-      "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
+# Set Boost_FOUND based only on header location and version.
+# It will be updated below for component libraries.
+if(Boost_INCLUDE_DIR)
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp")
   endif()
 
-  # ------------------------------------------------------------------------
-  #  Suffix initialization and compiler suffix detection.
-  # ------------------------------------------------------------------------
+  # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp
+  set(Boost_VERSION 0)
+  set(Boost_LIB_VERSION "")
+  file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ")
+  set(_Boost_VERSION_REGEX "([0-9]+)")
+  set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"")
+  foreach(v VERSION LIB_VERSION)
+    if("${_boost_VERSION_HPP_CONTENTS}" MATCHES ".*#define BOOST_${v} ${_Boost_${v}_REGEX}.*")
+      set(Boost_${v} "${CMAKE_MATCH_1}")
+    endif()
+  endforeach()
+  unset(_boost_VERSION_HPP_CONTENTS)
+
+  math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000")
+  math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000")
+  math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100")
 
-  # Setting some more suffixes for the library
-  set(Boost_LIB_PREFIX "")
-  if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
-    set(Boost_LIB_PREFIX "lib")
+  set(Boost_ERROR_REASON
+    "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}")
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "version.hpp reveals boost "
+                   "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
   endif()
 
-  if (Boost_COMPILER)
-    set(_boost_COMPILER ${Boost_COMPILER})
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
+  if(Boost_FIND_VERSION)
+    # Set Boost_FOUND based on requested version.
+    set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+    if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}")
+      set(Boost_FOUND 0)
+      set(_Boost_VERSION_AGE "old")
+    elseif(Boost_FIND_VERSION_EXACT AND
+        NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}")
+      set(Boost_FOUND 0)
+      set(_Boost_VERSION_AGE "new")
+    else()
+      set(Boost_FOUND 1)
     endif()
+    if(NOT Boost_FOUND)
+      # State that we found a version of Boost that is too new or too old.
+      set(Boost_ERROR_REASON
+        "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
+      if (Boost_FIND_VERSION_PATCH)
+        set(Boost_ERROR_REASON
+          "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
+      endif ()
+      if (NOT Boost_FIND_VERSION_EXACT)
+        set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
+      endif ()
+      set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
+    endif ()
   else()
-    # Attempt to guess the compiler suffix
-    # NOTE: this is not perfect yet, if you experience any issues
-    # please report them and use the Boost_COMPILER variable
-    # to work around the problems.
-    _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-        "guessed _boost_COMPILER = ${_boost_COMPILER}")
-    endif()
+    # Caller will accept any Boost version.
+    set(Boost_FOUND 1)
   endif()
+else()
+  set(Boost_FOUND 0)
+  set(Boost_ERROR_REASON
+    "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.")
+endif()
 
-  set (_boost_MULTITHREADED "-mt")
-  if( NOT Boost_USE_MULTITHREADED )
-    set (_boost_MULTITHREADED "")
+# ------------------------------------------------------------------------
+#  Suffix initialization and compiler suffix detection.
+# ------------------------------------------------------------------------
+
+set(_Boost_VARS_NAME
+  Boost_COMPILER
+  Boost_THREADAPI
+  Boost_USE_DEBUG_PYTHON
+  Boost_USE_MULTITHREADED
+  Boost_USE_STATIC_LIBS
+  Boost_USE_STATIC_RUNTIME
+  Boost_USE_STLPORT
+  Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS
+  )
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME})
+
+# Setting some more suffixes for the library
+set(Boost_LIB_PREFIX "")
+if ( WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN)
+  set(Boost_LIB_PREFIX "lib")
+endif()
+
+if (Boost_COMPILER)
+  set(_boost_COMPILER ${Boost_COMPILER})
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "using user-specified Boost_COMPILER = ${_boost_COMPILER}")
   endif()
+else()
+  # Attempt to guess the compiler suffix
+  # NOTE: this is not perfect yet, if you experience any issues
+  # please report them and use the Boost_COMPILER variable
+  # to work around the problems.
+  _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER)
   if(Boost_DEBUG)
     message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-      "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
+      "guessed _boost_COMPILER = ${_boost_COMPILER}")
   endif()
+endif()
 
-  #======================
-  # Systematically build up the Boost ABI tag
-  # http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
-  set( _boost_RELEASE_ABI_TAG "-")
-  set( _boost_DEBUG_ABI_TAG   "-")
-  # Key       Use this library when:
-  #  s        linking statically to the C++ standard library and
-  #           compiler runtime support libraries.
-  if(Boost_USE_STATIC_RUNTIME)
-    set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
-    set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}s")
-  endif()
-  #  g        using debug versions of the standard and runtime
-  #           support libraries
-  if(WIN32)
-    if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
-            OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
-      set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
-    endif()
-  endif()
-  #  y        using special debug build of python
-  if(Boost_USE_DEBUG_PYTHON)
-    set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
-  endif()
-  #  d        using a debug version of your code
-  set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
-  #  p        using the STLport standard library rather than the
-  #           default one supplied with your compiler
-  if(Boost_USE_STLPORT)
-    set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
-    set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}p")
-  endif()
-  #  n        using the STLport deprecated "native iostreams" feature
-  if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
-    set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
-    set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}n")
-  endif()
+set (_boost_MULTITHREADED "-mt")
+if( NOT Boost_USE_MULTITHREADED )
+  set (_boost_MULTITHREADED "")
+endif()
+if(Boost_DEBUG)
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+    "_boost_MULTITHREADED = ${_boost_MULTITHREADED}")
+endif()
 
-  if(Boost_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-      "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-      "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
+#======================
+# Systematically build up the Boost ABI tag
+# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming
+set( _boost_RELEASE_ABI_TAG "-")
+set( _boost_DEBUG_ABI_TAG   "-")
+# Key       Use this library when:
+#  s        linking statically to the C++ standard library and
+#           compiler runtime support libraries.
+if(Boost_USE_STATIC_RUNTIME)
+  set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s")
+  set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}s")
+endif()
+#  g        using debug versions of the standard and runtime
+#           support libraries
+if(WIN32)
+  if(MSVC OR "${CMAKE_CXX_COMPILER}" MATCHES "icl"
+          OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc")
+    set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g")
   endif()
+endif()
+#  y        using special debug build of python
+if(Boost_USE_DEBUG_PYTHON)
+  set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y")
+endif()
+#  d        using a debug version of your code
+set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d")
+#  p        using the STLport standard library rather than the
+#           default one supplied with your compiler
+if(Boost_USE_STLPORT)
+  set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}p")
+  set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}p")
+endif()
+#  n        using the STLport deprecated "native iostreams" feature
+if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS)
+  set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}n")
+  set( _boost_DEBUG_ABI_TAG   "${_boost_DEBUG_ABI_TAG}n")
+endif()
+
+if(Boost_DEBUG)
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+    "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}")
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+    "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}")
+endif()
+
+# ------------------------------------------------------------------------
+#  Begin finding boost libraries
+# ------------------------------------------------------------------------
+set(_Boost_VARS_LIB BOOST_LIBRARYDIR Boost_LIBRARY_DIR)
+_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR ${_Boost_VARS_DIR} ${_Boost_VARS_LIB} Boost_INCLUDE_DIR)
+# Clear Boost_LIBRARY_DIR if it did not change but other input affecting the
+# location did.  We will find a new one based on the new inputs.
+if(_Boost_CHANGE_LIBDIR AND NOT _Boost_LIBRARY_DIR_CHANGED)
+  unset(Boost_LIBRARY_DIR CACHE)
+endif()
 
-  # ------------------------------------------------------------------------
-  #  Begin finding boost libraries
-  # ------------------------------------------------------------------------
+if(Boost_LIBRARY_DIR)
+  set(_boost_LIBRARY_SEARCH_DIRS ${Boost_LIBRARY_DIR} NO_DEFAULT_PATH)
+else()
+  set(_boost_LIBRARY_SEARCH_DIRS "")
+  if(BOOST_LIBRARYDIR)
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_LIBRARYDIR})
+  elseif(_ENV_BOOST_LIBRARYDIR)
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_LIBRARYDIR})
+  endif()
 
   if(BOOST_ROOT)
-    set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
-      ${BOOST_ROOT}/lib
-      ${BOOST_ROOT}/stage/lib)
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib)
+  elseif(_ENV_BOOST_ROOT)
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib)
   endif()
-  set(_boost_LIBRARY_SEARCH_DIRS_ALWAYS
-    ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS}
+
+  list(APPEND _boost_LIBRARY_SEARCH_DIRS
     ${Boost_INCLUDE_DIR}/lib
     ${Boost_INCLUDE_DIR}/../lib
     ${Boost_INCLUDE_DIR}/stage/lib
-  )
-  set(_boost_LIBRARY_SEARCH_DIRS_SYSTEM
-    C:/boost/lib
-    C:/boost
-    "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}_${Boost_SUBMINOR_VERSION}/lib"
-    "$ENV{ProgramFiles}/boost/boost_${Boost_MAJOR_VERSION}_${Boost_MINOR_VERSION}/lib"
-    "$ENV{ProgramFiles}/boost/lib"
-    "$ENV{ProgramFiles}/boost"
-    /sw/local/lib
-  )
-  set(_boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_ALWAYS})
+    )
   if( Boost_NO_SYSTEM_PATHS )
-    set(_boost_FIND_OPTIONS NO_CMAKE_SYSTEM_PATH)
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH)
   else()
-    list(APPEND _boost_LIBRARY_SEARCH_DIRS ${_boost_LIBRARY_SEARCH_DIRS_SYSTEM})
-  endif()
-
-  # prepend BOOST_LIBRARYDIR to search path if specified
-  if( BOOST_LIBRARYDIR )
-    file(TO_CMAKE_PATH ${BOOST_LIBRARYDIR} BOOST_LIBRARYDIR)
-    set(_boost_LIBRARY_SEARCH_DIRS
-      ${BOOST_LIBRARYDIR} ${_boost_LIBRARY_SEARCH_DIRS})
+    list(APPEND _boost_LIBRARY_SEARCH_DIRS PATHS
+      C:/boost/lib
+      C:/boost
+      /sw/local/lib
+      )
   endif()
+endif()
 
-  if(Boost_DEBUG)
-    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-      "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
-  endif()
+if(Boost_DEBUG)
+  message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+    "_boost_LIBRARY_SEARCH_DIRS = ${_boost_LIBRARY_SEARCH_DIRS}")
+endif()
 
-  # Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
-  if( Boost_USE_STATIC_LIBS )
-    set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
-    if(WIN32)
-      set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
-    else()
-      set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
-    endif()
+# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
+if( Boost_USE_STATIC_LIBS )
+  set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+  if(WIN32)
+    set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
+  else()
+    set(CMAKE_FIND_LIBRARY_SUFFIXES .a )
   endif()
+endif()
 
-  # We want to use the tag inline below without risking double dashes
-  if(_boost_RELEASE_ABI_TAG)
-    if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
-      set(_boost_RELEASE_ABI_TAG "")
-    endif()
+# We want to use the tag inline below without risking double dashes
+if(_boost_RELEASE_ABI_TAG)
+  if(${_boost_RELEASE_ABI_TAG} STREQUAL "-")
+    set(_boost_RELEASE_ABI_TAG "")
   endif()
-  if(_boost_DEBUG_ABI_TAG)
-    if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
-      set(_boost_DEBUG_ABI_TAG "")
-    endif()
+endif()
+if(_boost_DEBUG_ABI_TAG)
+  if(${_boost_DEBUG_ABI_TAG} STREQUAL "-")
+    set(_boost_DEBUG_ABI_TAG "")
   endif()
+endif()
 
-  # The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
-  # on WIN32 was to:
-  #  1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
-  #  2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
-  # We maintain this behavior since changing it could break people's builds.
-  # To disable the ambiguous behavior, the user need only
-  # set Boost_USE_STATIC_RUNTIME either ON or OFF.
-  set(_boost_STATIC_RUNTIME_WORKAROUND false)
-  if(WIN32 AND Boost_USE_STATIC_LIBS)
-    if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
-      set(_boost_STATIC_RUNTIME_WORKAROUND true)
-    endif()
+# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled
+# on WIN32 was to:
+#  1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found)
+#  2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found)
+# We maintain this behavior since changing it could break people's builds.
+# To disable the ambiguous behavior, the user need only
+# set Boost_USE_STATIC_RUNTIME either ON or OFF.
+set(_boost_STATIC_RUNTIME_WORKAROUND false)
+if(WIN32 AND Boost_USE_STATIC_LIBS)
+  if(NOT DEFINED Boost_USE_STATIC_RUNTIME)
+    set(_boost_STATIC_RUNTIME_WORKAROUND true)
   endif()
+endif()
 
-  # On versions < 1.35, remove the System library from the considered list
-  # since it wasn't added until 1.35.
-  if(Boost_VERSION AND Boost_FIND_COMPONENTS)
-     if(Boost_VERSION LESS 103500)
-       list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
-     endif()
-  endif()
+# On versions < 1.35, remove the System library from the considered list
+# since it wasn't added until 1.35.
+if(Boost_VERSION AND Boost_FIND_COMPONENTS)
+   if(Boost_VERSION LESS 103500)
+     list(REMOVE_ITEM Boost_FIND_COMPONENTS system)
+   endif()
+endif()
 
-  foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+# If the user changed any of our control inputs flush previous results.
+if(_Boost_CHANGE_LIBDIR OR _Boost_CHANGE_LIBNAME)
+  foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED})
     string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
-    set( Boost_${UPPERCOMPONENT}_LIBRARY "Boost_${UPPERCOMPONENT}_LIBRARY-NOTFOUND" )
-    set( Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE-NOTFOUND" )
-    set( Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG-NOTFOUND")
-
-    set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
-    set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
-
-    #
-    # Find RELEASE libraries
-    #
-    set(_boost_RELEASE_NAMES
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT} )
-    if(_boost_STATIC_RUNTIME_WORKAROUND)
-      set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
-      list(APPEND _boost_RELEASE_NAMES
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
-    endif()
-    if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
-       _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
-    endif()
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
-    endif()
-    find_library(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
-        NAMES ${_boost_RELEASE_NAMES}
-        HINTS ${_boost_LIBRARY_SEARCH_DIRS}
-        ${_boost_FIND_OPTIONS}
-        DOC "${_boost_docstring_release}"
-    )
+    foreach(c DEBUG RELEASE)
+      set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c})
+      unset(${_var} CACHE)
+      set(${_var} "${_var}-NOTFOUND")
+    endforeach()
+  endforeach()
+  set(_Boost_COMPONENTS_SEARCHED "")
+endif()
 
-    #
-    # Find DEBUG libraries
-    #
-    set(_boost_DEBUG_NAMES
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
-      ${Boost_LIB_PREFIX}boost_${COMPONENT} )
-    if(_boost_STATIC_RUNTIME_WORKAROUND)
-      set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
-      list(APPEND _boost_DEBUG_NAMES
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
-        ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
-    endif()
-    if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
-       _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
-    endif()
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
-                     "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
-    endif()
-    find_library(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
-        NAMES ${_boost_DEBUG_NAMES}
-        HINTS ${_boost_LIBRARY_SEARCH_DIRS}
-        ${_boost_FIND_OPTIONS}
-        DOC "${_boost_docstring_debug}"
+foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+  string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+
+  set( _boost_docstring_release "Boost ${COMPONENT} library (release)")
+  set( _boost_docstring_debug   "Boost ${COMPONENT} library (debug)")
+
+  #
+  # Find RELEASE libraries
+  #
+  set(_boost_RELEASE_NAMES
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+  if(_boost_STATIC_RUNTIME_WORKAROUND)
+    set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}")
+    list(APPEND _boost_RELEASE_NAMES
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} )
+  endif()
+  if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+     _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES})
+  endif()
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}")
+  endif()
+  _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE
+    NAMES ${_boost_RELEASE_NAMES}
+    HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+    NAMES_PER_DIR
+    DOC "${_boost_docstring_release}"
     )
 
-    if(Boost_REALPATH)
-      _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
-      _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG   "${_boost_docstring_debug}"  )
-    endif()
-
-    _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
-
-  endforeach()
+  #
+  # Find DEBUG libraries
+  #
+  set(_boost_DEBUG_NAMES
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}
+    ${Boost_LIB_PREFIX}boost_${COMPONENT} )
+  if(_boost_STATIC_RUNTIME_WORKAROUND)
+    set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}")
+    list(APPEND _boost_DEBUG_NAMES
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_COMPILER}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION}
+      ${Boost_LIB_PREFIX}boost_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} )
+  endif()
+  if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread")
+     _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES})
+  endif()
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] "
+                   "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}")
+  endif()
+  _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG
+    NAMES ${_boost_DEBUG_NAMES}
+    HINTS ${_boost_LIBRARY_SEARCH_DIRS}
+    NAMES_PER_DIR
+    DOC "${_boost_docstring_debug}"
+    )
 
-  # Restore the original find library ordering
-  if( Boost_USE_STATIC_LIBS )
-    set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+  if(Boost_REALPATH)
+    _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}")
+    _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG   "${_boost_docstring_debug}"  )
   endif()
 
-  # ------------------------------------------------------------------------
-  #  End finding boost libraries
-  # ------------------------------------------------------------------------
+  _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT})
 
-  # ------------------------------------------------------------------------
-  #  Begin long process of determining Boost_FOUND, starting with version
-  #  number checks, followed by
-  #  TODO: Ideally the version check logic should happen prior to searching
-  #        for libraries...
-  # ------------------------------------------------------------------------
+endforeach()
 
-  set(Boost_INCLUDE_DIRS
-    ${Boost_INCLUDE_DIR}
-  )
+# Restore the original find library ordering
+if( Boost_USE_STATIC_LIBS )
+  set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
+endif()
 
-  set(Boost_FOUND FALSE)
-  if(Boost_INCLUDE_DIR)
-    set( Boost_FOUND TRUE )
+# ------------------------------------------------------------------------
+#  End finding boost libraries
+# ------------------------------------------------------------------------
 
-    if(Boost_MAJOR_VERSION LESS "${Boost_FIND_VERSION_MAJOR}" )
-      set( Boost_FOUND FALSE )
-      set(_Boost_VERSION_AGE "old")
-    elseif(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
-      if(Boost_MINOR_VERSION LESS "${Boost_FIND_VERSION_MINOR}" )
-        set( Boost_FOUND FALSE )
-        set(_Boost_VERSION_AGE "old")
-      elseif(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
-        if( Boost_FIND_VERSION_PATCH AND Boost_SUBMINOR_VERSION LESS "${Boost_FIND_VERSION_PATCH}" )
-          set( Boost_FOUND FALSE )
-          set(_Boost_VERSION_AGE "old")
-        endif()
-      endif()
-    endif()
+set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
+set(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
 
-    if (NOT Boost_FOUND)
-      _Boost_MARK_COMPONENTS_FOUND(OFF)
+# The above setting of Boost_FOUND was based only on the header files.
+# Update it for the requested component libraries.
+if(Boost_FOUND)
+  # The headers were found.  Check for requested component libs.
+  set(_boost_CHECKED_COMPONENT FALSE)
+  set(_Boost_MISSING_COMPONENTS "")
+  foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+    string(TOUPPER ${COMPONENT} COMPONENT)
+    set(_boost_CHECKED_COMPONENT TRUE)
+    if(NOT Boost_${COMPONENT}_FOUND)
+      string(TOLOWER ${COMPONENT} COMPONENT)
+      list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
     endif()
+  endforeach()
 
-    if (Boost_FOUND AND Boost_FIND_VERSION_EXACT)
-      # If the user requested an exact version of Boost, check
-      # that. We already know that the Boost version we have is >= the
-      # requested version.
-      set(_Boost_VERSION_AGE "new")
-
-      # If the user didn't specify a patchlevel, it's 0.
-      if (NOT Boost_FIND_VERSION_PATCH)
-        set(Boost_FIND_VERSION_PATCH 0)
-      endif ()
-
-      # We'll set Boost_FOUND true again if we have an exact version match.
-      set(Boost_FOUND FALSE)
-      _Boost_MARK_COMPONENTS_FOUND(OFF)
-      if(Boost_MAJOR_VERSION EQUAL "${Boost_FIND_VERSION_MAJOR}" )
-        if(Boost_MINOR_VERSION EQUAL "${Boost_FIND_VERSION_MINOR}" )
-          if(Boost_SUBMINOR_VERSION EQUAL "${Boost_FIND_VERSION_PATCH}" )
-            set( Boost_FOUND TRUE )
-            _Boost_MARK_COMPONENTS_FOUND(ON)
-          endif()
-        endif()
-      endif()
-    endif ()
+  if(Boost_DEBUG)
+    message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
+  endif()
 
-    if(NOT Boost_FOUND)
-      # State that we found a version of Boost that is too new or too old.
+  if (_Boost_MISSING_COMPONENTS)
+    set(Boost_FOUND 0)
+    # We were unable to find some libraries, so generate a sensible
+    # error message that lists the libraries we were unable to find.
+    set(Boost_ERROR_REASON
+      "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
+    foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
       set(Boost_ERROR_REASON
-        "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}")
-      if (Boost_FIND_VERSION_PATCH)
-        set(Boost_ERROR_REASON
-          "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}")
-      endif ()
-      if (NOT Boost_FIND_VERSION_EXACT)
-        set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)")
-      endif ()
-      set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.")
-    endif ()
-
-    # Always check for missing components
-    set(_boost_CHECKED_COMPONENT FALSE)
-    set(_Boost_MISSING_COMPONENTS "")
-    foreach(COMPONENT ${Boost_FIND_COMPONENTS})
-      string(TOUPPER ${COMPONENT} COMPONENT)
-      set(_boost_CHECKED_COMPONENT TRUE)
-      if(NOT Boost_${COMPONENT}_FOUND)
-        string(TOLOWER ${COMPONENT} COMPONENT)
-        list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT})
-        set( Boost_FOUND FALSE)
-      endif()
+        "${Boost_ERROR_REASON}        boost_${COMPONENT}\n")
     endforeach()
 
-    if(Boost_DEBUG)
-      message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}")
-    endif()
-
-    if (_Boost_MISSING_COMPONENTS)
-      # We were unable to find some libraries, so generate a sensible
-      # error message that lists the libraries we were unable to find.
+    list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
+    list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
+    if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
       set(Boost_ERROR_REASON
-        "${Boost_ERROR_REASON}\nThe following Boost libraries could not be found:\n")
-      foreach(COMPONENT ${_Boost_MISSING_COMPONENTS})
-        set(Boost_ERROR_REASON
-          "${Boost_ERROR_REASON}        boost_${COMPONENT}\n")
-      endforeach()
-
-      list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED)
-      list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS)
-      if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS})
-        set(Boost_ERROR_REASON
-          "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
-      else ()
-        set(Boost_ERROR_REASON
-          "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
-      endif ()
+        "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
+    else ()
+      set(Boost_ERROR_REASON
+        "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.")
     endif ()
+  endif ()
 
-    if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
-      # Compatibility Code for backwards compatibility with CMake
-      # 2.4's FindBoost module.
+  if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT )
+    # Compatibility Code for backwards compatibility with CMake
+    # 2.4's FindBoost module.
 
-      # Look for the boost library path.
-      # Note that the user may not have installed any libraries
-      # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
-      set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
+    # Look for the boost library path.
+    # Note that the user may not have installed any libraries
+    # so it is quite possible the Boost_LIBRARY_DIRS may not exist.
+    set(_boost_LIB_DIR ${Boost_INCLUDE_DIR})
 
-      if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
-        get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
-      endif()
+    if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+")
+      get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+    endif()
 
-      if("${_boost_LIB_DIR}" MATCHES "/include$")
-        # Strip off the trailing "/include" in the path.
-        get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
-      endif()
+    if("${_boost_LIB_DIR}" MATCHES "/include$")
+      # Strip off the trailing "/include" in the path.
+      get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH)
+    endif()
 
-      if(EXISTS "${_boost_LIB_DIR}/lib")
-        set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+    if(EXISTS "${_boost_LIB_DIR}/lib")
+      set(_boost_LIB_DIR ${_boost_LIB_DIR}/lib)
+    else()
+      if(EXISTS "${_boost_LIB_DIR}/stage/lib")
+        set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
       else()
-        if(EXISTS "${_boost_LIB_DIR}/stage/lib")
-          set(_boost_LIB_DIR ${_boost_LIB_DIR}/stage/lib)
-        else()
-          set(_boost_LIB_DIR "")
-        endif()
-      endif()
-
-      if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
-        set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR} CACHE FILEPATH "Boost library directory")
+        set(_boost_LIB_DIR "")
       endif()
+    endif()
 
+    if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}")
+      set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR})
     endif()
 
-  else()
-    set( Boost_FOUND FALSE)
   endif()
+else()
+  # Boost headers were not found so no components were found.
+  foreach(COMPONENT ${Boost_FIND_COMPONENTS})
+    string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
+    set(Boost_${UPPERCOMPONENT}_FOUND 0)
+  endforeach()
+endif()
 
-  # ------------------------------------------------------------------------
-  #  Notification to end user about what was found
-  # ------------------------------------------------------------------------
+# ------------------------------------------------------------------------
+#  Notification to end user about what was found
+# ------------------------------------------------------------------------
 
-  if(Boost_FOUND)
+set(Boost_LIBRARIES "")
+if(Boost_FOUND)
+  if(NOT Boost_FIND_QUIETLY)
+    message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
+    if(Boost_FIND_COMPONENTS)
+      message(STATUS "Found the following Boost libraries:")
+    endif()
+  endif()
+  foreach( COMPONENT  ${Boost_FIND_COMPONENTS} )
+    string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
+    if( Boost_${UPPERCOMPONENT}_FOUND )
       if(NOT Boost_FIND_QUIETLY)
-        message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")
-        if(Boost_FIND_COMPONENTS)
-          message(STATUS "Found the following Boost libraries:")
-        endif()
+        message (STATUS "  ${COMPONENT}")
       endif()
-      foreach( COMPONENT  ${Boost_FIND_COMPONENTS} )
-        string( TOUPPER ${COMPONENT} UPPERCOMPONENT )
-        if( Boost_${UPPERCOMPONENT}_FOUND )
-          if(NOT Boost_FIND_QUIETLY)
-            message (STATUS "  ${COMPONENT}")
-          endif()
-          set(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${UPPERCOMPONENT}_LIBRARY})
-        endif()
-      endforeach()
+      list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY})
+    endif()
+  endforeach()
+else()
+  if(Boost_FIND_REQUIRED)
+    message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
   else()
-    if(Boost_FIND_REQUIRED)
-      message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}")
-    else()
-      if(NOT Boost_FIND_QUIETLY)
-        # we opt not to automatically output Boost_ERROR_REASON here as
-        # it could be quite lengthy and somewhat imposing in its requests
-        # Since Boost is not always a required dependency we'll leave this
-        # up to the end-user.
-        if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
-          message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
-        else()
-          message(STATUS "Could NOT find Boost")
-        endif()
+    if(NOT Boost_FIND_QUIETLY)
+      # we opt not to automatically output Boost_ERROR_REASON here as
+      # it could be quite lengthy and somewhat imposing in its requests
+      # Since Boost is not always a required dependency we'll leave this
+      # up to the end-user.
+      if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG)
+        message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}")
+      else()
+        message(STATUS "Could NOT find Boost")
       endif()
     endif()
   endif()
+endif()
 
-  # show the Boost_INCLUDE_DIRS AND Boost_LIBRARIES variables only in the advanced view
-  mark_as_advanced(Boost_INCLUDE_DIR
-      Boost_INCLUDE_DIRS
-      Boost_LIBRARY_DIRS
-  )
+# Configure display of cache entries in GUI.
+foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB})
+  get_property(_type CACHE ${v} PROPERTY TYPE)
+  if(_type)
+    set_property(CACHE ${v} PROPERTY ADVANCED 1)
+    if("x${_type}" STREQUAL "xUNINITIALIZED")
+      if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS")
+        set_property(CACHE ${v} PROPERTY TYPE STRING)
+      else()
+        set_property(CACHE ${v} PROPERTY TYPE PATH)
+      endif()
+    endif()
+  endif()
+endforeach()
+
+# Record last used values of input variables so we can
+# detect on the next run if the user changed them.
+foreach(v
+    ${_Boost_VARS_INC} ${_Boost_VARS_LIB}
+    ${_Boost_VARS_DIR} ${_Boost_VARS_NAME}
+    )
+  if(DEFINED ${v})
+    set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.")
+  else()
+    unset(_${v}_LAST CACHE)
+  endif()
+endforeach()
+
+# Maintain a persistent list of components requested anywhere since
+# the last flush.
+set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}")
+list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS})
+list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
+list(SORT _Boost_COMPONENTS_SEARCHED)
+set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
+  CACHE INTERNAL "Components requested for this build tree.")

+ 2 - 0
Modules/FindBullet.cmake

@@ -33,6 +33,8 @@ macro(_FIND_BULLET_LIBRARY _var)
         ${ARGN}
      HINTS
         ${BULLET_ROOT}
+        ${BULLET_ROOT}/lib/Release
+        ${BULLET_ROOT}/lib/Debug
         ${BULLET_ROOT}/out/release8/libs
         ${BULLET_ROOT}/out/debug8/libs
      PATH_SUFFIXES lib

+ 1 - 1
Modules/FindCups.cmake

@@ -28,7 +28,7 @@ find_path(CUPS_INCLUDE_DIR cups/cups.h )
 find_library(CUPS_LIBRARIES NAMES cups )
 
 if (CUPS_INCLUDE_DIR AND CUPS_LIBRARIES AND CUPS_REQUIRE_IPP_DELETE_ATTRIBUTE)
-    include(CheckLibraryExists)
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
 
     # ippDeleteAttribute is new in cups-1.1.19 (and used by kdeprint)
     CHECK_LIBRARY_EXISTS(cups ippDeleteAttribute "" CUPS_HAS_IPP_DELETE_ATTRIBUTE)

+ 1 - 1
Modules/FindCurses.cmake

@@ -56,7 +56,7 @@ endif()
 # prefix as the library was found, if still not found, try curses.h with the
 # default search paths.
 if(CURSES_CURSES_LIBRARY  AND  CURSES_NEED_NCURSES)
-  include(CheckLibraryExists)
+  include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
   CHECK_LIBRARY_EXISTS("${CURSES_CURSES_LIBRARY}"
     wsyncup "" CURSES_CURSES_HAS_WSYNCUP)
 

+ 6 - 4
Modules/FindFLEX.cmake

@@ -63,7 +63,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable")
 mark_as_advanced(FLEX_EXECUTABLE)
 
 find_library(FL_LIBRARY NAMES fl
@@ -93,10 +93,12 @@ if(FLEX_EXECUTABLE)
   else()
     # older versions of flex printed "/full/path/to/executable version X.Y"
     # newer versions use "basename(executable) X.Y"
-    get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
-    string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2"
+    get_filename_component(FLEX_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
+    get_filename_component(FLEX_EXE_EXT "${FLEX_EXECUTABLE}" EXT)
+    string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\3"
       FLEX_VERSION "${FLEX_version_output}")
-    unset(FLEX_EXE_NAME)
+    unset(FLEX_EXE_EXT)
+    unset(FLEX_EXE_NAME_WE)
   endif()
 
   #============================================================

+ 1 - 1
Modules/FindFLTK.cmake

@@ -58,7 +58,7 @@ if(WIN32)
 endif()
 
 if(UNIX)
-  include(FindX11)
+  include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake)
   find_library(FLTK_MATH_LIBRARY m)
   set( FLTK_PLATFORM_DEPENDENT_LIBS ${X11_LIBRARIES} ${FLTK_MATH_LIBRARY})
 endif()

+ 3 - 0
Modules/FindFreetype.cmake

@@ -46,6 +46,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
   HINTS
     ENV FREETYPE_DIR
   PATHS
+    /usr/X11R6
     /usr/local/X11R6
     /usr/local/X11
     /usr/freeware
@@ -56,6 +57,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
   HINTS
     ENV FREETYPE_DIR
   PATHS
+    /usr/X11R6
     /usr/local/X11R6
     /usr/local/X11
     /usr/freeware
@@ -68,6 +70,7 @@ find_library(FREETYPE_LIBRARY
     ENV FREETYPE_DIR
   PATH_SUFFIXES lib
   PATHS
+  /usr/X11R6
   /usr/local/X11R6
   /usr/local/X11
   /usr/freeware

+ 2 - 2
Modules/FindGIF.cmake

@@ -58,8 +58,8 @@ set(GIF_LIBRARIES ${GIF_LIBRARY})
 # one.
 # http://giflib.sourcearchive.com/documentation/4.1.4/files.html
 if(GIF_INCLUDE_DIR)
-  include(CMakePushCheckState)
-  include(CheckStructHasMember)
+  include(${CMAKE_CURRENT_LIST_DIR}/CMakePushCheckState.cmake)
+  include(${CMAKE_CURRENT_LIST_DIR}/CheckStructHasMember.cmake)
   CMAKE_PUSH_CHECK_STATE()
   set(GIF_VERSION 3)
   set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}")

+ 1 - 1
Modules/FindGLU.cmake

@@ -19,7 +19,7 @@
 message(STATUS
   "WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead")
 
-include(FindOpenGL)
+include(${CMAKE_CURRENT_LIST_DIR}/FindOpenGL.cmake)
 
 if (OPENGL_GLU_FOUND)
   set (GLU_LIBRARY ${OPENGL_LIBRARIES})

+ 1 - 1
Modules/FindGnuplot.cmake

@@ -21,7 +21,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
 
 find_program(GNUPLOT_EXECUTABLE
   NAMES

+ 1 - 1
Modules/FindHDF5.cmake

@@ -60,7 +60,7 @@
 
 # This module is maintained by Will Dicharry <[email protected]>.
 
-include(SelectLibraryConfigurations)
+include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 
 # List of the valid HDF5 components

+ 56 - 0
Modules/FindIcotool.cmake

@@ -0,0 +1,56 @@
+# - Find icotool
+# This module looks for icotool. This module defines the
+# following values:
+#  ICOTOOL_EXECUTABLE: the full path to the icotool tool.
+#  ICOTOOL_FOUND: True if icotool has been found.
+#  ICOTOOL_VERSION_STRING: the version of icotool found.
+#
+
+#=============================================================================
+# Copyright 2012 Aleksey Avdeev <[email protected]>
+#
+# 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.)
+
+find_program(ICOTOOL_EXECUTABLE
+  icotool
+)
+
+if(ICOTOOL_EXECUTABLE)
+  execute_process(
+    COMMAND ${ICOTOOL_EXECUTABLE} --version
+    OUTPUT_VARIABLE _icotool_version
+    ERROR_QUIET
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+  )
+  if("${_icotool_version}" MATCHES "^icotool \\([^\\)]*\\) ([0-9\\.]+[^ \n]*).*")
+    set( ICOTOOL_VERSION_STRING
+      "${CMAKE_MATCH_1}"
+    )
+  else()
+    set( ICOTOOL_VERSION_STRING
+      ""
+    )
+  endif()
+  unset(_icotool_version)
+endif()
+
+# handle the QUIETLY and REQUIRED arguments and set ICOTOOL_FOUND to TRUE if
+# all listed variables are TRUE
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+  Icotool
+  REQUIRED_VARS ICOTOOL_EXECUTABLE
+  VERSION_VAR ICOTOOL_VERSION_STRING
+)
+
+mark_as_advanced(
+  ICOTOOL_EXECUTABLE
+)

+ 9 - 0
Modules/FindJNI.cmake

@@ -120,6 +120,11 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
   /usr/lib/jvm/default-java/jre/lib/{libarch}
   /usr/lib/jvm/default-java/jre/lib
   /usr/lib/jvm/default-java/lib
+  # OpenBSD specific paths for default JVM
+  /usr/local/jdk-1.7.0/jre/lib/{libarch}
+  /usr/local/jre-1.7.0/lib/{libarch}
+  /usr/local/jdk-1.6.0/jre/lib/{libarch}
+  /usr/local/jre-1.6.0/lib/{libarch}
   )
 
 set(JAVA_JVM_LIBRARY_DIRECTORIES)
@@ -153,6 +158,9 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
   /opt/sun-jdk-1.5.0.04/include
   # Debian specific path for default JVM
   /usr/lib/jvm/default-java/include
+  # OpenBSD specific path for default JVM
+  /usr/local/jdk-1.7.0/include
+  /usr/local/jdk-1.6.0/include
   )
 
 foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
@@ -227,6 +235,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h
   ${JAVA_INCLUDE_PATH}/win32
   ${JAVA_INCLUDE_PATH}/linux
   ${JAVA_INCLUDE_PATH}/freebsd
+  ${JAVA_INCLUDE_PATH}/openbsd
   ${JAVA_INCLUDE_PATH}/solaris
   ${JAVA_INCLUDE_PATH}/hp-ux
   ${JAVA_INCLUDE_PATH}/alpha

+ 7 - 0
Modules/FindJava.cmake

@@ -80,6 +80,8 @@ set(_JAVA_PATHS
   /usr/java/j2sdk1.4.2_09/bin
   /usr/lib/j2sdk1.5-sun/bin
   /opt/sun-jdk-1.5.0.04/bin
+  /usr/local/jdk-1.7.0/bin
+  /usr/local/jdk-1.6.0/bin
   )
 find_program(Java_JAVA_EXECUTABLE
   NAMES java
@@ -107,6 +109,7 @@ if(Java_JAVA_EXECUTABLE)
       # 2. OpenJDK 1.6
       # 3. GCJ 1.5
       # 4. Kaffe 1.4.2
+      # 5. OpenJDK 1.7.x on OpenBSD
       if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
         # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
         string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
@@ -115,6 +118,10 @@ if(Java_JAVA_EXECUTABLE)
         # Kaffe style
         string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
                 "\\1" Java_VERSION_STRING "${var}" )
+      elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+        # OpenJDK ver 1.7.x on OpenBSD
+        string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
+                "\\1" Java_VERSION_STRING "${var}" )
       else()
         if(NOT Java_FIND_QUIETLY)
           message(WARNING "regex not supported: ${var}. Please report")

+ 1 - 1
Modules/FindKDE3.cmake

@@ -245,7 +245,7 @@ endif()
 
 
 # KDE3Macros.cmake contains all the KDE specific macros
-include(KDE3Macros)
+include(${CMAKE_CURRENT_LIST_DIR}/KDE3Macros.cmake)
 
 
 macro (KDE3_PRINT_RESULTS)

+ 2 - 2
Modules/FindLAPACK.cmake

@@ -40,9 +40,9 @@ set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
 
 get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
 if (NOT _LANGUAGES_ MATCHES Fortran)
-include(CheckFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
 else ()
-include(CheckFortranFunctionExists)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckFortranFunctionExists.cmake)
 endif ()
 
 set(LAPACK_FOUND FALSE)

+ 1 - 1
Modules/FindLua51.cmake

@@ -28,7 +28,7 @@
 find_path(LUA_INCLUDE_DIR lua.h
   HINTS
     ENV LUA_DIR
-  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
   PATHS
   ~/Library/Frameworks
   /Library/Frameworks

+ 1 - 1
Modules/FindMPEG2.cmake

@@ -45,7 +45,7 @@ if(MPEG2_FOUND)
 
   #some native mpeg2 installations will depend
   #on libSDL, if found, add it in.
-  include( FindSDL )
+  include(${CMAKE_CURRENT_LIST_DIR}/FindSDL.cmake)
   if(SDL_FOUND)
     set( MPEG2_LIBRARIES ${MPEG2_LIBRARIES} ${SDL_LIBRARY})
   endif()

+ 1 - 1
Modules/FindMPI.cmake

@@ -78,7 +78,7 @@
 
 # include this to handle the QUIETLY and REQUIRED arguments
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
-include(GetPrerequisites)
+include(${CMAKE_CURRENT_LIST_DIR}/GetPrerequisites.cmake)
 
 #
 # This part detects MPI compilers, attempting to wade through the mess of compiler names in

+ 1 - 1
Modules/FindOpenGL.cmake

@@ -103,7 +103,7 @@ else ()
 
     if (OPENGL_gl_LIBRARY)
       if(NOT X11_FOUND)
-        include(FindX11)
+        include(${CMAKE_CURRENT_LIST_DIR}/FindX11.cmake)
       endif()
       if (X11_FOUND)
         if (NOT APPLE)

+ 2 - 2
Modules/FindOpenMP.cmake

@@ -95,7 +95,7 @@ if(CMAKE_C_COMPILER_LOADED)
     unset(OpenMP_C_FLAG_CANDIDATES)
   else()
     _OPENMP_FLAG_CANDIDATES("C")
-    include(CheckCSourceCompiles)
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckCSourceCompiles.cmake)
   endif()
 
   foreach(FLAG ${OpenMP_C_FLAG_CANDIDATES})
@@ -126,7 +126,7 @@ if(CMAKE_CXX_COMPILER_LOADED)
     unset(OpenMP_CXX_FLAG_CANDIDATES)
   else()
     _OPENMP_FLAG_CANDIDATES("CXX")
-    include(CheckCXXSourceCompiles)
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSourceCompiles.cmake)
 
     # use the same source for CXX as C for now
     set(OpenMP_CXX_TEST_SOURCE ${OpenMP_C_TEST_SOURCE})

+ 1 - 1
Modules/FindOpenSceneGraph.cmake

@@ -72,7 +72,7 @@
 #  Output variables of the form OPENSCENEGRAPH_FOO
 #
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 
 set(_osg_modules_to_process)
 foreach(_osg_component ${OpenSceneGraph_FIND_COMPONENTS})

+ 6 - 3
Modules/FindPackageHandleStandardArgs.cmake

@@ -88,8 +88,8 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindPackageMessage)
-include(CMakeParseArguments)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake)
 
 # internal helper macro
 macro(_FPHSA_FAILURE_MESSAGE _msg)
@@ -187,8 +187,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
   # user knows better what went wrong (#6375)
   set(MISSING_VARS "")
   set(DETAILS "")
-  set(${_NAME_UPPER}_FOUND TRUE)
   # check if all passed variables are valid
+  unset(${_NAME_UPPER}_FOUND)
   foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
     if(NOT ${_CURRENT_VAR})
       set(${_NAME_UPPER}_FOUND FALSE)
@@ -197,6 +197,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
       set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
     endif()
   endforeach()
+  if(NOT "${${_NAME_UPPER}_FOUND}" STREQUAL "FALSE")
+    set(${_NAME_UPPER}_FOUND TRUE)
+  endif()
 
   # component handling
   unset(FOUND_COMPONENTS_MSG)

+ 1 - 1
Modules/FindPerl.cmake

@@ -18,7 +18,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
 
 set(PERL_POSSIBLE_BIN_PATHS
   ${CYGWIN_INSTALL_PATH}/bin

+ 1 - 1
Modules/FindPerlLibs.cmake

@@ -38,7 +38,7 @@
 #  License text for the above reference.)
 
 # find the perl executable
-include(FindPerl)
+include(${CMAKE_CURRENT_LIST_DIR}/FindPerl.cmake)
 
 if (PERL_EXECUTABLE)
   ### PERL_PREFIX

+ 1 - 1
Modules/FindPythonLibs.cmake

@@ -32,7 +32,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(CMakeFindFrameworks)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
 # Search for the python framework on Apple.
 CMAKE_FIND_FRAMEWORKS(Python)
 

+ 24 - 6
Modules/FindQt.cmake

@@ -31,7 +31,7 @@
 #  License text for the above reference.)
 
 # look for signs of qt3 installations
-file(GLOB GLOB_TEMP_VAR /usr/lib/qt-3*/bin/qmake)
+file(GLOB GLOB_TEMP_VAR /usr/lib*/qt-3*/bin/qmake /usr/lib*/qt3*/bin/qmake)
 if(GLOB_TEMP_VAR)
   set(QT3_INSTALLED TRUE)
 endif()
@@ -43,6 +43,12 @@ if(GLOB_TEMP_VAR)
 endif()
 set(GLOB_TEMP_VAR)
 
+file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt3/bin/qmake)
+if(GLOB_TEMP_VAR)
+  set(QT3_INSTALLED TRUE)
+endif()
+set(GLOB_TEMP_VAR)
+
 # look for qt4 installations
 file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake)
 if(GLOB_TEMP_VAR)
@@ -56,6 +62,16 @@ if(GLOB_TEMP_VAR)
 endif()
 set(GLOB_TEMP_VAR)
 
+file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt4/bin/qmake)
+if(GLOB_TEMP_VAR)
+  set(QT4_INSTALLED TRUE)
+endif()
+set(GLOB_TEMP_VAR)
+
+if (Qt_FIND_VERSION)
+  set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
+endif ()
+
 # now find qmake
 find_program(QT_QMAKE_EXECUTABLE_FINDQT NAMES qmake PATHS "${QT_SEARCH_PATH}/bin" "$ENV{QTDIR}/bin")
 if(QT_QMAKE_EXECUTABLE_FINDQT)
@@ -87,6 +103,7 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h
   /usr/lib/qt/include/Qt
   /usr/include/Qt
   /usr/share/qt4/include/Qt
+  /usr/local/include/X11/qt4/Qt
   C:/Progra~1/qt/include/Qt )
 
 if(QT4_QGLOBAL_H_FILE)
@@ -106,6 +123,7 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h
   /usr/lib/qt/include
   /usr/include
   /usr/share/qt3/include
+  /usr/local/include/X11/qt3
   C:/Progra~1/qt/include
   /usr/include/qt3 )
 
@@ -113,15 +131,15 @@ if(QT3_QGLOBAL_H_FILE)
   set(QT3_INSTALLED TRUE)
 endif()
 
-if(QT3_INSTALLED AND QT4_INSTALLED )
+if(QT3_INSTALLED AND QT4_INSTALLED AND NOT DESIRED_QT_VERSION)
   # force user to pick if we have both
   set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4")
 else()
   # if only one found then pick that one
-  if(QT3_INSTALLED)
+  if(QT3_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 4)
     set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4")
   endif()
-  if(QT4_INSTALLED)
+  if(QT4_INSTALLED AND NOT DESIRED_QT_VERSION EQUAL 3)
     set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4")
   endif()
 endif()
@@ -129,12 +147,12 @@ endif()
 if(DESIRED_QT_VERSION MATCHES 3)
   set(Qt3_FIND_REQUIRED ${Qt_FIND_REQUIRED})
   set(Qt3_FIND_QUIETLY  ${Qt_FIND_QUIETLY})
-  include(FindQt3)
+  include(${CMAKE_CURRENT_LIST_DIR}/FindQt3.cmake)
 endif()
 if(DESIRED_QT_VERSION MATCHES 4)
   set(Qt4_FIND_REQUIRED ${Qt_FIND_REQUIRED})
   set(Qt4_FIND_QUIETLY  ${Qt_FIND_QUIETLY})
-  include(FindQt4)
+  include(${CMAKE_CURRENT_LIST_DIR}/FindQt4.cmake)
 endif()
 
 if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED)

+ 4 - 2
Modules/FindQt3.cmake

@@ -64,6 +64,7 @@ find_path(QT_INCLUDE_DIR qt.h
   /usr/share/qt3/include
   C:/Progra~1/qt/include
   /usr/include/qt3
+  /usr/local/include/X11/qt3
   )
 
 # if qglobal.h is not in the qt_include_dir then set
@@ -146,7 +147,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
 
 # Qt 3 should prefer QTDIR over the PATH
 find_program(QT_MOC_EXECUTABLE
-  NAMES moc-qt3 moc
+  NAMES moc-qt3 moc moc3 moc3-mt
   HINTS
     ENV QTDIR
   PATHS
@@ -154,6 +155,7 @@ find_program(QT_MOC_EXECUTABLE
   "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
   "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
   ${GLOB_PATHS_BIN}
+    /usr/local/lib/qt3
     /usr/local/qt
     /usr/lib/qt
     /usr/lib/qt3
@@ -170,7 +172,7 @@ endif()
 
 # Qt 3 should prefer QTDIR over the PATH
 find_program(QT_UIC_EXECUTABLE
-  NAMES uic-qt3 uic
+  NAMES uic-qt3 uic uic3 uic3-mt
   HINTS
     ENV QTDIR
   PATHS

+ 12 - 8
Modules/FindQt4.cmake

@@ -65,6 +65,10 @@
 #       is much more flexible, but requires that FindQt4.cmake is executed before
 #       such an exported dependency file is processed.
 #
+#  QT_INCLUDE_DIRS_NO_SYSTEM
+#        If this variable is set to TRUE, the Qt include directories
+#        in the QT_USE_FILE will NOT have the SYSTEM keyword set.
+#
 # There are also some files that need processing by some Qt tools such as moc
 # and uic.  Listed below are macros that may be used to process those files.
 #
@@ -376,8 +380,8 @@ if(QT_QT_LIBRARY)
 endif()
 
 
-include(CheckCXXSymbolExists)
-include(MacroAddFileDependencies)
+include(${CMAKE_CURRENT_LIST_DIR}/CheckCXXSymbolExists.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/MacroAddFileDependencies.cmake)
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
 
 set(QT_USE_FILE ${CMAKE_ROOT}/Modules/UseQt4.cmake)
@@ -982,13 +986,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
   endif()
 
   find_program(QT_MOC_EXECUTABLE
-    NAMES moc-qt4 moc
+    NAMES moc-qt4 moc moc4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_UIC_EXECUTABLE
-    NAMES uic-qt4 uic
+    NAMES uic-qt4 uic uic4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
@@ -1018,13 +1022,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     )
 
   find_program(QT_LUPDATE_EXECUTABLE
-    NAMES lupdate-qt4 lupdate
+    NAMES lupdate-qt4 lupdate lupdate4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_LRELEASE_EXECUTABLE
-    NAMES lrelease-qt4 lrelease
+    NAMES lrelease-qt4 lrelease lrelease4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
@@ -1036,13 +1040,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     )
 
   find_program(QT_DESIGNER_EXECUTABLE
-    NAMES designer-qt4 designer
+    NAMES designer-qt4 designer designer4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_LINGUIST_EXECUTABLE
-    NAMES linguist-qt4 linguist
+    NAMES linguist-qt4 linguist linguist4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )

+ 1 - 1
Modules/FindSDL.cmake

@@ -122,7 +122,7 @@ if(SDL_LIBRARY_TEMP)
   if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY)
     list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX)
     if(_SDL_MAIN_INDEX EQUAL -1)
-      list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}")
+      set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP})
     endif()
     unset(_SDL_MAIN_INDEX)
   endif()

+ 2 - 1
Modules/FindSDL_image.cmake

@@ -40,7 +40,7 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
   HINTS
     ENV SDLIMAGEDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_IMAGE_LIBRARY
   HINTS
     ENV SDLIMAGEDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")

+ 2 - 1
Modules/FindSDL_mixer.cmake

@@ -40,7 +40,7 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
   HINTS
     ENV SDLMIXERDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_MIXER_LIBRARY
   HINTS
     ENV SDLMIXERDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")

+ 2 - 1
Modules/FindSDL_net.cmake

@@ -40,7 +40,7 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
   HINTS
     ENV SDLNETDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_NET_LIBRARY
   HINTS
     ENV SDLNETDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")

+ 2 - 1
Modules/FindSDL_sound.cmake

@@ -77,7 +77,7 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
   HINTS
     ENV SDLSOUNDDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
   )
 
 find_library(SDL_SOUND_LIBRARY
@@ -85,6 +85,7 @@ find_library(SDL_SOUND_LIBRARY
   HINTS
     ENV SDLSOUNDDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
   )
 
 if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)

+ 2 - 1
Modules/FindSDL_ttf.cmake

@@ -40,7 +40,7 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
   HINTS
     ENV SDLTTFDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_TTF_LIBRARY
   HINTS
     ENV SDLTTFDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")

+ 1 - 1
Modules/FindSelfPackers.cmake

@@ -18,7 +18,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
 
 find_program(SELF_PACKER_FOR_EXECUTABLE
   upx

+ 147 - 12
Modules/FindSquish.cmake

@@ -1,9 +1,13 @@
 #
 # ---- Find Squish
-# This module can be used to find Squish (currently support is aimed at version 3).
+# This module can be used to find Squish. Currently Squish versions 3 and 4 are supported.
 #
 # ---- Variables and Macros
 #  SQUISH_FOUND                    If false, don't try to use Squish
+#  SQUISH_VERSION                  The full version of Squish found
+#  SQUISH_VERSION_MAJOR            The major version of Squish found
+#  SQUISH_VERSION_MINOR            The minor version of Squish found
+#  SQUISH_VERSION_PATCH            The patch version of Squish found
 #
 #  SQUISH_INSTALL_DIR              The Squish installation directory (containing bin, lib, etc)
 #  SQUISH_SERVER_EXECUTABLE        The squishserver executable
@@ -13,18 +17,52 @@
 #  SQUISH_SERVER_EXECUTABLE_FOUND  Was the server executable found?
 #  SQUISH_CLIENT_EXECUTABLE_FOUND  Was the client executable found?
 #
-# macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
+# It provides the function squish_v4_add_test() for adding a squish test to cmake using Squish 4.x:
+#
+#   squish_v4_add_test(cmakeTestName AUT targetName SUITE suiteName TEST squishTestName
+#                   [SETTINGSGROUP group] [PRE_COMMAND command] [POST_COMMAND command] )
+#
+# The arguments have the following meaning:
+#   cmakeTestName: this will be used as the first argument for add_test()
+#   AUT targetName: the name of the cmake target which will be used as AUT, i.e. the
+#                   executable which will be tested.
+#   SUITE suiteName: this is either the full path to the squish suite, or just the
+#                    last directory of the suite, i.e. the suite name. In this case
+#                    the CMakeLists.txt which calls squish_add_test() must be located
+#                    in the parent directory of the suite directory.
+#   TEST squishTestName: the name of the squish test, i.e. the name of the subdirectory
+#                        of the test inside the suite directory.
+#   SETTINGSGROUP group: if specified, the given settings group will be used for executing the test.
+#                        If not specified, the groupname will be "CTest_<username>"
+#   PRE_COMMAND command:  if specified, the given command will be executed before starting the squish test.
+#   POST_COMMAND command: same as PRE_COMMAND, but after the squish test has been executed.
+#
+# ---- Typical Use
+#   enable_testing()
+#   find_package(Squish 4.0)
+#   if (SQUISH_FOUND)
+#      squish_v4_add_test(myTestName AUT myApp SUITE ${CMAKE_SOURCE_DIR}/tests/mySuite TEST someSquishTest SETTINGSGROUP myGroup )
+#   endif ()
+#
+#
+# For users of Squish version 3.x the macro squish_v3_add_test() is provided:
+#   squish_v3_add_test(testName applicationUnderTest testCase envVars testWrapper)
+#   Use this macro to add a test using Squish 3.x.
 #
 # ---- Typical Use
 #  enable_testing()
 #  find_package(Squish)
 #  if (SQUISH_FOUND)
-#    SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
+#    squish_v3_add_test(myTestName myApplication testCase envVars testWrapper)
 #  endif ()
 #
+# macro SQUISH_ADD_TEST(testName applicationUnderTest testCase envVars testWrapper)
+#   This is deprecated. Use SQUISH_V3_ADD_TEST() if you are using Squish 3.x instead.
+
 
 #=============================================================================
 # Copyright 2008-2009 Kitware, Inc.
+# Copyright 2012 Alexander Neundorf
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -36,6 +74,9 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
+
+include(CMakeParseArguments)
+
 set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
 set(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
 set(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.")
@@ -74,21 +115,36 @@ if(SQUISH_INSTALL_DIR)
 
   # find the client program
   if(NOT SQUISH_CLIENT_EXECUTABLE)
-    find_program(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
+    find_program(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
   endif()
 
   # find the server program
   if(NOT SQUISH_SERVER_EXECUTABLE)
-    find_program(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
+    find_program(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver${CMAKE_EXECUTABLE_SUFFIX} DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
   endif()
 
 else()
   set(SQUISH_INSTALL_DIR_FOUND 0)
 endif()
 
+
+set(SQUISH_VERSION)
+set(SQUISH_VERSION_MAJOR )
+set(SQUISH_VERSION_MINOR )
+set(SQUISH_VERSION_PATCH )
+
 # record if executables are set
 if(SQUISH_CLIENT_EXECUTABLE)
   set(SQUISH_CLIENT_EXECUTABLE_FOUND 1)
+  execute_process(COMMAND "${SQUISH_CLIENT_EXECUTABLE}" --version
+                  OUTPUT_VARIABLE _squishVersionOutput
+                  ERROR_QUIET )
+  if("${_squishVersionOutput}" MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+).*$")
+    set(SQUISH_VERSION_MAJOR "${CMAKE_MATCH_1}")
+    set(SQUISH_VERSION_MINOR "${CMAKE_MATCH_2}")
+    set(SQUISH_VERSION_PATCH "${CMAKE_MATCH_3}")
+    set(SQUISH_VERSION "${SQUISH_VERSION_MAJOR}.${SQUISH_VERSION_MINOR}.${SQUISH_VERSION_PATCH}" )
+  endif()
 else()
   set(SQUISH_CLIENT_EXECUTABLE_FOUND 0)
 endif()
@@ -100,16 +156,21 @@ else()
 endif()
 
 # record if Squish was found
-set(SQUISH_FOUND 1)
-foreach(var SQUISH_INSTALL_DIR_FOUND SQUISH_CLIENT_EXECUTABLE_FOUND SQUISH_SERVER_EXECUTABLE_FOUND)
-  if(NOT ${var})
-    set(SQUISH_FOUND 0)
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Squish  REQUIRED_VARS  SQUISH_INSTALL_DIR SQUISH_CLIENT_EXECUTABLE SQUISH_SERVER_EXECUTABLE
+                                          VERSION_VAR  SQUISH_VERSION )
+
+
+set(_SQUISH_MODULE_DIR "${CMAKE_CURRENT_LIST_DIR}")
+
+macro(SQUISH_V3_ADD_TEST testName testAUT testCase envVars testWraper)
+  if("${SQUISH_VERSION_MAJOR}" STREQUAL "4")
+    message(STATUS "Using squish_v3_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
   endif()
-endforeach()
 
-macro(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
   add_test(${testName}
     ${CMAKE_COMMAND} -V -VV
+    "-Dsquish_version:STRING=3"
     "-Dsquish_aut:STRING=${testAUT}"
     "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
     "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
@@ -117,10 +178,84 @@ macro(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
     "-Dsquish_test_case:STRING=${testCase}"
     "-Dsquish_env_vars:STRING=${envVars}"
     "-Dsquish_wrapper:STRING=${testWraper}"
-    -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake"
+    "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
+    -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
     )
   set_tests_properties(${testName}
     PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL"
     )
 endmacro()
 
+
+macro(SQUISH_ADD_TEST)
+  message(STATUS "Using squish_add_test() is deprecated, use squish_v3_add_test() instead.")
+  squish_v3_add_test(${ARGV})
+endmacro()
+
+
+function(SQUISH_V4_ADD_TEST testName)
+
+  if(NOT "${SQUISH_VERSION_MAJOR}" STREQUAL "4")
+    message(STATUS "Using squish_v4_add_test(), but SQUISH_VERSION_MAJOR is ${SQUISH_VERSION_MAJOR}.\nThis may not work.")
+  endif()
+
+  set(oneValueArgs AUT SUITE TEST SETTINGSGROUP PRE_COMMAND POST_COMMAND)
+
+  cmake_parse_arguments(_SQUISH "" "${oneValueArgs}" "" ${ARGN} )
+
+  if(_SQUISH_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "Unknown keywords given to SQUISH_ADD_TEST(): \"${_SQUISH_UNPARSED_ARGUMENTS}\"")
+  endif()
+
+  if(NOT _SQUISH_AUT)
+    message(FATAL_ERROR "Required argument AUT not given for SQUISH_ADD_TEST()")
+  endif()
+
+  if(NOT _SQUISH_SUITE)
+    message(FATAL_ERROR "Required argument SUITE not given for SQUISH_ADD_TEST()")
+  endif()
+
+  if(NOT _SQUISH_TEST)
+    message(FATAL_ERROR "Required argument TEST not given for SQUISH_ADD_TEST()")
+  endif()
+
+  get_target_property(testAUTLocation ${_SQUISH_AUT} LOCATION)
+  get_filename_component(testAUTDir ${testAUTLocation} PATH)
+  get_filename_component(testAUTName ${testAUTLocation} NAME)
+
+  get_filename_component(absTestSuite "${_SQUISH_SUITE}" ABSOLUTE)
+  if(NOT EXISTS "${absTestSuite}")
+    message(FATAL_ERROR "Could not find squish test suite ${_SQUISH_SUITE} (checked ${absTestSuite})")
+  endif()
+
+  set(absTestCase "${absTestSuite}/${_SQUISH_TEST}")
+  if(NOT EXISTS "${absTestCase}")
+    message(FATAL_ERROR "Could not find squish testcase ${_SQUISH_TEST} (checked ${absTestCase})")
+  endif()
+
+  if(NOT _SQUISH_SETTINGSGROUP)
+    set(_SQUISH_SETTINGSGROUP "CTest_$ENV{LOGNAME}")
+  endif()
+
+  add_test(${testName}
+    ${CMAKE_COMMAND} -V -VV
+    "-Dsquish_version:STRING=4"
+    "-Dsquish_aut:STRING=${testAUTName}"
+    "-Dsquish_aut_dir:STRING=${testAUTDir}"
+    "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
+    "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
+    "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
+    "-Dsquish_test_suite:STRING=${absTestSuite}"
+    "-Dsquish_test_case:STRING=${_SQUISH_TEST}"
+    "-Dsquish_env_vars:STRING=${envVars}"
+    "-Dsquish_wrapper:STRING=${testWraper}"
+    "-Dsquish_module_dir:STRING=${_SQUISH_MODULE_DIR}"
+    "-Dsquish_settingsgroup:STRING=${_SQUISH_SETTINGSGROUP}"
+    "-Dsquish_pre_command:STRING=${_SQUISH_PRE_COMMAND}"
+    "-Dsquish_post_command:STRING=${_SQUISH_POST_COMMAND}"
+    -P "${_SQUISH_MODULE_DIR}/SquishTestScript.cmake"
+    )
+  set_tests_properties(${testName}
+    PROPERTIES FAIL_REGULAR_EXPRESSION "FAIL;FAILED;ERROR;FATAL"
+    )
+endfunction()

+ 11 - 3
Modules/FindTCL.cmake

@@ -44,9 +44,9 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(CMakeFindFrameworks)
-include(FindTclsh)
-include(FindWish)
+include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindFrameworks.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindTclsh.cmake)
+include(${CMAKE_CURRENT_LIST_DIR}/FindWish.cmake)
 
 if(TCLSH_VERSION_STRING)
   set(TCL_TCLSH_VERSION "${TCLSH_VERSION_STRING}")
@@ -82,6 +82,10 @@ set(TCLTK_POSSIBLE_LIB_PATHS
   "${TK_LIBRARY_PATH}"
   "${TCL_TCLSH_PATH_PARENT}/lib"
   "${TK_WISH_PATH_PARENT}/lib"
+  /usr/local/lib/tcl/tcl8.5
+  /usr/local/lib/tcl/tk8.5
+  /usr/local/lib/tcl/tcl8.4
+  /usr/local/lib/tcl/tk8.4
   )
 
 if(WIN32)
@@ -168,6 +172,10 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS
   /usr/include/tcl8.3
   /usr/include/tcl8.2
   /usr/include/tcl8.0
+  /usr/local/include/tcl8.5
+  /usr/local/include/tk8.5
+  /usr/local/include/tcl8.4
+  /usr/local/include/tk8.4
   )
 
 if(WIN32)

+ 1 - 1
Modules/FindTclStub.cmake

@@ -34,7 +34,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindTCL)
+include(${CMAKE_CURRENT_LIST_DIR}/FindTCL.cmake)
 
 get_filename_component(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
 get_filename_component(TCL_TCLSH_PATH_PARENT "${TCL_TCLSH_PATH}" PATH)

+ 1 - 1
Modules/FindUnixCommands.cmake

@@ -15,7 +15,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
 
 find_program(BASH
   bash

+ 2 - 2
Modules/FindVTK.cmake

@@ -62,7 +62,7 @@ set(VTK_DIR_MESSAGE "VTK not found.  Set the VTK_DIR cmake cache entry to the ${
 if(_VTK_40_ALLOW AND VTK_DIR)
   if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
     set(VTK_FOUND 1)
-    include(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
+    include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
   endif()
 endif()
 
@@ -117,7 +117,7 @@ if(_VTK_40_ALLOW AND NOT VTK_DIR)
   if(VTK_DIR)
     if(EXISTS ${VTK_DIR}/UseVTK.cmake AND NOT EXISTS ${VTK_DIR}/VTKConfig.cmake)
       set(VTK_FOUND 1)
-      include(UseVTKConfig40) # No VTKConfig; load VTK 4.0 settings.
+      include(${CMAKE_CURRENT_LIST_DIR}/UseVTKConfig40.cmake) # No VTKConfig; load VTK 4.0 settings.
     else()
       # We found the wrong version.  Pretend we did not find it.
       set(VTK_DIR "VTK_DIR-NOTFOUND" CACHE PATH "The ${VTK_DIR_DESCRIPTION}" FORCE)

+ 1 - 1
Modules/FindWget.cmake

@@ -17,7 +17,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-include(FindCygwin)
+include(${CMAKE_CURRENT_LIST_DIR}/FindCygwin.cmake)
 
 find_program(WGET_EXECUTABLE
   wget

+ 3 - 3
Modules/FindX11.cmake

@@ -336,8 +336,8 @@ if (UNIX)
   endif ()
 
   if(X11_FOUND)
-    include(CheckFunctionExists)
-    include(CheckLibraryExists)
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckFunctionExists.cmake)
+    include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake)
 
     # Translated from an autoconf-generated configure script.
     # See libs.m4 in autoconf's m4 directory.
@@ -417,7 +417,7 @@ if (UNIX)
     # Build the final list of libraries.
     set(X11_LIBRARIES ${X11_X_PRE_LIBS} ${X11_LIBRARIES} ${X11_X_EXTRA_LIBS})
 
-    include(FindPackageMessage)
+    include(${CMAKE_CURRENT_LIST_DIR}/FindPackageMessage.cmake)
     FIND_PACKAGE_MESSAGE(X11 "Found X11: ${X11_X11_LIB}"
       "[${X11_X11_LIB}][${X11_INCLUDE_DIR}]")
   else ()

+ 1 - 1
Modules/Findosg.cmake

@@ -46,7 +46,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgUtil/SceneView>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSG osg/PositionAttitudeTransform)
 OSG_FIND_LIBRARY(OSG osg)
 

+ 1 - 1
Modules/FindosgAnimation.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgAnimation/Animation>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGANIMATION osgAnimation/Animation)
 OSG_FIND_LIBRARY(OSGANIMATION osgAnimation)
 

+ 1 - 1
Modules/FindosgDB.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgDB/DatabasePager>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGDB osgDB/DatabasePager)
 OSG_FIND_LIBRARY(OSGDB osgDB)
 

+ 1 - 1
Modules/FindosgFX.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgFX/BumpMapping>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGFX osgFX/BumpMapping)
 OSG_FIND_LIBRARY(OSGFX osgFX)
 

+ 1 - 1
Modules/FindosgGA.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgGA/FlightManipulator>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGGA osgGA/FlightManipulator)
 OSG_FIND_LIBRARY(OSGGA osgGA)
 

+ 1 - 1
Modules/FindosgIntrospection.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgIntrospection/Reflection>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGINTROSPECTION osgIntrospection/Reflection)
 OSG_FIND_LIBRARY(OSGINTROSPECTION osgIntrospection)
 

+ 1 - 1
Modules/FindosgManipulator.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgManipulator/TrackballDragger>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGMANIPULATOR osgManipulator/TrackballDragger)
 OSG_FIND_LIBRARY(OSGMANIPULATOR osgManipulator)
 

+ 1 - 1
Modules/FindosgParticle.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgParticle/FireEffect>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGPARTICLE osgParticle/FireEffect)
 OSG_FIND_LIBRARY(OSGPARTICLE osgParticle)
 

+ 1 - 1
Modules/FindosgPresentation.cmake

@@ -43,7 +43,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgPresentation/SlideEventHandler>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGPRESENTATION osgPresentation/SlideEventHandler)
 OSG_FIND_LIBRARY(OSGPRESENTATION osgPresentation)
 

+ 1 - 1
Modules/FindosgProducer.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgProducer/OsgSceneHandler>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGPRODUCER osgProducer/OsgSceneHandler)
 OSG_FIND_LIBRARY(OSGPRODUCER osgProducer)
 

+ 1 - 1
Modules/FindosgQt.cmake

@@ -43,7 +43,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgQt/GraphicsWindowQt>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGQT osgQt/GraphicsWindowQt)
 OSG_FIND_LIBRARY(OSGQT osgQt)
 

+ 1 - 1
Modules/FindosgShadow.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgShadow/ShadowTexture>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGSHADOW osgShadow/ShadowTexture)
 OSG_FIND_LIBRARY(OSGSHADOW osgShadow)
 

+ 1 - 1
Modules/FindosgSim.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgSim/ImpostorSprite>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGSIM osgSim/ImpostorSprite)
 OSG_FIND_LIBRARY(OSGSIM osgSim)
 

+ 1 - 1
Modules/FindosgTerrain.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgTerrain/Terrain>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGTERRAIN osgTerrain/Terrain)
 OSG_FIND_LIBRARY(OSGTERRAIN osgTerrain)
 

+ 1 - 1
Modules/FindosgText.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgText/Text>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGTEXT osgText/Text)
 OSG_FIND_LIBRARY(OSGTEXT osgText)
 

+ 1 - 1
Modules/FindosgUtil.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgUtil/SceneView>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGUTIL osgUtil/SceneView)
 OSG_FIND_LIBRARY(OSGUTIL osgUtil)
 

+ 1 - 1
Modules/FindosgViewer.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgViewer/Viewer>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGVIEWER osgViewer/Viewer)
 OSG_FIND_LIBRARY(OSGVIEWER osgViewer)
 

+ 1 - 1
Modules/FindosgVolume.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgVolume/Volume>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGVOLUME osgVolume/Volume)
 OSG_FIND_LIBRARY(OSGVOLUME osgVolume)
 

+ 1 - 1
Modules/FindosgWidget.cmake

@@ -42,7 +42,7 @@
 # #include <osg/PositionAttitudeTransform>
 # #include <osgWidget/Widget>
 
-include(Findosg_functions)
+include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
 OSG_FIND_PATH   (OSGWIDGET osgWidget/Widget)
 OSG_FIND_LIBRARY(OSGWIDGET osgWidget)
 

+ 1 - 1
Modules/FindwxWindows.cmake

@@ -26,7 +26,7 @@
 #  HAVE_ISYSTEM      - true required to replace -I by -isystem on g++
 #
 # For convenience include Use_wxWindows.cmake in your project's
-# CMakeLists.txt using include(Use_wxWindows).
+# CMakeLists.txt using include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
 #
 # USAGE
 #  set(WXWINDOWS_USE_GL 1)

+ 5 - 2
Modules/NSIS.template.in

@@ -37,6 +37,9 @@
   ;Set compression
   SetCompressor @CPACK_NSIS_COMPRESSOR@
 
+  ;Require administrator access
+  RequestExecutionLevel admin
+
 @CPACK_NSIS_DEFINES@
 
   !include Sections.nsh
@@ -119,7 +122,7 @@ Var AR_RegFlags
  "exit_${SecName}:"
 !macroend
 
-!macro RemoveSection SecName
+!macro RemoveSection_CPack SecName
   ;  This macro is used to call section's Remove_... macro
   ;from the uninstaller.
   ;Input: section index constant name specified in Section command.
@@ -841,7 +844,7 @@ Section "Uninstall"
   DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
 
   ; Removes all optional components
-  !insertmacro SectionList "RemoveSection"
+  !insertmacro SectionList "RemoveSection_CPack"
 
   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
 

+ 17 - 0
Modules/Platform/Darwin.cmake

@@ -263,6 +263,23 @@ set(CMAKE_SYSTEM_FRAMEWORK_PATH
   /Network/Library/Frameworks
   /System/Library/Frameworks)
 
+# Warn about known system mis-configuration case.
+if(CMAKE_OSX_SYSROOT)
+  get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+  if(NOT _IN_TC AND
+     NOT IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks"
+     AND IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks/Frameworks")
+    message(WARNING "The SDK Library/Frameworks path\n"
+      " ${CMAKE_OSX_SYSROOT}/Library/Frameworks\n"
+      "is not set up correctly on this system.  "
+      "This is known to occur when installing Xcode 3.2.6:\n"
+      " http://bugs.python.org/issue14018\n"
+      "The problem may cause build errors that report missing system frameworks.  "
+      "Fix your SDK symlinks to resolve this issue and avoid this warning."
+      )
+  endif()
+endif()
+
 # default to searching for application bundles first
 if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
   set(CMAKE_FIND_APPBUNDLE FIRST)

+ 11 - 13
Modules/Platform/FreeBSD.cmake

@@ -1,16 +1,14 @@
-if(EXISTS /usr/include/dlfcn.h)
-  set(CMAKE_DL_LIBS "")
-  set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
-  set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
-  set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")            # -pic
-  set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")       # -shared
-  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")         # +s, flag for exe link to use shared lib
-  set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")       # -rpath
-  set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")   # : or empty
-  set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
-  set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
-  set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-endif()
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")            # -pic
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")       # -shared
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")         # +s, flag for exe link to use shared lib
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")       # -rpath
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")   # : or empty
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
 
 # Shared libraries with no builtin soname may not be linked safely by
 # specifying the file path.

+ 11 - 13
Modules/Platform/NetBSD.cmake

@@ -1,15 +1,13 @@
-if(EXISTS /usr/include/dlfcn.h)
-  set(CMAKE_DL_LIBS "")
-  set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
-  set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
-  set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")            # -pic
-  set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")       # -shared
-  set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")         # +s, flag for exe link to use shared lib
-  set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")       # -rpath
-  set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")   # : or empty
-  set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
-  set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
-  set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
-endif()
+set(CMAKE_DL_LIBS "")
+set(CMAKE_C_COMPILE_OPTIONS_PIC "-fPIC")
+set(CMAKE_C_COMPILE_OPTIONS_PIE "-fPIE")
+set(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")            # -pic
+set(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")       # -shared
+set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")         # +s, flag for exe link to use shared lib
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-rpath,")       # -rpath
+set(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")   # : or empty
+set(CMAKE_SHARED_LIBRARY_RPATH_LINK_C_FLAG "-Wl,-rpath-link,")
+set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
+set(CMAKE_EXE_EXPORTS_C_FLAG "-Wl,--export-dynamic")
 
 include(Platform/UnixPaths)

+ 4 - 0
Modules/Platform/OpenBSD.cmake

@@ -16,3 +16,7 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
 endif()
 
 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
+
+# OpenBSD policy requires that shared libraries be installed without
+# executable permission.
+set(CMAKE_INSTALL_SO_NO_EXE 1)

+ 1 - 1
Modules/Platform/Windows-Intel.cmake

@@ -50,7 +50,7 @@ elseif(MSVC_CXX_ARCHITECTURE_ID)
 elseif(MSVC_Fortran_ARCHITECTURE_ID)
   set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
 endif()
-set (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
+set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
 set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
 set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
 

+ 8 - 3
Modules/Platform/Windows-MSVC.cmake

@@ -154,13 +154,18 @@ else()
     set(_FLAGS_CXX " /GR /GX")
     set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib")
   endif()
+
+  if(MSVC_VERSION LESS 1310)
+    set(_FLAGS_C   " /Zm1000${_FLAGS_C}")
+    set(_FLAGS_CXX " /Zm1000${_FLAGS_CXX}")
+  endif()
 endif()
 
 set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
 
 # executable linker flags
 set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
-# set the stack size and the machine type
+# set the machine type
 set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
 if(NOT _MACHINE_ARCH_FLAG)
   set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
@@ -173,7 +178,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
   endif()
 endif()
 set (CMAKE_EXE_LINKER_FLAGS_INIT
-    "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
+    "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}")
 
 # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
 # on versions that support it
@@ -233,7 +238,7 @@ macro(__windows_compiler_msvc lang)
   set(CMAKE_${lang}_LINK_EXECUTABLE
     "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
-  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
+  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
   set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
   set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG")
   set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG")

+ 24 - 0
Modules/Squish4RunTestCase.bat

@@ -0,0 +1,24 @@
+set SQUISHSERVER=%1
+set SQUISHRUNNER=%2
+set TESTSUITE=%3
+set TESTCASE=%4
+set AUT=%5
+set AUTDIR=%6
+set SETTINGSGROUP=%7
+
+%SQUISHSERVER% --stop
+
+echo "Adding AUT... %SQUISHSERVER% --config addAUT %AUT% %AUTDIR%"
+%SQUISHSERVER% --config addAUT "%AUT%" "%AUTDIR%"
+
+echo "Starting the squish server... %SQUISHSERVER%"
+start /B %SQUISHSERVER%
+
+echo "Running the test case...%SQUISHRUNNER% --testsuite %TESTSUITE% --testcase %TESTCASE%"
+%SQUISHRUNNER% --testsuite "%TESTSUITE%" --testcase "%TESTCASE%"
+set returnValue=%ERRORLEVEL%
+
+echo "Stopping the squish server... %SQUISHSERVER% --stop"
+%SQUISHSERVER% --stop
+
+exit /B %returnValue%

+ 28 - 0
Modules/Squish4RunTestCase.sh

@@ -0,0 +1,28 @@
+#!/bin/sh
+
+SQUISHSERVER=$1
+SQUISHRUNNER=$2
+TESTSUITE=$3
+TESTCASE=$4
+AUT=$5
+AUTDIR=$6
+SETTINGSGROUP=$7
+
+$SQUISHSERVER --stop > /dev/null 2>&1
+
+echo "Adding AUT... $SQUISHSERVER --settingsGroup $SETTINGSGROUP --config addAUT $AUT $AUTDIR"
+$SQUISHSERVER --settingsGroup "$SETTINGSGROUP" --config addAUT "$AUT" "$AUTDIR" || exit -1
+# sleep 1
+
+echo "Starting the squish server... $SQUISHSERVER --daemon"
+$SQUISHSERVER --daemon || exit -1
+# sleep 2
+
+echo "Running the test case...$SQUISHRUNNER --settingsGroup $SETTINGSGROUP --testsuite $TESTSUITE --testcase $TESTCASE"
+$SQUISHRUNNER --settingsGroup "$SETTINGSGROUP" --testsuite "$TESTSUITE" --testcase "$TESTCASE"
+returnValue=$?
+
+echo "Stopping the squish server... $SQUISHSERVER --stop"
+$SQUISHSERVER --stop
+
+exit $returnValue

+ 35 - 17
Modules/SquishTestScript.cmake

@@ -22,17 +22,22 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
-
 # print out the variable that we are using
 message(STATUS "squish_aut='${squish_aut}'")
+message(STATUS "squish_aut_dir='${squish_aut_dir}'")
 
+message(STATUS "squish_version='${squish_version}'")
 message(STATUS "squish_server_executable='${squish_server_executable}'")
 message(STATUS "squish_client_executable='${squish_client_executable}'")
 message(STATUS "squish_libqtdir ='${squish_libqtdir}'")
+message(STATUS "squish_test_suite='${squish_test_suite}'")
 message(STATUS "squish_test_case='${squish_test_case}'")
 message(STATUS "squish_wrapper='${squish_wrapper}'")
 message(STATUS "squish_env_vars='${squish_env_vars}'")
+message(STATUS "squish_module_dir='${squish_module_dir}'")
+message(STATUS "squish_settingsgroup='${squish_settingsgroup}'")
+message(STATUS "squish_pre_command='${squish_pre_command}'")
+message(STATUS "squish_post_command='${squish_post_command}'")
 
 # parse enviornment variables
 foreach(i ${squish_env_vars})
@@ -48,25 +53,38 @@ if (QT4_INSTALLED)
   set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} )
 endif ()
 
+if(squish_pre_command)
+  message(STATUS "Executing pre command: ${squish_pre_command}")
+  execute_process(COMMAND "${squish_pre_command}")
+endif()
+
 # run the test
-if (WIN32)
-  execute_process(
-    COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
-    RESULT_VARIABLE test_rv
-    )
-endif ()
+if("${squish_version}" STREQUAL "4")
+  if (WIN32)
+    execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+                    RESULT_VARIABLE test_rv )
+  elseif(UNIX)
+    execute_process(COMMAND ${squish_module_dir}/Squish4RunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_suite} ${squish_test_case} ${squish_aut} ${squish_aut_dir} ${squish_settingsgroup}
+                    RESULT_VARIABLE test_rv )
+  endif ()
 
-if (UNIX)
-  execute_process(
-    COMMAND ${CMAKE_ROOT}/Modules/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
-    RESULT_VARIABLE test_rv
-    )
-endif ()
+else()
+
+  if (WIN32)
+    execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.bat ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+                    RESULT_VARIABLE test_rv )
+  elseif(UNIX)
+    execute_process(COMMAND ${squish_module_dir}/SquishRunTestCase.sh ${squish_server_executable} ${squish_client_executable} ${squish_test_case} ${squish_wrapper} ${squish_aut}
+                    RESULT_VARIABLE test_rv )
+  endif ()
+endif()
+
+if(squish_post_command)
+  message(STATUS "Executing post command: ${squish_post_command}")
+  execute_process(COMMAND "${squish_post_command}")
+endif()
 
 # check for an error with running the test
 if(NOT "${test_rv}" STREQUAL "0")
   message(FATAL_ERROR "Error running Squish test")
 endif()
-
-
-

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