Răsfoiți Sursa

Merge CPackRPM changes into doc-spelling

Conflicts:
	Modules/CPackRPM.cmake
Brad King 15 ani în urmă
părinte
comite
7739d786a4

+ 2 - 2
CMakeLists.txt

@@ -340,8 +340,8 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
 SET(CMake_VERSION_MAJOR 2)
 SET(CMake_VERSION_MINOR 8)
 SET(CMake_VERSION_PATCH 2)
-SET(CMake_VERSION_TWEAK 0)
-#SET(CMake_VERSION_RC 4)
+#SET(CMake_VERSION_TWEAK 0)
+#SET(CMake_VERSION_RC 1)
 
 # Releases define a tweak level.
 IF(DEFINED CMake_VERSION_TWEAK)

+ 94 - 87
Modules/CPackRPM.cmake

@@ -4,14 +4,14 @@
 # used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration
 #
 # However CPackRPM has specific features which are controlled by
-# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on 
-# the wiki: 
+# the specifics CPACK_RPM_XXX variables. You'll find a detailed usage on
+# the wiki:
 #  http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29
 # However as a handy reminder here comes the list of specific variables:
 #
-#  CPACK_RPM_PACKAGE_SUMMARY 
+#  CPACK_RPM_PACKAGE_SUMMARY
 #     Mandatory : YES
-#     Default   : CPACK_PACKAGE_DESCRIPTION
+#     Default   : CPACK_PACKAGE_DESCRIPTION_SUMMARY
 #     The RPM package summary
 #  CPACK_RPM_PACKAGE_NAME
 #     Mandatory : YES
@@ -24,14 +24,14 @@
 #  CPACK_RPM_PACKAGE_ARCHITECTURE
 #     Mandatory : NO
 #     Default   : -
-#     The RPM package architecture. This may be set to "noarch" if you 
+#     The RPM package architecture. This may be set to "noarch" if you
 #     know you are building a noarch package.
 #  CPACK_RPM_PACKAGE_RELEASE
 #     Mandatory : YES
 #     Default   : 1
-#     The RPM package release. This is the numbering of the RPM package 
-#     itself, i.e. the version of the packaging and not the version of the 
-#     content (see CPACK_RPM_PACKAGE_VERSION). One may change the default 
+#     The RPM package release. This is the numbering of the RPM package
+#     itself, i.e. the version of the packaging and not the version of the
+#     content (see CPACK_RPM_PACKAGE_VERSION). One may change the default
 #     value if the previous packaging was buggy and/or you want to put here
 #     a fancy Linux distro specific numbering.
 #  CPACK_RPM_PACKAGE_LICENSE
@@ -42,10 +42,14 @@
 #     Mandatory : YES
 #     Default   : "unknown"
 #     The RPM package group.
-#  CPACK_RPM_PACKAGE_VENDOR 
+#  CPACK_RPM_PACKAGE_VENDOR
 #     Mandatory : YES
 #     Default   : CPACK_PACKAGE_VENDOR if set or "unknown"
-#     The RPM package group.
+#     The RPM package vendor.
+#  CPACK_RPM_PACKAGE_URL
+#     Mandatory : NO
+#     Default   : -
+#     The projects URL.
 #  CPACK_RPM_PACKAGE_DESCRIPTION
 #     Mandatory : YES
 #     Default   : CPACK_PACKAGE_DESCRIPTION_FILE if set or "no package description available"
@@ -61,18 +65,27 @@
 #     Mandatory : NO
 #     Default   : -
 #     May be used to set RPM dependencies (requires).
-#     Note that you must enclose the complete requires string between quotes, 
+#     Note that you must enclose the complete requires string between quotes,
 #     for example:
 #     set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8")
-#  CPACK_RPM_PACKAGES_PROVIDES
+#  CPACK_RPM_PACKAGE_SUGGESTS
+#     Mandatory : NO
+#     Default   : -
+#     May be used to set weak RPM dependencies (suggests).
+#     Note that you must enclose the complete requires string between quotes.
+#  CPACK_RPM_PACKAGE_PROVIDES
 #     Mandatory : NO
 #     Default   : -
 #     May be used to set RPM dependencies (provides).
+#  CPACK_RPM_PACKAGE_OBSOLETES
+#     Mandatory : NO
+#     Default   : -
+#     May be used to set RPM packages that are obsoleted by this one.
 #  CPACK_RPM_SPEC_INSTALL_POST
 #     Mandatory : NO
 #     Default   : -
-#     May be used to set an RPM post-install command inside the spec file. 
-#     For example setting it to "/bin/true" may be used to prevent 
+#     May be used to set an RPM post-install command inside the spec file.
+#     For example setting it to "/bin/true" may be used to prevent
 #     rpmbuild to strip binaries.
 #  CPACK_RPM_SPEC_MORE_DEFINE
 #     Mandatory : NO
@@ -82,18 +95,18 @@
 #     Mandatory : NO
 #     Default   : -
 #     May be set when invoking cpack in order to trace debug information
-#     during CPack RPM run. For example you may launch CPack like this 
+#     during CPack RPM run. For example you may launch CPack like this
 #     cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM
 #  CPACK_RPM_USER_BINARY_SPECFILE
 #     Mandatory : NO
-#     Default   : - 
+#     Default   : -
 #     May be set by the user in order to specify a USER binary spec file
 #     to be used by CPackRPM instead of generating the file.
 #     The specified file will be processed by CONFIGURE_FILE( @ONLY).
 #  CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
 #     Mandatory : NO
 #     Default   : -
-#     If set CPack will generate a template for USER specified binary 
+#     If set CPack will generate a template for USER specified binary
 #     spec file and stop with an error. For example launch CPack like this
 #     cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM
 #     The user may then use this file in order to hand-craft is own
@@ -116,6 +129,12 @@
 #     put after the %post or %postun section
 #     One may verify which scriptlet has been included with
 #      rpm -qp --scripts  package.rpm
+#  CPACK_RPM_CHANGELOG_FILE
+#     Mandatory : NO
+#     Default   : -
+#     May be used to embbed a changelog in the spec file.
+#     The refered file will be read and directly  put after the %changelog
+#     section.
 
 #=============================================================================
 # Copyright 2007-2009 Kitware, Inc.
