Browse Source

CMake 2.8.0-rc5

Brad King 16 years ago
parent
commit
86eac830b3

+ 1 - 1
CMakeLists.txt

@@ -316,7 +316,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
 SET(CMake_VERSION_MAJOR 2)
 SET(CMake_VERSION_MINOR 8)
 SET(CMake_VERSION_PATCH 0)
-SET(CMake_VERSION_RC 4)
+SET(CMake_VERSION_RC 5)
 
 # We use odd minor numbers for development versions.
 # Use a date for the development patch level.

+ 19 - 0
ChangeLog.manual

@@ -1,3 +1,22 @@
+Changes in CMake 2.8.0 RC 5
+- CTest now detects cycles in test dependency graph
+- Warn on set(PARENT_SCOPE) at top scope
+- Fix Xcode <= 2.0 projects with CMAKE_BUILD_TYPE
+- Fix flags for Intel Fortran on Windows
+- Fix #2199: UseSWIG documentation for swig_generated_file_fullname
+- Fix #7915: UseSWIG interaction with JNI
+- Fix #8971: FindOpenSSL now works on windows
+- Fix #9124: CPackDeb documentation
+- Fix #9722: cmake-gui reports error when not able to create build directory
+- Fix #9767: Match more valgrind-reported leaks in CTest memcheck
+- Fix #9777: Sync CMakeDetermineJavaCompiler paths with FindJava
+- Fix #9793: FindJNI should find matching jni.h and jni_md.h
+- Fix #9817: FindJNI on Solaris
+- Fix FindHDF5 when hdf5.h exists without H5pubconf.h
+- Fix FindZLIB to follow variable name conventions
+- Fix invalid use of auto_ptr on array
+- Mention temp var convention in Modules/readme.txt documentation
+
 Changes in CMake 2.8.0 RC 4
 - Fix try_compile when file cannot be found
 - Add new module to test manifest installation issues on windows.

+ 4 - 0
Modules/CMakeDetermineJavaCompiler.cmake

@@ -51,14 +51,18 @@ IF(NOT CMAKE_Java_COMPILER)
     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin"
     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin"
     "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
+    $ENV{JAVA_HOME}/bin
     /usr/bin
     /usr/lib/java/bin
     /usr/share/java/bin
     /usr/local/bin
     /usr/local/java/bin
+    /usr/local/java/share/bin
     /usr/java/j2sdk1.4.2_04
     /usr/lib/j2sdk1.4-sun/bin
+    /usr/java/j2sdk1.4.2_09/bin
     /usr/lib/j2sdk1.5-sun/bin
+    /opt/sun-jdk-1.5.0.04/bin
     )
   # if no compiler has been specified yet, then look for one
   IF(CMAKE_Java_COMPILER_INIT)

+ 44 - 0
Modules/CPackDeb.cmake

@@ -1,6 +1,50 @@
+# - The builtin (binary) CPack Deb generator (Unix only)
+# CPackDeb may be used to create Deb package using CPack.
+# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables
+# 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: 
+#  http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29
+# However as a handy reminder here comes the list of specific variables:
+#
+#  CPACK_DEBIAN_PACKAGE_NAME
+#     Mandatory : YES
+#     Default   : CPACK_PACKAGE_NAME (lower case)
+#     The debian package summary
+# CPACK_DEBIAN_PACKAGE_VERSION
+#     Mandatory : YES
+#     Default   : CPACK_PACKAGE_VERSION
+#     The debian package version
+# CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
+#     Mandatory : YES
+#     Default   : Output of dpkg --print-architecture or i386
+#     The debian package architecture
+# CPACK_DEBIAN_PACKAGE_DEPENDS
+#     Mandatory : NO
+#     Default   : -
+#     May be used to set deb dependencies. 
+# CPACK_DEBIAN_PACKAGE_MAINTAINER
+#     Mandatory : YES
+#     Default   : CPACK_PACKAGE_CONTACT
+#     The debian package maintainer
+# CPACK_DEBIAN_PACKAGE_DESCRIPTION
+#     Mandatory : YES
+#     Default   : CPACK_PACKAGE_DESCRIPTION_SUMMARY
+#     The debian package description
+# CPACK_DEBIAN_PACKAGE_SECTION
+#     Mandatory : YES
+#     Default   : 'devel'
+#     The debian package section
+# CPACK_DEBIAN_PACKAGE_PRIORITY
+#     Mandatory : YES
+#     Default   : 'optional'
+#     The debian package priority
 
 #=============================================================================
 # Copyright 2007-2009 Kitware, Inc.