@@ -141,23 +160,23 @@ IF(NOT UNIX)
 ENDIF(NOT UNIX)
 
 # rpmbuild is the basic command for building RPM package
-# it may be a simple (symbolic) link to rpmb command.
+# it may be a simple (symbolic) link to rpm command.
 FIND_PROGRAM(RPMBUILD_EXECUTABLE rpmbuild)
 
-# Check version of the rpmbuild tool this would be easier to 
+# Check version of the rpmbuild tool this would be easier to
 # track bugs with users and CPackRPM debug mode.
-# We may use RPM version in order to check for available version dependent features 
+# We may use RPM version in order to check for available version dependent features
 IF(RPMBUILD_EXECUTABLE)
   execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version
                   OUTPUT_VARIABLE _TMP_VERSION
                   ERROR_QUIET
                   OUTPUT_STRIP_TRAILING_WHITESPACE)
-  string(REGEX REPLACE "^.*\ " ""   
+  string(REGEX REPLACE "^.*\ " ""
          RPMBUILD_EXECUTABLE_VERSION
-         ${_TMP_VERSION})     
+         ${_TMP_VERSION})
   IF(CPACK_RPM_PACKAGE_DEBUG)
     MESSAGE("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>")
-  ENDIF(CPACK_RPM_PACKAGE_DEBUG)  
+  ENDIF(CPACK_RPM_PACKAGE_DEBUG)
 ENDIF(RPMBUILD_EXECUTABLE)
 
 IF(NOT RPMBUILD_EXECUTABLE)
@@ -165,14 +184,14 @@ IF(NOT RPMBUILD_EXECUTABLE)
 ENDIF(NOT RPMBUILD_EXECUTABLE)
 
 # We may use RPM version in the future in order
-# to shut down warning about space in buildtree 
+# to shut down warning about space in buildtree
 # some recent RPM version should support space in different places.
 # not checked [yet].
 IF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
   MESSAGE(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.")
 ENDIF(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*")
 
-# If rpmbuild is found 
+# If rpmbuild is found
 # we try to discover alien since we may be on non RPM distro like Debian.
 # In this case we may try to to use more advanced features
 # like generating RPM directly from DEB using alien.
@@ -182,7 +201,7 @@ IF(ALIEN_EXECUTABLE)
   MESSAGE(STATUS "alien found, we may be on a Debian based distro.")
 ENDIF(ALIEN_EXECUTABLE)
 
-# 
+#
 # Use user-defined RPM specific variables value
 # or generate reasonable default value from
 # CPACK_xxx generic values.
@@ -197,10 +216,10 @@ IF(NOT CPACK_RPM_PACKAGE_SUMMARY)
   IF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
     STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY)
   ELSE(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
-    SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})    
+    SET(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY})
   ENDIF(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY)
 ENDIF(NOT CPACK_RPM_PACKAGE_SUMMARY)
- 
+
 # CPACK_RPM_PACKAGE_NAME (mandatory)
 IF(NOT CPACK_RPM_PACKAGE_NAME)
   STRING(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME)
@@ -294,25 +313,22 @@ IF (CPACK_RPM_COMPRESSION_TYPE)
 ELSE(CPACK_RPM_COMPRESSION_TYPE)
    SET(CPACK_RPM_COMPRESSION_TYPE_TMP "")
 ENDIF(CPACK_RPM_COMPRESSION_TYPE)
-# CPACK_RPM_PACKAGE_REQUIRES
-# Placeholder used to specify binary RPM dependencies (if any)
-# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
-IF(CPACK_RPM_PACKAGE_REQUIRES)
-  IF(CPACK_RPM_PACKAGE_DEBUG)
-    MESSAGE("CPackRPM:Debug: User defined Requires:\n ${CPACK_RPM_PACKAGE_REQUIRES}")
-  ENDIF(CPACK_RPM_PACKAGE_DEBUG)
-  SET(TMP_RPM_REQUIRES "Requires: ${CPACK_RPM_PACKAGE_REQUIRES}")
-ENDIF(CPACK_RPM_PACKAGE_REQUIRES)
 
-# CPACK_RPM_PACKAGE_PROVIDES
-# Placeholder used to specify binary RPM dependencies (if any)
-# see http://www.rpm.org/max-rpm/s1-rpm-depend-manual-dependencies.html
-IF(CPACK_RPM_PACKAGE_PROVIDES)
-  IF(CPACK_RPM_PACKAGE_DEBUG)
-    MESSAGE("CPackRPM:Debug: User defined Provides:\n ${CPACK_RPM_PACKAGE_PROVIDES}")
-  ENDIF(CPACK_RPM_PACKAGE_DEBUG)
-  SET(TMP_RPM_PROVIDES "Provides: ${CPACK_RPM_PACKAGE_PROVIDES}")
-ENDIF(CPACK_RPM_PACKAGE_PROVIDES)
+# check if additional fields for RPM spec header are given
+FOREACH(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES)
+  IF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+    STRING(LENGTH ${_RPM_SPEC_HEADER} _PACKAGE_HEADER_STRLENGTH)
+    MATH(EXPR _PACKAGE_HEADER_STRLENGTH "${_PACKAGE_HEADER_STRLENGTH} - 1")
+    STRING(SUBSTRING ${_RPM_SPEC_HEADER} 1 ${_PACKAGE_HEADER_STRLENGTH} _PACKAGE_HEADER_TAIL)
+    STRING(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL)
+    STRING(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME)
+    SET(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}")
+    IF(CPACK_RPM_PACKAGE_DEBUG)
+      MESSAGE("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}")
+    ENDIF(CPACK_RPM_PACKAGE_DEBUG)
+    SET(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}")
+  ENDIF(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER})
+ENDFOREACH(_RPM_SPEC_HEADER)
 
 # CPACK_RPM_SPEC_INSTALL_POST
 # May be used to define a RPM post intallation script
@@ -348,7 +364,7 @@ endif(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE)
 
 # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
 # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE
-# May be used to embbed a pre (un)installation script in the spec file.
+# May be used to embed a pre (un)installation script in the spec file.
 # The refered script file(s) will be read and directly
 # put after the %pre or %preun section
 if(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE)
@@ -367,6 +383,17 @@ if(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
   endif(EXISTS ${CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE})
 endif(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE)
 
+# CPACK_RPM_CHANGELOG_FILE
+# May be used to embed a changelog in the spec file.
+# The refered file will be read and directly put after the %changelog section
+if(CPACK_RPM_CHANGELOG_FILE)
+  if(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+    file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG)
+  else(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+    message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring")
+  endif(EXISTS ${CPACK_RPM_CHANGELOG_FILE})
+endif(CPACK_RPM_CHANGELOG_FILE)
+
 # CPACK_RPM_SPEC_MORE_DEFINE
 # This is a generated spec rpm file spaceholder
 IF(CPACK_RPM_SPEC_MORE_DEFINE)
@@ -407,7 +434,7 @@ EXECUTE_PROCESS(COMMAND find -type f -o -type l
 
 # The name of the final spec file to be used by rpmbuild
 SET(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec")
- 
+
 # Print out some debug information if we were asked for that
 IF(CPACK_RPM_PACKAGE_DEBUG)
    MESSAGE("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY          = ${CPACK_TOPLEVEL_DIRECTORY}")
@@ -420,7 +447,7 @@ IF(CPACK_RPM_PACKAGE_DEBUG)
    MESSAGE("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY   = ${CPACK_PACKAGE_INSTALL_DIRECTORY}")
    MESSAGE("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}")
 ENDIF(CPACK_RPM_PACKAGE_DEBUG)
- 
+
 # USER generated spec file handling.
 # We should generate a spec file template:
 #  - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE
@@ -429,7 +456,7 @@ ENDIF(CPACK_RPM_PACKAGE_DEBUG)
 IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
    FILE(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in
       "# -*- rpm-spec -*-
-Buildroot:      \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
+BuildRoot:      \@CPACK_RPM_DIRECTORY\@/\@CPACK_PACKAGE_FILE_NAME\@
 Summary:        \@CPACK_RPM_PACKAGE_SUMMARY\@
 Name:           \@CPACK_RPM_PACKAGE_NAME\@
 Version:        \@CPACK_RPM_PACKAGE_VERSION\@
@@ -437,10 +464,12 @@ Release:        \@CPACK_RPM_PACKAGE_RELEASE\@
 License:        \@CPACK_RPM_PACKAGE_LICENSE\@
 Group:          \@CPACK_RPM_PACKAGE_GROUP\@
 Vendor:         \@CPACK_RPM_PACKAGE_VENDOR\@
+\@TMP_RPM_URL\@
 \@TMP_RPM_REQUIRES\@
 \@TMP_RPM_PROVIDES\@
+\@TMP_RPM_OBSOLETES\@
 \@TMP_RPM_BUILDARCH\@
- 
+
 #p define prefix \@CMAKE_INSTALL_PREFIX\@
 %define _rpmdir \@CPACK_RPM_DIRECTORY\@
 %define _rpmfilename \@CPACK_RPM_FILE_NAME\@
@@ -449,7 +478,7 @@ Vendor:         \@CPACK_RPM_PACKAGE_VENDOR\@
 \@TMP_RPM_SPEC_INSTALL_POST\@
 \@CPACK_RPM_SPEC_MORE_DEFINE\@
 \@CPACK_RPM_COMPRESSION_TYPE_TMP\@
-  
+
 %description
 \@CPACK_RPM_PACKAGE_DESCRIPTION\@
 
@@ -461,14 +490,14 @@ Vendor:         \@CPACK_RPM_PACKAGE_VENDOR\@
 mv $RPM_BUILD_ROOT \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot
 
 #p build
-  
+
 %install
 if [ -e $RPM_BUILD_ROOT ];
 then
-  mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT 
+  mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot/* $RPM_BUILD_ROOT
 else
-  mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT 
-fi 
+  mv \@CPACK_TOPLEVEL_DIRECTORY\@/tmpBBroot $RPM_BUILD_ROOT
+fi
 
 %clean
 
@@ -489,61 +518,39 @@ fi
 ${CPACK_RPM_INSTALL_FILES}
 
 %changelog
-* Sun Apr 4 2010 Erk <[email protected]>
-  Add support for specifying RPM compression type
-* Sat Nov 28 2009 Erk <[email protected]>
-  Refix backup/restore install tree for OpenSuSE 11.2
-* Sun Nov 22 2009 Erk <[email protected]>
-  Include symlinks in the file list.
-* Sat Nov 14 2009 Erk <[email protected]>
-  Replace prep and build step with backup and restore
-  of the previously CPack installed tree. This should
-  mimic what is expected in rpmbuild usual steps
-* Wed Nov 11 2009 Erk <[email protected]>
-  Add support for USER defined pre/post[un]install scripts
-* Wed Oct 07 2009 Erk <[email protected]>
-  Add user custom spec file support 
-* Sat Oct 03 2009 Kami <[email protected]>
-  Update to handle more precisely the files section
-* Mon Oct 03 2008 Erk <[email protected]>
-  Update generator to handle optional dependencies using Requires
-  Update DEBUG output typos. 
-* Mon Aug 25 2008 Erk <[email protected]>
-  Update generator to handle optional post-install
-* Tue Aug 16 2007 Erk <[email protected]>
-  Generated by CPack RPM Generator and associated macros
+\@CPACK_RPM_SPEC_CHANGELOG\@
 ")
   # Stop here if we were asked to only generate a template USER spec file
   # The generated file may then be used as a template by user who wants
-  # to customize their own spec file.  
+  # to customize their own spec file.
   IF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
      MESSAGE(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file templare is: ${CPACK_RPM_BINARY_SPECFILE}.in")
   ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE)
 ENDIF(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE)
 
 # After that we may either use a user provided spec file
-# or generate one using appropriate variables value.  
+# or generate one using appropriate variables value.
 IF(CPACK_RPM_USER_BINARY_SPECFILE)
   # User may have specified SPECFILE just use it
   MESSAGE("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}")
   # The user provided file is processed for @var replacement
   CONFIGURE_FILE(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
 ELSE(CPACK_RPM_USER_BINARY_SPECFILE)
-  # No User specified spec file, will use the generated spec file    
-  MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")      
-  # Note the just created file is processed for @var replacement  
+  # No User specified spec file, will use the generated spec file
+  MESSAGE("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}")
+  # Note the just created file is processed for @var replacement
   CONFIGURE_FILE(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY)
 ENDIF(CPACK_RPM_USER_BINARY_SPECFILE)
 
 IF(RPMBUILD_EXECUTABLE)
   # Now call rpmbuild using the SPECFILE
   EXECUTE_PROCESS(
-    COMMAND "${RPMBUILD_EXECUTABLE}" -bb 
-            --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" 
+    COMMAND "${RPMBUILD_EXECUTABLE}" -bb
+            --buildroot "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
             "${CPACK_RPM_BINARY_SPECFILE}"
     WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}"
     ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err"
-    OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")  
+    OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.out")
   IF(CPACK_RPM_PACKAGE_DEBUG)
     MESSAGE("CPackRPM:Debug: You may consult rpmbuild logs in: ")
     MESSAGE("CPackRPM:Debug:    - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild.err")

+ 0 - 6
Modules/FindMPI.cmake

@@ -332,12 +332,6 @@ else (MPI_COMPILE_CMDLINE)
   set(MPI_LINK_FLAGS "" CACHE STRING "MPI linking flags")
 endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
 
-# on BlueGene/L the MPI lib is named libmpich.rts.a, there also these additional libs are required
-if("${MPI_LIBRARY}" MATCHES "mpich.rts")
-   set(MPI_EXTRA_LIBRARY ${MPI_EXTRA_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
-   set(MPI_LIBRARY ${MPI_LIBRARY}  msglayer.rts devices.rts rts.rts devices.rts)
-endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
-
 # Set up extra variables to conform to
 if (MPI_EXTRA_LIBRARY)
   set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})

+ 1 - 1
Modules/FindZLIB.cmake

@@ -38,7 +38,7 @@ MARK_AS_ADVANCED(ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
 
 IF (ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h")
     FILE(READ "${ZLIB_INCLUDE_DIR}/zlib.h" ZLIB_H)
-    STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+)\".*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}")
+    STRING(REGEX REPLACE ".*#define ZLIB_VERSION \"([0-9]+)\\.([0-9]+)\\.([0-9]+).*" "\\1.\\2.\\3" ZLIB_VERSION_STRING "${ZLIB_H}")
 ENDIF()
 
 # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if 

+ 12 - 1
Modules/GetPrerequisites.cmake

@@ -526,6 +526,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   if("${gp_tool}" STREQUAL "ldd")
     set(gp_cmd_args "")
     set(gp_regex "^[\t ]*[^\t ]+ => ([^\t ]+).*${eol_char}$")
+    set(gp_regex_error "not found${eol_char}$")
+    set(gp_regex_fallback "^[\t ]*([^\t ]+) => ([^\t ]+).*${eol_char}$")
     set(gp_regex_cmp_count 1)
     set(gp_tool_known 1)
   endif("${gp_tool}" STREQUAL "ldd")
@@ -533,6 +535,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   if("${gp_tool}" STREQUAL "otool")
     set(gp_cmd_args "-L")
     set(gp_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
+    set(gp_regex_error "")
+    set(gp_regex_fallback "")
     set(gp_regex_cmp_count 3)
     set(gp_tool_known 1)
   endif("${gp_tool}" STREQUAL "otool")
@@ -540,6 +544,8 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   if("${gp_tool}" STREQUAL "dumpbin")
     set(gp_cmd_args "/dependents")
     set(gp_regex "^    ([^ ].*[Dd][Ll][Ll])${eol_char}$")
+    set(gp_regex_error "")
+    set(gp_regex_fallback "")
     set(gp_regex_cmp_count 1)
     set(gp_tool_known 1)
     set(ENV{VS_UNICODE_OUTPUT} "") # Block extra output from inside VS IDE.
@@ -629,8 +635,13 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa
   #
   foreach(candidate ${candidates})
   if("${candidate}" MATCHES "${gp_regex}")
+
     # Extract information from each candidate:
-    string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+    if(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+      string(REGEX REPLACE "${gp_regex_fallback}" "\\1" raw_item "${candidate}")
+    else(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
+      string(REGEX REPLACE "${gp_regex}" "\\1" raw_item "${candidate}")
+    endif(gp_regex_error AND "${candidate}" MATCHES "${gp_regex_error}")
 
     if(gp_regex_cmp_count GREATER 1)
       string(REGEX REPLACE "${gp_regex}" "\\2" raw_compat_version "${candidate}")

+ 24 - 82
Modules/Qt4ConfigDependentSettings.cmake

@@ -71,11 +71,8 @@ SET (QT_QTOPENGL_LIB_DEPENDENCIES ${OPENGL_glu_LIBRARY} ${OPENGL_gl_LIBRARY})
 
 ## system png
 IF(QT_QCONFIG MATCHES "system-png")
-  FIND_LIBRARY(QT_PNG_LIBRARY NAMES png)
-  MARK_AS_ADVANCED(QT_PNG_LIBRARY)
-  IF(QT_PNG_LIBRARY)
-    SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_PNG_LIBRARY})
-  ENDIF(QT_PNG_LIBRARY)
+  find_package(PNG)
+  SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${PNG_LIBRARY})
 ENDIF(QT_QCONFIG MATCHES "system-png")
 
 
@@ -141,16 +138,6 @@ IF(QT_QCONFIG MATCHES "xfixes")
 ENDIF(QT_QCONFIG MATCHES "xfixes")
 
 
-## system-freetype
-IF(QT_QCONFIG MATCHES "system-freetype")
-  FIND_LIBRARY(QT_FREETYPE_LIBRARY NAMES freetype)
-  MARK_AS_ADVANCED(QT_FREETYPE_LIBRARY)
-  IF(QT_FREETYPE_LIBRARY)
-    SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${QT_FREETYPE_LIBRARY})
-  ENDIF(QT_FREETYPE_LIBRARY)
-ENDIF(QT_QCONFIG MATCHES "system-freetype")
-
-
 ## fontconfig
 IF(QT_QCONFIG MATCHES "fontconfig")
   FIND_LIBRARY(QT_FONTCONFIG_LIBRARY NAMES fontconfig)
@@ -161,13 +148,19 @@ IF(QT_QCONFIG MATCHES "fontconfig")
 ENDIF(QT_QCONFIG MATCHES "fontconfig")
 
 
+## system-freetype
+IF(QT_QCONFIG MATCHES "system-freetype")
+  find_package(Freetype)
+  if(FREETYPE_LIBRARIES)
+    SET(QT_QTGUI_LIB_DEPENDENCIES ${QT_QTGUI_LIB_DEPENDENCIES} ${FREETYPE_LIBRARIES})
+  endif(FREETYPE_LIBRARIES)
+ENDIF(QT_QCONFIG MATCHES "system-freetype")
+
+
 ## system-zlib
 IF(QT_QCONFIG MATCHES "system-zlib")
-  FIND_LIBRARY(QT_ZLIB_LIBRARY NAMES z)
-  MARK_AS_ADVANCED(QT_ZLIB_LIBRARY)
-  IF(QT_ZLIB_LIBRARY)
-    SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${QT_ZLIB_LIBRARY})
-  ENDIF(QT_ZLIB_LIBRARY)
+  find_package(ZLIB)
+  SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES} ${ZLIB_LIBRARIES})
 ENDIF(QT_QCONFIG MATCHES "system-zlib")
 
 
@@ -192,29 +185,11 @@ ENDIF(NOT Q_WS_WIN)
 ## dbus
 IF(QT_QCONFIG MATCHES "dbus")
 
-  # if the dbus library isn't found, we'll assume its not required to build
-  # shared Qt on Linux doesn't require it
-  IF(NOT QT_DBUS_LIBRARY)
-    EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L dbus-1
-      OUTPUT_VARIABLE _dbus_query_output
-      RESULT_VARIABLE _dbus_result
-      ERROR_VARIABLE _dbus_query_output )
-
-    IF(_dbus_result MATCHES 0)
-      STRING(REPLACE "-L" "" _dbus_query_output "${_dbus_query_output}")
-      SEPARATE_ARGUMENTS(_dbus_query_output)
-    ELSE(_dbus_result MATCHES 0)
-      SET(_dbus_query_output)
-    ENDIF(_dbus_result MATCHES 0)
-
-    FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 PATHS ${_dbus_query_output} )
-
-    IF(QT_DBUS_LIBRARY)
-      SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY})
-    ENDIF(QT_DBUS_LIBRARY)
-
-    MARK_AS_ADVANCED(QT_DBUS_LIBRARY)
-  ENDIF(NOT QT_DBUS_LIBRARY)
+  FIND_LIBRARY(QT_DBUS_LIBRARY NAMES dbus-1 )
+  IF(QT_DBUS_LIBRARY)
+    SET(QT_QTDBUS_LIB_DEPENDENCIES ${QT_QTDBUS_LIB_DEPENDENCIES} ${QT_DBUS_LIBRARY})
+  ENDIF(QT_DBUS_LIBRARY)
+  MARK_AS_ADVANCED(QT_DBUS_LIBRARY)
 
 ENDIF(QT_QCONFIG MATCHES "dbus")
 
@@ -222,29 +197,11 @@ ENDIF(QT_QCONFIG MATCHES "dbus")
 ## glib
 IF(QT_QCONFIG MATCHES "glib")
 
-  # if the glib libraries aren't found, we'll assume its not required to build
-  # shared Qt on Linux doesn't require it
-
   # Qt 4.2.0+ uses glib-2.0
-  IF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY)
-    EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L glib-2.0 gthread-2.0
-      OUTPUT_VARIABLE _glib_query_output
-      RESULT_VARIABLE _glib_result
-      ERROR_VARIABLE _glib_query_output )
-
-    IF(_glib_result MATCHES 0)
-      STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}")
-      SEPARATE_ARGUMENTS(_glib_query_output)
-    ELSE(_glib_result MATCHES 0)
-      SET(_glib_query_output)
-    ENDIF(_glib_result MATCHES 0)
-
-    FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 PATHS ${_glib_query_output} )
-    FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 PATHS ${_glib_query_output} )
-
-    MARK_AS_ADVANCED(QT_GLIB_LIBRARY)
-    MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY)
-  ENDIF(NOT QT_GLIB_LIBRARY OR NOT QT_GTHREAD_LIBRARY)
+  FIND_LIBRARY(QT_GLIB_LIBRARY NAMES glib-2.0 )
+  FIND_LIBRARY(QT_GTHREAD_LIBRARY NAMES gthread-2.0 )
+  MARK_AS_ADVANCED(QT_GLIB_LIBRARY)
+  MARK_AS_ADVANCED(QT_GTHREAD_LIBRARY)
 
   IF(QT_GLIB_LIBRARY AND QT_GTHREAD_LIBRARY)
     SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES}
@@ -254,23 +211,8 @@ IF(QT_QCONFIG MATCHES "glib")
 
   # Qt 4.5+ also links to gobject-2.0
   IF(QT_VERSION_MINOR GREATER 4)
-     IF(NOT QT_GOBJECT_LIBRARY)
-       EXECUTE_PROCESS(COMMAND pkg-config --libs-only-L gobject-2.0
-         OUTPUT_VARIABLE _glib_query_output
-         RESULT_VARIABLE _glib_result
-         ERROR_VARIABLE _glib_query_output )
-
-       IF(_glib_result MATCHES 0)
-         STRING(REPLACE "-L" "" _glib_query_output "${_glib_query_output}")
-         SEPARATE_ARGUMENTS(_glib_query_output)
-       ELSE(_glib_result MATCHES 0)
-         SET(_glib_query_output)
-       ENDIF(_glib_result MATCHES 0)
-
-       FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} )
-
-       MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY)
-     ENDIF(NOT QT_GOBJECT_LIBRARY)
+     FIND_LIBRARY(QT_GOBJECT_LIBRARY NAMES gobject-2.0 PATHS ${_glib_query_output} )
+     MARK_AS_ADVANCED(QT_GOBJECT_LIBRARY)
 
      IF(QT_GOBJECT_LIBRARY)
        SET(QT_QTCORE_LIB_DEPENDENCIES ${QT_QTCORE_LIB_DEPENDENCIES}

+ 3 - 3
Source/CPack/cmCPackDebGenerator.cxx

@@ -135,7 +135,7 @@ int cmCPackDebGenerator::CompressFiles(const char* outFileName,
   // now add all directories which have to be compressed
   // collect all top level install dirs for that
   // e.g. /opt/bin/foo, /usr/bin/bar and /usr/bin/baz would give /usr and /opt
-  int topLevelLength = strlen(toplevel);
+  size_t topLevelLength = strlen(toplevel);
   std::set<std::string> installDirs;
   for (std::vector<std::string>::const_iterator fileIt = files.begin(); 
        fileIt != files.end(); ++ fileIt )
@@ -431,7 +431,7 @@ static int put_arobj(CF *cfp, struct stat *sb)
 
  /* If not truncating names and the name is too long or contains
   * a space, use extended format 1.   */
-  unsigned int lname = strlen(name);
+  size_t lname = strlen(name);
   uid_t uid = sb->st_uid;
   gid_t gid = sb->st_gid;
   if (uid > USHRT_MAX) {
@@ -441,7 +441,7 @@ static int put_arobj(CF *cfp, struct stat *sb)
     gid = USHRT_MAX;
     }
   if (lname > sizeof(hdr->ar_name) || strchr(name, ' '))
-    (void)sprintf(ar_hb, HDR1, AR_EFMT1, lname,
+    (void)sprintf(ar_hb, HDR1, AR_EFMT1, (int)lname,
                   (long int)sb->st_mtime, uid, gid, sb->st_mode,
                   (long long)sb->st_size + lname, ARFMAG);
     else {

+ 1 - 1
Source/CPack/cmCPackNSISGenerator.cxx

@@ -758,7 +758,7 @@ CreateComponentDescription(cmCPackComponent *component,
     }
     
     // Create the NSIS code to download this file on-the-fly.
-    unsigned totalSizeInKbytes = (totalSize + 512) / 1024;
+    unsigned long totalSizeInKbytes = (totalSize + 512) / 1024;
     if (totalSizeInKbytes == 0)
       {
       totalSizeInKbytes = 1;

+ 2 - 2
Source/CTest/cmCTestBuildHandler.cxx

@@ -959,7 +959,7 @@ int cmCTestBuildHandler::RunMakeCommand(const char* command,
   this->ProcessBuffer(0, 0, tick, tick_len, ofs,
     &this->BuildProcessingErrorQueue);
   cmCTestLog(this->CTest, OUTPUT, " Size of output: "
-    << int(this->BuildOutputLogSize / 1024.0) << "K" << std::endl);
+    << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl);
 
   // Properly handle output of the build command
   cmsysProcess_WaitForExit(cp, 0);
@@ -1171,7 +1171,7 @@ void cmCTestBuildHandler::ProcessBuffer(const char* data, int length,
     if ( tick % tick_line_len == 0 && tick > 0 )
       {
       cmCTestLog(this->CTest, HANDLER_OUTPUT, "  Size: "
-        << int((this->BuildOutputLogSize / 1024.0) + 1) << "K" << std::endl
+        << ((this->BuildOutputLogSize + 512) / 1024) << "K" << std::endl
         << "    ");
       }
     }

+ 3 - 2
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -484,8 +484,9 @@ void cmCTestMultiProcessHandler::CreateTestCostList()
       }
     else //we ignore their cost
       {
-      this->TestCosts[this->Tests.size()
-        - this->Properties[i->first]->Index].insert(i->first);
+      size_t index = this->Tests.size()
+        - static_cast<size_t>(this->Properties[i->first]->Index);
+      this->TestCosts[index].insert(i->first);
       }
     }
 }

+ 7 - 5
Source/CTest/cmCTestRunTest.cxx

@@ -83,7 +83,8 @@ void cmCTestRunTest::CompressOutput()
     reinterpret_cast<unsigned char*>(
     const_cast<char*>(this->ProcessOutput.c_str()));
   //zlib makes the guarantee that this is the maximum output size
-  int outSize = static_cast<int>(this->ProcessOutput.size() * 1.001 + 13);
+  int outSize = static_cast<int>(
+    static_cast<double>(this->ProcessOutput.size()) * 1.001 + 13.0);
   unsigned char* out = new unsigned char[outSize];
 
   strm.zalloc = Z_NULL;
@@ -342,13 +343,14 @@ bool cmCTestRunTest::EndTest(size_t completed, size_t total, bool started)
 //----------------------------------------------------------------------
 void cmCTestRunTest::ComputeWeightedCost()
 {
-  int prev = this->TestProperties->PreviousRuns;
-  float avgcost = this->TestProperties->Cost;
+  double prev = static_cast<double>(this->TestProperties->PreviousRuns);
+  double avgcost = static_cast<double>(this->TestProperties->Cost);
   double current = this->TestResult.ExecutionTime;
 
   if(this->TestResult.Status == cmCTestTestHandler::COMPLETED)
     {
-    this->TestProperties->Cost = ((prev * avgcost) + current) / (prev + 1);
+    this->TestProperties->Cost =
+      static_cast<float>(((prev * avgcost) + current) / (prev + 1.0));
     this->TestProperties->PreviousRuns++;
     }
 }
@@ -569,7 +571,7 @@ double cmCTestRunTest::ResolveTimeout()
     {
     stop_time += 24*60*60;
     }
-  int stop_timeout = (stop_time - current_time) % (24*60*60);
+  int stop_timeout = static_cast<int>(stop_time - current_time) % (24*60*60);
   this->CTest->LastStopTimeout = stop_timeout;
 
   if(stop_timeout <= 0 || stop_timeout > this->CTest->LastStopTimeout)

+ 5 - 3
Source/CTest/cmCTestTestHandler.cxx

@@ -1048,7 +1048,7 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed,
 
     if(randomSchedule)
       {
-      p.Cost = rand();
+      p.Cost = static_cast<float>(rand());
       }
 
     if(p.Timeout == 0 && this->CTest->GetGlobalTimeout() != 0)
@@ -1309,7 +1309,8 @@ std::string cmCTestTestHandler::EncodeFile(std::string file)
   cmSystemTools::RemoveFile(tarFile.c_str());
 
   unsigned char *encoded_buffer
-    = new unsigned char [ static_cast<int>(len * 1.5 + 5) ];
+    = new unsigned char [ static_cast<int>(
+        static_cast<double>(len) * 1.5 + 5.0) ];
 
   unsigned long rlen
     = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);
@@ -1881,7 +1882,8 @@ std::string cmCTestTestHandler::GenerateRegressionImages(
           unsigned char *file_buffer = new unsigned char [ len + 1 ];
           ifs.read(reinterpret_cast<char*>(file_buffer), len);
           unsigned char *encoded_buffer
-            = new unsigned char [ static_cast<int>(len * 1.5 + 5) ];
+            = new unsigned char [ static_cast<int>(
+                static_cast<double>(len) * 1.5 + 5.0) ];
 
           unsigned long rlen
             = cmsysBase64_Encode(file_buffer, len, encoded_buffer, 1);

+ 3 - 10
Source/cmVisualStudioGeneratorOptions.cxx

@@ -183,7 +183,7 @@ cmVisualStudioGeneratorOptions
     {
     fout << prefix <<  "PreprocessorDefinitions=\"";
     }
-  const char* comma = "";
+  const char* sep = "";
   for(std::vector<std::string>::const_iterator di = this->Defines.begin();
       di != this->Defines.end(); ++di)
     {
@@ -208,15 +208,8 @@ cmVisualStudioGeneratorOptions
       define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str());
       }
     // Store the flag in the project file.
-    fout << comma << define;
-    if(this->Version == 10)
-      {
-      comma = ";";
-      }
-    else
-      {
-      comma = ",";
-      }
+    fout << sep << define;
+    sep = ";";
     }
   if(this->Version == 10)
     {

+ 24 - 15
Source/kwsys/CMakeLists.txt

@@ -141,12 +141,6 @@ IF(COMMAND SET_PROPERTY)
     "KWSYS_HEADER(%)=<${KWSYS_NAMESPACE}/%>"
     )
 ENDIF(COMMAND SET_PROPERTY)
-# add option to disable memory cleanup at exit of putenv memory
-IF(DEFINED KWSYS_DO_NOT_CLEAN_PUTENV)
-  SET(KWSYS_DO_NOT_CLEAN_PUTENV 1)
-ELSE(DEFINED KWSYS_DO_NOT_CLEAN_PUTENV)
-  SET(KWSYS_DO_NOT_CLEAN_PUTENV 0)
-ENDIF(DEFINED KWSYS_DO_NOT_CLEAN_PUTENV)
 
 # Select library components.
 IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
@@ -604,6 +598,23 @@ ELSE(KWSYS_BUILD_SHARED)
   SET(KWSYS_LIBRARY_TYPE STATIC)
 ENDIF(KWSYS_BUILD_SHARED)
 
+#-----------------------------------------------------------------------------
+# Configure some implementation details.
+
+KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_PTRDIFF_T
+  "Checking whether C compiler has ptrdiff_t in stddef.h" DIRECT)
+KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_SSIZE_T
+  "Checking whether C compiler has ssize_t in unistd.h" DIRECT)
+SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c System.c PROPERTIES
+  COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}"
+  )
+
+IF(KWSYS_DO_NOT_CLEAN_PUTENV)
+  # Disable cleanup of putenv memory for issues with GCOV.
+  SET_SOURCE_FILES_PROPERTIES(SystemTools.cxx PROPERTIES
+    COMPILE_FLAGS -DKWSYS_DO_NOT_CLEAN_PUTENV=1)
+ENDIF(KWSYS_DO_NOT_CLEAN_PUTENV)
+
 #-----------------------------------------------------------------------------
 # Choose a directory for the generated headers.
 IF(NOT KWSYS_HEADER_ROOT)