+# Copyright 2007-2009 Mathieu Malaterre <[email protected]>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.

+ 8 - 7
Modules/FindHDF5.cmake

@@ -291,14 +291,15 @@ else()
 
     # If the HDF5 include directory was found, open H5pubconf.h to determine if
     # HDF5 was compiled with parallel IO support
+    set( HDF5_IS_PARALLEL FALSE )
     if( HDF5_INCLUDE_DIR )
-        file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" 
-            HDF5_HAVE_PARALLEL_DEFINE
-            REGEX "HAVE_PARALLEL 1" )
-        if( HDF5_HAVE_PARALLEL_DEFINE )
-            set( HDF5_IS_PARALLEL TRUE )
-        else()
-            set( HDF5_IS_PARALLEL FALSE )
+        if( EXISTS "${HDF5_INCLUDE_DIR}/h5pubconf.h" )
+            file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" 
+                HDF5_HAVE_PARALLEL_DEFINE
+                REGEX "HAVE_PARALLEL 1" )
+            if( HDF5_HAVE_PARALLEL_DEFINE )
+                set( HDF5_IS_PARALLEL TRUE )
+            endif()
         endif()
     endif()
     set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL

+ 2 - 2
Modules/FindJNI.cmake

@@ -195,14 +195,14 @@ FIND_PATH(JAVA_INCLUDE_PATH jni.h
 )
 
 FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h 
-  ${JAVA_AWT_INCLUDE_DIRECTORIES}
+  ${JAVA_INCLUDE_PATH}
   ${JAVA_INCLUDE_PATH}/win32
   ${JAVA_INCLUDE_PATH}/linux
   ${JAVA_INCLUDE_PATH}/freebsd
+  ${JAVA_INCLUDE_PATH}/solaris
 )
 
 FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h
-  ${JAVA_AWT_INCLUDE_DIRECTORIES}
   ${JAVA_INCLUDE_PATH}
 )
 

+ 26 - 7
Modules/FindOpenSSL.cmake

@@ -8,6 +8,7 @@
 #=============================================================================
 # Copyright 2006-2009 Kitware, Inc.
 # Copyright 2006 Alexander Neundorf <[email protected]>
+# Copyright 2009 Mathieu Malaterre <[email protected]>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -27,19 +28,32 @@ IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
    SET(LIB_FOUND 1)
 ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
 
-FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h )
+# http://www.slproweb.com/products/Win32OpenSSL.html
+FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h
+  PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/include"
+)
 
 IF(WIN32 AND MSVC)
    # /MD and /MDd are the standard values - if somone wants to use
    # others, the libnames have to change here too
    # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
 
-   FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32)
-   FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32)
+   FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32
+     PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+     )
+   FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32
+     PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+     )
+   FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32
+     PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+     )
+   FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32
+     PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+     )
 
    IF(MSVC_IDE)
       IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
-         SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG})
+         SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG})
       ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
          SET(OPENSSL_LIBRARIES NOTFOUND)
          MESSAGE(STATUS "Could not find the debug and release version of openssl")
@@ -47,15 +61,20 @@ IF(WIN32 AND MSVC)
    ELSE(MSVC_IDE)
       STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
       IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-         SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG})
+         SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG})
       ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-         SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE})
+         SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE})
       ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
    ENDIF(MSVC_IDE)
    MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
+   MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
 ELSE(WIN32 AND MSVC)
 
-   FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD )
+   FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD)
+   FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto)
+   MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES)
+
+   SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
 
 ENDIF(WIN32 AND MSVC)
 