@@ -782,15 +793,6 @@ IF(KWSYS_USE_Process)
   ELSE(NOT UNIX)
     # Use the UNIX implementation.
     SET(KWSYS_C_SRCS ${KWSYS_C_SRCS} ProcessUNIX.c)
-
-    # Help ProcessUNIX.c compile properly on all platforms.
-    KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_PTRDIFF_T
-      "Checking whether C compiler has ptrdiff_t in stddef.h" DIRECT)
-    KWSYS_PLATFORM_C_TEST(KWSYS_C_HAS_SSIZE_T
-      "Checking whether C compiler has ssize_t in unistd.h" DIRECT)
-    SET_SOURCE_FILES_PROPERTIES(ProcessUNIX.c PROPERTIES
-      COMPILE_FLAGS "-DKWSYS_C_HAS_PTRDIFF_T=${KWSYS_C_HAS_PTRDIFF_T} -DKWSYS_C_HAS_SSIZE_T=${KWSYS_C_HAS_SSIZE_T}"
-      )
   ENDIF(NOT UNIX)
 ENDIF(KWSYS_USE_Process)
 
@@ -1095,6 +1097,7 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
     FOREACH(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7})
       ADD_TEST(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n})
       KWSYS_SET_PROPERTY(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST})
+      SET_TESTS_PROPERTIES(kwsys.testProcess-${n} PROPERTIES TIMEOUT 120)
     ENDFOREACH(n)
 
     # Some Apple compilers produce bad optimizations in this source.