+ 9 - 11
Modules/FindZLIB.cmake

@@ -1,9 +1,9 @@
 # - Find zlib
 # Find the native ZLIB includes and library
 #
-#  ZLIB_INCLUDE_DIR - where to find zlib.h, etc.
-#  ZLIB_LIBRARIES   - List of libraries when using zlib.
-#  ZLIB_FOUND       - True if zlib found.
+#  ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
+#  ZLIB_LIBRARIES    - List of libraries when using zlib.
+#  ZLIB_FOUND        - True if zlib found.
 
 #=============================================================================
 # Copyright 2001-2009 Kitware, Inc.
@@ -27,16 +27,14 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
 
 SET(ZLIB_NAMES z zlib zdll)
 FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} )
+MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )
+
+# Per-recommendation
+SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}")
+SET(ZLIB_LIBRARIES    "${ZLIB_LIBRARY}")
 
 # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if 
 # all listed variables are TRUE
 INCLUDE(FindPackageHandleStandardArgs)
-FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS)
 
-IF(ZLIB_FOUND)
-  SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} )
-ELSE(ZLIB_FOUND)
-  SET( ZLIB_LIBRARIES )
-ENDIF(ZLIB_FOUND)
-
-MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR )

+ 3 - 3
Modules/Platform/Windows-ifort.cmake

@@ -53,10 +53,10 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu
 # does the compiler support pdbtype and is it the newer compiler
 
 SET(CMAKE_BUILD_TYPE_INIT Debug)
-SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp")
-SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full")
+SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
+SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs")
 SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG")
-SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/MD /O1 /D NDEBUG")
+SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG")
 SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG")
 
 SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")

+ 38 - 3
Modules/UseSWIG.cmake

@@ -6,7 +6,7 @@
 #     - Link libraries to swig module
 # All other macros are for internal use only.
 # To get the actual name of the swig module,
-# use: ${SWIG_MODULE_name_REAL_NAME}.
+# use: ${SWIG_MODULE_${name}_REAL_NAME}.
 # Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify
 # special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
 # special flags to all swig calls.
@@ -14,9 +14,14 @@
 # where to write all the swig generated module (swig -outdir option)
 # The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
 # to specify extra dependencies for the generated modules.
+# If the source file generated by swig need some special flag you can use
+# SET_SOURCE_FILES_PROPERTIES( ${swig_generated_file_fullname}
+#        PROPERTIES COMPILE_FLAGS "-bla")
+
 
 #=============================================================================
 # Copyright 2004-2009 Kitware, Inc.
+# Copyright 2009 Mathieu Malaterre <[email protected]>
 #
 # Distributed under the OSI-approved BSD License (the "License");
 # see accompanying file Copyright.txt for details.
@@ -48,6 +53,9 @@ MACRO(SWIG_MODULE_INITIALIZE name language)
 
   SET(SWIG_MODULE_${name}_REAL_NAME "${name}")
   IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$")
+    # when swig is used without the -interface it will produce in the module.py
+    # a 'import _modulename' statement, which implies having a corresponding 
+    # _modulename.so (*NIX), _modulename.pyd (Win32).
     SET(SWIG_MODULE_${name}_REAL_NAME "_${name}")
   ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$")
   IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$")
@@ -117,6 +125,8 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
   # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir
   IF(CMAKE_SWIG_OUTDIR)
     SET(swig_outdir ${CMAKE_SWIG_OUTDIR})
+    # it may not exist, so create it:
+    file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR})
   ELSE(CMAKE_SWIG_OUTDIR)
     SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
   ENDIF(CMAKE_SWIG_OUTDIR)
@@ -203,8 +213,33 @@ MACRO(SWIG_ADD_MODULE name language)
     MODULE
     ${swig_generated_sources}
     ${swig_other_sources})