@@ -1122,5 +1125,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
       SET_TESTS_PROPERTIES(kwsys.testFail PROPERTIES MEASUREMENT "Some Key=Some Value")
       MESSAGE(STATUS "GET_TEST_PROPERTY returned: ${wfv}")
     ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY AND KWSYS_STANDALONE)
+
+    # Suppress known consistent failures on buggy systems.
+    IF(KWSYS_TEST_BOGUS_FAILURES)
+      SET_TESTS_PROPERTIES(${KWSYS_TEST_BOGUS_FAILURES} PROPERTIES WILL_FAIL ON)
+    ENDIF()
+
   ENDIF(BUILD_TESTING)
 ENDIF(KWSYS_STANDALONE OR CMake_SOURCE_DIR)

+ 0 - 9
Source/kwsys/Configure.hxx.in

@@ -15,15 +15,6 @@
 /* Include C configuration.  */
 #include <@KWSYS_NAMESPACE@/Configure.h>
 
-/* Disable cleanup of putenv memory for issues with GCOV */
-#if @KWSYS_DO_NOT_CLEAN_PUTENV@
-#define KWSYS_DO_NOT_CLEAN_PUTENV 
-#else
-#undef KWSYS_DO_NOT_CLEAN_PUTENV
-#endif
-
-
-
 /* Whether ANSI C++ stream headers are to be used.  */
 #define @KWSYS_NAMESPACE@_IOS_USE_ANSI @KWSYS_IOS_USE_ANSI@
 