-  SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME}
-    PROPERTIES PREFIX "")
+  STRING(TOLOWER "${language}" swig_lowercase_language)
+  IF ("${swig_lowercase_language}" STREQUAL "java")
+    IF (APPLE)
+        # In java you want:
+        #      System.loadLibrary("LIBRARY");
+        # then JNI will look for a library whose name is platform dependent, namely
+        #   MacOS  : libLIBRARY.jnilib
+        #   Windows: LIBRARY.dll
+        #   Linux  : libLIBRARY.so
+        SET_TARGET_PROPERTIES (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib")
+      ENDIF (APPLE)
+  ENDIF ("${swig_lowercase_language}" STREQUAL "java")
+  IF ("${swig_lowercase_language}" STREQUAL "python")
+    # this is only needed for the python case where a _modulename.so is generated
+    SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "")
+    # Python extension modules on Windows must have the extension ".pyd"
+    # instead of ".dll" as of Python 2.5.  Older python versions do support
+    # this suffix.
+    # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000
+    # <quote>
+    # Windows: .dll is no longer supported as a filename extension for extension modules.
+    # .pyd is now the only filename extension that will be searched for.
+    # </quote>
+    IF(WIN32 AND NOT CYGWIN)
+      SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd")
+    ENDIF(WIN32 AND NOT CYGWIN)
+  ENDIF ("${swig_lowercase_language}" STREQUAL "python")
 ENDMACRO(SWIG_ADD_MODULE)
 
 #

+ 4 - 1
Modules/readme.txt

@@ -88,7 +88,7 @@ If the find module supports versioning it should locate a version of
 the package that is compatible with the version requested.  If a
 compatible version of the package cannot be found the module should
 not report success.  The version of the package found should be stored
-in "XXX_VERSION..." version variables docmented by the module.
+in "XXX_VERSION..." version variables documented by the module.
 
 If the QUIET option is given to the command it will set the variable
 XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module.  If
@@ -110,3 +110,6 @@ error if the module is not found.
 To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS() 
 macro, as an example see FindJPEG.cmake.
 
+For internal implementation, it's a generally accepted convention that variables starting with
+underscore are for temporary use only. (variable starting with an underscore
+are not intended as a reserved prefix).

+ 3 - 5
Source/CPack/cmCPackTGZGenerator.cxx

@@ -218,7 +218,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
     &mydata
   };
 
-  // Ok, this libtar is not const safe. Make a non-const copy of outFileName
+  // This libtar is not const safe. Make a non-const copy of outFileName
   char* realName = new char[ strlen(outFileName) + 1 ];
   strcpy(realName, outFileName);
   int flags = O_WRONLY | O_CREAT;
@@ -241,6 +241,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
     return 0;
     }
 
+  delete [] realName;
+
   std::vector<std::string>::const_iterator fileIt;
   for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
     {
@@ -256,7 +258,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
         << pathname << "\"): "
         << strerror(errno) << std::endl);
       tar_close(t);
-      delete [] realName;
       return 0;
       }
     }
@@ -265,7 +266,6 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
     cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): "
       << strerror(errno) << std::endl);
     tar_close(t);
-    delete [] realName;
     return 0;
     }
 
@@ -273,10 +273,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
     {
     cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
       << strerror(errno) << std::endl);
-    delete [] realName;
     return 0;
     }
-  delete [] realName;
   return 1;
 }
 

+ 4 - 3
Source/CPack/cmCPackTarCompressGenerator.cxx

@@ -23,7 +23,6 @@
 #include <cmsys/SystemTools.hxx>
 #include <cmcompress/cmcompress.h>
 #include <libtar/libtar.h>
-#include <memory> // auto_ptr
 #include <fcntl.h>
 #include <errno.h>
 
@@ -165,9 +164,8 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
     &mydata
   };
 
-  // Ok, this libtar is not const safe. for now use auto_ptr hack
+  // This libtar is not const safe. Make a non-const copy of outFileName
   char* realName = new char[ strlen(outFileName) + 1 ];
-  std::auto_ptr<char> realNamePtr(realName);
   strcpy(realName, outFileName);
   int flags = O_WRONLY | O_CREAT;  
   int options = 0;
@@ -185,9 +183,12 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
     {
     cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
       << strerror(errno) << std::endl);