+ 2 - 2
Source/kwsys/kwsysDateStamp.cmake

@@ -15,7 +15,7 @@
 SET(KWSYS_DATE_STAMP_YEAR  2010)
 
 # KWSys version date month component.  Format is MM.
-SET(KWSYS_DATE_STAMP_MONTH 06)
+SET(KWSYS_DATE_STAMP_MONTH 07)
 
 # KWSys version date day component.  Format is DD.
-SET(KWSYS_DATE_STAMP_DAY   28)
+SET(KWSYS_DATE_STAMP_DAY   04)

+ 5 - 0
Source/kwsys/testProcess.c

@@ -94,7 +94,12 @@ int test4(int argc, const char* argv[])
   fprintf(stderr, "Output before crash on stderr from crash test.\n");  
   fflush(stdout);
   fflush(stderr);
+#if defined(__APPLE__) && defined(__x86_64__) && defined(__OPTIMIZE__) \
+ && defined(__clang__)
+  *(int*)1 = 0; /* Clang's optimizer produces bad code for 0-ptr.  */
+#else
   *(int*)0 = 0;
+#endif
   fprintf(stdout, "Output after crash on stdout from crash test.\n");
   fprintf(stderr, "Output after crash on stderr from crash test.\n");
   return 0;

+ 57 - 6
Tests/CMakeTests/CheckSourceTreeTest.cmake.in