+    delete [] realName;
     return 0;
     }
 
+  delete [] realName;
+
   std::vector<std::string>::const_iterator fileIt;
   for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
     {

+ 10 - 2
Source/CTest/cmCTestMemCheckHandler.cxx

@@ -659,8 +659,12 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
     "== .*Invalid free\\(\\) / delete / delete\\[\\]");
   cmsys::RegularExpression vgFMM(
     "== .*Mismatched free\\(\\) / delete / delete \\[\\]");
-  cmsys::RegularExpression vgMLK(
+  cmsys::RegularExpression vgMLK1(
     "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost"
+   " in loss record [0-9][0-9]* of [0-9]");
+  cmsys::RegularExpression vgMLK2(
+    "== .*[0-9][0-9]* \\([0-9]*,?[0-9]* direct, [0-9]*,?[0-9]* indirect\\)"
+        " bytes in [0-9][0-9]* blocks are definitely lost"
     " in loss record [0-9][0-9]* of [0-9]");
   cmsys::RegularExpression vgPAR(
     "== .*Syscall param .* contains unaddressable byte\\(s\\)");
@@ -705,7 +709,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
         {
         failure = cmCTestMemCheckHandler::FMM;
         }
-      else if ( vgMLK.find(lines[cc]) )
+      else if ( vgMLK1.find(lines[cc]) )
+        {
+        failure = cmCTestMemCheckHandler::MLK;
+        }
+      else if ( vgMLK2.find(lines[cc]) )
         {
         failure = cmCTestMemCheckHandler::MLK;
         }

+ 50 - 1
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -15,6 +15,7 @@
 #include "cmCTest.h"
 #include "cmSystemTools.h"
 #include <stdlib.h>
+#include <stack>
 
 cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
 {
@@ -56,6 +57,10 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
 void cmCTestMultiProcessHandler::RunTests()
 {
   this->CheckResume();
+  if(!this->CheckCycles())
+    {
+    return;
+    }
   this->TestHandler->SetMaxIndex(this->FindMaxIndex());
   this->StartNextTests();
   while(this->Tests.size() != 0)
@@ -340,7 +345,7 @@ void cmCTestMultiProcessHandler::PrintTestList()
   this->TestHandler->SetMaxIndex(this->FindMaxIndex());
   int count = 0;
   for (PropertiesMap::iterator it = this->Properties.begin();
-       it != this->Properties.end(); it ++ )
+       it != this->Properties.end(); ++it)
     {
     count++;
     cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
@@ -433,3 +438,47 @@ int cmCTestMultiProcessHandler::FindMaxIndex()
     }
   return max;
 }
+
+//Returns true if no cycles exist in the dependency graph
+bool cmCTestMultiProcessHandler::CheckCycles()
+{
+  cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, 
+             "Checking test dependency graph..." << std::endl);
+  for(TestMap::iterator it = this->Tests.begin();
+      it != this->Tests.end(); ++it)
+    {
+    //DFS from each element to itself
+    std::stack<int> s;
+    std::vector<int> visited;
+    s.push(it->first);
+    visited.push_back(it->first);
+
+    while(!s.empty())
+      {
+      int test = s.top();
+      s.pop();
+      
+      for(TestSet::iterator d = this->Tests[test].begin();
+          d != this->Tests[test].end(); ++d)
+        {
+        s.push(*d);
+        for(std::vector<int>::iterator v = visited.begin();
+            v != visited.end(); ++v)
+          {
+          if(*v == *d)
+            {
+            //cycle exists
+            cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in "
+              "the test dependency graph for the test \""
+              << this->Properties[*d]->Name << "\"." << std::endl
+              << "Please fix the cycle and run ctest again." << std::endl);
+            return false;
+            }
+          }
+        visited.push_back(*d);
+        }
+      visited.pop_back();
+      }
+    }
+  return true;
+}

+ 2 - 0
Source/CTest/cmCTestMultiProcessHandler.h

@@ -76,6 +76,8 @@ protected:
   void RemoveTest(int index);
   //Check if we need to resume an interrupted test set
   void CheckResume();
+  //Check if there are any circular dependencies
+  bool CheckCycles();
   int FindMaxIndex();
   inline size_t GetProcessorsUsed(int index);
   // map from test number to set of depend tests

+ 8 - 1
Source/QtDialog/CMakeSetupDialog.cxx

@@ -294,7 +294,14 @@ void CMakeSetupDialog::doConfigure()
       {
       return;
       }
-    dir.mkpath(".");
+    if(!dir.mkpath("."))
+      {
+      QMessageBox::information(this, tr("Create Directory Failed"), 
+        QString(tr("Failed to create directory %1")).arg(dir.path()), 
+        QMessageBox::Ok);
+
+      return;
+      }
     }
 
   // if no generator, prompt for it and other setup stuff

+ 4 - 1
Source/cmGlobalXCodeGenerator.cxx

@@ -1281,7 +1281,10 @@ void  cmGlobalXCodeGenerator
                            )
 {
   std::string makefileName=makefileBasename;
-  makefileName+=configName;
+  if(this->XcodeVersion > 20)
+    {
+    makefileName+=configName;
+    }
   cmGeneratedFileStream makefileStream(makefileName.c_str());
   if(!makefileStream)
     {

+ 8 - 2
Source/cmMakefile.cxx

@@ -3388,14 +3388,20 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
     // Now update the definition in the parent scope.
     up->Set(var, varDef);
     }
-  else if(cmMakefile* parent =
-          this->LocalGenerator->GetParent()->GetMakefile())
+  else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
     {
     // Update the definition in the parent directory top scope.  This
     // directory's scope was initialized by the closure of the parent
     // scope, so we do not need to localize the definition first.
+    cmMakefile* parent = plg->GetMakefile();
     parent->Internal->VarStack.top().Set(var, varDef);
     }
+  else
+    {
+    cmOStringStream m;
+    m << "Cannot set \"" << var << "\": current scope has no parent.";
+    this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
+    }
 }
 
 

+ 13 - 7
Source/cmSystemTools.cxx

@@ -46,7 +46,6 @@
 
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #  include <libtar/libtar.h>
-#  include <memory> // auto_ptr
 #  include <fcntl.h>
 #  include <cm_zlib.h>
 #  include <cmsys/MD5.h>
@@ -1807,9 +1806,8 @@ bool cmSystemTools::CreateTar(const char* outFileName,
     &gzs
   };
 
-  // Ok, this libtar is not const safe. for now use auto_ptr hack
+  // This libtar is not const safe. Make a non-const copy of outFileName
   char* realName = new char[ strlen(outFileName) + 1 ];
-  std::auto_ptr<char> realNamePtr(realName);
   strcpy(realName, outFileName);
   int options = 0;
   if(verbose)
@@ -1825,9 +1823,12 @@ bool cmSystemTools::CreateTar(const char* outFileName,
       options) == -1)
     {
     cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
+    delete [] realName;
     return false;
     }
 
+  delete [] realName;
+
   std::vector<cmStdString>::const_iterator it;
   for (it = files.begin(); it != files.end(); ++ it )
     {
@@ -1859,6 +1860,7 @@ bool cmSystemTools::CreateTar(const char* outFileName,
     cmSystemTools::Error("Problem with tar_close(): ", strerror(errno));
     return false;
     }
+
   return true;
 #else
   (void)outFileName;
@@ -1886,9 +1888,8 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
     &gzs
   };
 
-  // Ok, this libtar is not const safe. for now use auto_ptr hack
+  // This libtar is not const safe. Make a non-const copy of outFileName
   char* realName = new char[ strlen(outFileName) + 1 ];
-  std::auto_ptr<char> realNamePtr(realName);
   strcpy(realName, outFileName);
   if (tar_open(&t, realName,
       (gzip? &gztype : NULL),
@@ -1901,9 +1902,12 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
       | 0) == -1)
     {
     cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
+    delete [] realName;
     return false;
     }
 
+  delete [] realName;
+
   if (tar_extract_all(t, 0) != 0)
   {
     cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno));