@@ -149,26 +149,77 @@ if(is_git_checkout AND NOT GIT_EXECUTABLE)
   # from it:
   #
   if(ctest_ini_file)
-    file(STRINGS "${ctest_ini_file}" lines REGEX "^GITCommand: (.*)$")
-    string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" exe "${lines}")
+    file(STRINGS "${ctest_ini_file}" line REGEX "^GITCommand: (.*)$")
+    string(REGEX REPLACE "^GITCommand: (.*)$" "\\1" line "${line}")
+    if("${line}" MATCHES "^\"")
+      string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+    else()
+      string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+    endif()
+    set(exe "${line}")
     if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
       set(exe "")
     endif()
+    if(exe)
+      message("info: GIT_EXECUTABLE set by 'GITCommand:' from '${ctest_ini_file}'")
+    endif()
 
     if(NOT exe)
-      file(STRINGS "${ctest_ini_file}" lines REGEX "^UpdateCommand: (.*)$")
-      string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" exe "${lines}")
+      file(STRINGS "${ctest_ini_file}" line REGEX "^UpdateCommand: (.*)$")
+      string(REGEX REPLACE "^UpdateCommand: (.*)$" "\\1" line "${line}")
+      if("${line}" MATCHES "^\"")
+        string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+      else()
+        string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+      endif()
+      set(exe "${line}")
       if("${exe}" STREQUAL "GITCOMMAND-NOTFOUND")
         set(exe "")
       endif()