@@ -1940,9 +1944,8 @@ bool cmSystemTools::ListTar(const char* outFileName,
     &gzs
   };
 
-  // Ok, this libtar is not const safe. for now use auto_ptr hack
+  // This libtar is not const safe. Make a non-const copy of outFileName
   char* realName = new char[ strlen(outFileName) + 1 ];
-  std::auto_ptr<char> realNamePtr(realName);
   strcpy(realName, outFileName);
   if (tar_open(&t, realName,
       (gzip? &gztype : NULL),
@@ -1955,9 +1958,12 @@ bool cmSystemTools::ListTar(const char* outFileName,
       | 0) == -1)
     {
     cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
+    delete [] realName;
     return false;
     }
 
+  delete [] realName;
+
   while ((th_read(t)) == 0)
   {
     const char* filename = th_get_pathname(t);

+ 10 - 15
Source/cmTarget.cxx

@@ -881,30 +881,25 @@ void cmTarget::DefineProperties(cmake *cm)
      "an archive target. "                                                  \
      "All Windows-based systems including Cygwin are DLL platforms."
 
+#define CM_TARGET_OUTDIR_DOC(TYPE, type)                                    \
+     "This property specifies the directory into which " #type " target "   \
+     "files should be built. "                                              \
+     CM_TARGET_FILE_TYPES_DOC "  "                                          \
+     "This property is initialized by the value of the variable "           \
+     "CMAKE_" #TYPE "_OUTPUT_DIRECTORY if it is set when a target is created."
+
   cm->DefineProperty
     ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET,
      "Output directory in which to build ARCHIVE target files.",
-     "This property specifies the directory into which archive target files "
-     "should be built. "
-     CM_TARGET_FILE_TYPES_DOC " "
-     "This property is initialized by the value of the variable "
-     "CMAKE_ARCHIVE_OUTPUT_DIRECTORY if it is set when a target is created.");
+     CM_TARGET_OUTDIR_DOC(ARCHIVE, archive));
   cm->DefineProperty
     ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET,
      "Output directory in which to build LIBRARY target files.",
-     "This property specifies the directory into which library target files "
-     "should be built. "
-     CM_TARGET_FILE_TYPES_DOC " "
-     "This property is initialized by the value of the variable "
-     "CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.");
+     CM_TARGET_OUTDIR_DOC(LIBRARY, library));
   cm->DefineProperty
     ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET,
      "Output directory in which to build RUNTIME target files.",
-     "This property specifies the directory into which runtime target files "
-     "should be built. "
-     CM_TARGET_FILE_TYPES_DOC " "
-     "This property is initialized by the value of the variable "
-     "CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created.");
+     CM_TARGET_OUTDIR_DOC(RUNTIME, runtime));
 
   cm->DefineProperty
     ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET,

+ 9 - 9
Tests/CMakeLists.txt

@@ -242,7 +242,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
     ")
     ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
     IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
-      SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT 3500)
+      SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
     ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
   ENDMACRO(ADD_NIGHTLY_BUILD_TEST)
   IF(CMAKE_BUILD_NIGHTLY_RELEASES)
@@ -1209,17 +1209,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
     PASS_REGULAR_EXPRESSION "\\*\\*\\*Timeout")
   
   CONFIGURE_FILE(
-    "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake"
+    "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake.in"
     "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake"
     @ONLY ESCAPE_QUOTES)
   CONFIGURE_FILE(
-    "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake"
+    "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake.in"
     "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/hello.cmake"
     @ONLY ESCAPE_QUOTES)
-  #ADD_TEST(CTestTestRunScript ${CMAKE_CTEST_COMMAND}
-  #  -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V
-  #  --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log"
-  #  )
+  ADD_TEST(CTestTestRunScript ${CMAKE_CTEST_COMMAND}
+    -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V
+    --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log"
+    )
   
   ADD_TEST(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
   
@@ -1242,8 +1242,8 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
 
   set(regex "(Problems when submitting via S*CP")
   set(regex "${regex}|Error message was: ")
-  set(regex "${regex}(Couldn.t resolve host ")
-  set(regex "${regex}|couldn.t connect to host")
+  set(regex "${regex}([Cc]ould *n.t resolve host")
+  set(regex "${regex}|[Cc]ould *n.t connect to host")
   set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)")
   set(regex "${regex}|Submission method .xmlrpc. not compiled into CTest")
   set(regex "${regex}|Submission successful)")

+ 9 - 1
Tests/CPackComponents/CMakeLists.txt

@@ -16,8 +16,16 @@ target_link_libraries(mylibapp mylib)
 
 # On Linux, enable using an absolute install path to verify that
 # CMAKE_INSTALL_PREFIX and CPACK_SET_DESTDIR interact properly.
+#
+# But only use absolute paths if not targeting an NSIS installer
+# as indicated by CPACK_BINARY_NSIS. (If we allow this, the test
+# fails on Linux machines with makensis installed when we are not
+# cross-compiling...)
+#
 if(UNIX AND NOT APPLE)
-  set(mylib_install_to_absolute_path ON)
+  if(NOT CPACK_BINARY_NSIS)
+    set(mylib_install_to_absolute_path ON)
+  endif()
 endif()
 
 if(mylib_install_to_absolute_path)

+ 0 - 6
Tests/CTestTestRunScript/hello.cmake

@@ -1,6 +0,0 @@
-GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
-SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
-SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestRunScript")
-SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestRunScript")
-
-message("hello world")

+ 2 - 0
Tests/CTestTestRunScript/hello.cmake.in

@@ -0,0 +1,2 @@
+SET(CTEST_RUN_CURRENT_SCRIPT 0)
+MESSAGE("hello world")

+ 0 - 7
Tests/CTestTestRunScript/test.cmake

@@ -1,7 +0,0 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.1)
-GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
-SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
-SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestRunScript")
-SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestRunScript")
-
-CTEST_RUN_SCRIPT("${CTEST_BINARY_DIRECTORY}/hello.cmake")

+ 2 - 0
Tests/CTestTestRunScript/test.cmake.in

@@ -0,0 +1,2 @@
+SET(CTEST_RUN_CURRENT_SCRIPT 0)
+CTEST_RUN_SCRIPT("CTestTestRunScript/hello.cmake" RETURN_VALUE res RETURN_VALUE)

+ 11 - 0
Tests/TryCompile/CMakeLists.txt

@@ -142,6 +142,17 @@ IF(NOT "${TRY_OUT}" MATCHES "hello world")
   MESSAGE(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"")
 ENDIF(NOT "${TRY_OUT}" MATCHES "hello world")
 
+TRY_RUN(ARG_TEST_RUN ARG_TEST_COMPILE
+    ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp  
+    ${TryCompile_SOURCE_DIR}/expect_arg.c
+    OUTPUT_VARIABLE TRY_OUT
+    ARGS arg1 arg2)
+IF(NOT ARG_TEST_COMPILE)
+  MESSAGE(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}")
+ENDIF(NOT ARG_TEST_COMPILE)
+IF(NOT "${ARG_TEST_RUN}" STREQUAL "0")
+  MESSAGE(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}")
+ENDIF(NOT "${ARG_TEST_RUN}" STREQUAL "0")
 
 # try to run a file that should compile and run, but return an error
 TRY_RUN(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE

+ 22 - 0
Tests/TryCompile/expect_arg.c

@@ -0,0 +1,22 @@
+#include <stdio.h>
+#include <string.h>
+int main(int ac, char*av[])
+{
+  int i;
+  printf("ac = [%d]\n", ac);
+  for(i =0; i < ac; i++)
+    {
+    printf("arg[%d] = %s\n", i, av[i]);
+    }
+  if(ac == 3)
+    {
+    if(strcmp(av[1], "arg1") ==0 
+       && strcmp(av[2], "arg2") ==0)
+      {
+      printf("arg1 and arg2 present and accounted for!\n");
+      return 0;
+      }
+    }
+  printf("arg1 and arg2 missing!\n");
+  return -1;
+}