+      if(exe)
+        message("info: GIT_EXECUTABLE set by 'UpdateCommand:' from '${ctest_ini_file}'")
+      endif()
+    endif()
+  else()
+    message("info: no DartConfiguration.tcl or CTestConfiguration.ini file...")
+  endif()
+
+  # If we have still not grokked the exe, look in the Update.xml file to see
+  # if we can parse it from there...
+  #
+  if(NOT exe)
+    file(GLOB_RECURSE update_xml_file "${CMake_BINARY_DIR}/Testing/Update.xml")
+    if(update_xml_file)
+      file(STRINGS "${update_xml_file}" line
+        REGEX "^.*<UpdateCommand>(.*)</UpdateCommand>$" LIMIT_COUNT 1)
+      string(REPLACE "&quot\;" "\"" line "${line}")
+      string(REGEX REPLACE "^.*<UpdateCommand>(.*)</UpdateCommand>$" "\\1" line "${line}")
+      if("${line}" MATCHES "^\"")
+        string(REGEX REPLACE "^\"([^\"]+)\" *.*$" "\\1" line "${line}")
+      else()
+        string(REGEX REPLACE "^([^ ]+) *.*$" "\\1" line "${line}")
+      endif()
+      if(line)
+        set(exe "${line}")
+      endif()
+      if(exe)
+        message("info: GIT_EXECUTABLE set by '<UpdateCommand>' from '${update_xml_file}'")
+      endif()
+    else()
+      message("info: no Update.xml file...")
     endif()
   endif()
 
   if(exe)
     set(GIT_EXECUTABLE "${exe}")
-    message("info: set GIT_EXECUTABLE to '${GIT_EXECUTABLE}' based on '${ctest_ini_file}'")
+    message("GIT_EXECUTABLE='${GIT_EXECUTABLE}'")
+    message("")
+
+    if(NOT EXISTS "${GIT_EXECUTABLE}")
+      message(FATAL_ERROR "GIT_EXECUTABLE does not exist...")
+    endif()
   else()
-    message(FATAL_ERROR "could not determine GIT_EXECUTABLE based on '${ctest_ini_file}'...")
+    message(FATAL_ERROR "could not determine GIT_EXECUTABLE...")
   endif()
 endif()
 

+ 1 - 1
Utilities/cmcompress/cmcompress.c

@@ -454,7 +454,7 @@ int cmcompress_compress(struct cmcompress_stream* cdata, void* buff, size_t n)
       {
       goto nomatch;
       }
-    disp = cdata->hsize_reg - i;    /* secondary hash (after G. Knott) */
+    disp = (int)(cdata->hsize_reg - i);    /* secondary hash (after G. Knott) */
     if ( i == 0 )
       {
       disp = 1;