Merge branch 'fix-clang-cross-compile-find-binutils' into release
diff --git a/Help/policy/CMP0022.rst b/Help/policy/CMP0022.rst
index 16a5bc3..22c7c4f 100644
--- a/Help/policy/CMP0022.rst
+++ b/Help/policy/CMP0022.rst
@@ -22,7 +22,7 @@
 target_link_libraries command will no longer populate the properties
 matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy is NEW.
 
-Warning-free future-compatible code which works with CMake 2.8.9 onwards
+Warning-free future-compatible code which works with CMake 2.8.7 onwards
 can be written by using the ``LINK_PRIVATE`` and ``LINK_PUBLIC`` keywords
 of :command:`target_link_libraries`.
 
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index b896de2..60d01b5 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -237,6 +237,7 @@
     file(READ "${bundle}/Contents/Info.plist" info_plist)
     string(REGEX REPLACE ";" "\\\\;" info_plist "${info_plist}")
     string(REGEX REPLACE "\n" "${eol_char};" info_plist "${info_plist}")
+    string(REGEX REPLACE "\r" "${eol_char};" info_plist "${info_plist}")
 
     # Scan the lines for "<key>CFBundleExecutable</key>" - the line after that
     # is the name of the main executable.
diff --git a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
index 9d8ba9e..abbcda4 100644
--- a/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
+++ b/Modules/CMakeCheckCompilerFlagCommonPatterns.cmake
@@ -32,7 +32,7 @@
      FAIL_REGEX "[Ww]arning: [Oo]ption"                     # SunPro
      FAIL_REGEX "command option .* is not recognized"       # XL
      FAIL_REGEX "command option .* contains an incorrect subargument" # XL
-     FAIL_REGEX "not supported in this configuration; ignored"       # AIX
+     FAIL_REGEX "not supported in this configuration. ignored"       # AIX
      FAIL_REGEX "File with unknown suffix passed to linker" # PGI
      FAIL_REGEX "WARNING: unknown flag:"                    # Open64
      FAIL_REGEX "Incorrect command line option:"            # Borland
diff --git a/Modules/CMakeExpandImportedTargets.cmake b/Modules/CMakeExpandImportedTargets.cmake
index 0752e04..b6ab7ef 100644
--- a/Modules/CMakeExpandImportedTargets.cmake
+++ b/Modules/CMakeExpandImportedTargets.cmake
@@ -71,7 +71,11 @@
       set(_CCSR_NEW_REQ_LIBS )
       set(_CHECK_FOR_IMPORTED_TARGETS FALSE)
       foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
-         get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+         if(TARGET "${_CURRENT_LIB}")
+           get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+         else()
+           set(_importedConfigs "")
+         endif()
          if (_importedConfigs)
 #            message(STATUS "Detected imported target ${_CURRENT_LIB}")
             # Ok, so this is an imported target.
@@ -123,7 +127,11 @@
    # all remaining imported target names (there shouldn't be any left anyway).
    set(_CCSR_NEW_REQ_LIBS )
    foreach(_CURRENT_LIB ${_CCSR_REQ_LIBS})
-      get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+      if(TARGET "${_CURRENT_LIB}")
+        get_target_property(_importedConfigs "${_CURRENT_LIB}" IMPORTED_CONFIGURATIONS)
+      else()
+        set(_importedConfigs "")
+      endif()
       if (NOT _importedConfigs)
          list(APPEND _CCSR_NEW_REQ_LIBS "${_CURRENT_LIB}" )
 #         message(STATUS "final: appending ${_CURRENT_LIB}")
diff --git a/Modules/Compiler/QCC-C.cmake b/Modules/Compiler/QCC-C.cmake
new file mode 100644
index 0000000..ae4a2f4
--- /dev/null
+++ b/Modules/Compiler/QCC-C.cmake
@@ -0,0 +1,2 @@
+include(Compiler/QCC)
+__compiler_qcc(C)
diff --git a/Modules/Compiler/QCC-CXX.cmake b/Modules/Compiler/QCC-CXX.cmake
new file mode 100644
index 0000000..a676bbe
--- /dev/null
+++ b/Modules/Compiler/QCC-CXX.cmake
@@ -0,0 +1,12 @@
+include(Compiler/QCC)
+__compiler_qcc(CXX)
+
+# If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the
+# default for the driver is not c++.
+set(CMAKE_CXX_COMPILE_OBJECT
+  "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
+
+set(CMAKE_CXX_LINK_EXECUTABLE
+  "<CMAKE_CXX_COMPILER> -lang-c++ <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS>  -o <TARGET> <LINK_LIBRARIES>")
+
+set(CMAKE_CXX_COMPILE_OPTIONS_VISIBILITY_INLINES_HIDDEN "-fvisibility-inlines-hidden")
diff --git a/Modules/Compiler/QCC.cmake b/Modules/Compiler/QCC.cmake
new file mode 100644
index 0000000..76477e4
--- /dev/null
+++ b/Modules/Compiler/QCC.cmake
@@ -0,0 +1,24 @@
+
+#=============================================================================
+# Copyright 2002-2014 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+include(Compiler/GNU)
+
+macro(__compiler_qcc lang)
+  __compiler_gnu(${lang})
+
+  # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
+  set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
+
+  set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
+  set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
+endmacro()
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index d0515c6..99e574e 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -1190,14 +1190,14 @@
   set( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
 
   set( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
-  set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer )
+  set( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer )
   set( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
   set( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
   set( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
   set( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
   set( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
   set( QT_ICONENGINES_PLUGINS qsvgicon )
-  set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff  )
+  set( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga )
   set( QT_INPUTMETHODS_PLUGINS qimsw_multi )
   set( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
   if(APPLE)
@@ -1211,7 +1211,7 @@
   set( QT_PHONON_PLUGINS ${QT_PHONON_BACKEND_PLUGINS} )
   set( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
   set( QT_QTCORE_PLUGINS ${QT_BEARER_PLUGINS} ${QT_CODECS_PLUGINS} )
-  set( QT_QTGUI_PLUGINS qtaccessiblewidgets qgif qjpeg qmng qico qtiff ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
+  set( QT_QTGUI_PLUGINS qtaccessiblewidgets ${QT_IMAGEFORMATS_PLUGINS} ${QT_DECORATIONS_PLUGINS} ${QT_GRAPHICSDRIVERS_PLUGINS} ${QT_GRAPHICSSYSTEMS_PLUGINS} ${QT_INPUTMETHODS_PLUGINS} ${QT_MOUSEDRIVERS_PLUGINS} )
   set( QT_QTSCRIPT_PLUGINS ${QT_SCRIPT_PLUGINS} )
   set( QT_QTSQL_PLUGINS ${QT_SQLDRIVERS_PLUGINS} )
   set( QT_QTSVG_PLUGINS qsvg qsvgicon )
diff --git a/Modules/Platform/QNX-QCC-C.cmake b/Modules/Platform/QNX-QCC-C.cmake
deleted file mode 100644
index e5721a7..0000000
--- a/Modules/Platform/QNX-QCC-C.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-include(Platform/QNX)
-
-__compiler_qcc(C)
diff --git a/Modules/Platform/QNX-QCC-CXX.cmake b/Modules/Platform/QNX-QCC-CXX.cmake
deleted file mode 100644
index e490bbe..0000000
--- a/Modules/Platform/QNX-QCC-CXX.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-
-include(Platform/QNX)
-
-__compiler_qcc(CXX)
diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake
index cc551bd..ebc4609 100644
--- a/Modules/Platform/QNX.cmake
+++ b/Modules/Platform/QNX.cmake
@@ -1,5 +1,8 @@
 set(QNXNTO 1)
 
+include(Platform/GNU)
+unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
+
 set(CMAKE_DL_LIBS "")
 
 # Shared libraries with no builtin soname may not be linked safely by
@@ -14,22 +17,3 @@
   set(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
   set(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
 endforeach()
-
-include(Platform/GNU)
-unset(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-
-macro(__compiler_qcc lang)
-  # http://www.qnx.com/developers/docs/6.4.0/neutrino/utilities/q/qcc.html#examples
-  set(CMAKE_${lang}_COMPILE_OPTIONS_TARGET "-V")
-
-  set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-Wp,-isystem,")
-  set(CMAKE_DEPFILE_FLAGS_${lang} "-Wc,-MMD,<DEPFILE>,-MT,<OBJECT>,-MF,<DEPFILE>")
-
-  if (lang STREQUAL CXX)
-    # If the toolchain uses qcc for CMAKE_CXX_COMPILER instead of QCC, the
-    # default for the driver is not c++.
-    set(CMAKE_CXX_COMPILE_OBJECT
-    "<CMAKE_CXX_COMPILER> -lang-c++ <DEFINES> <FLAGS> -o <OBJECT> -c <SOURCE>")
-  endif()
-
-endmacro()
diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake
index e29aaf4..cfef536 100644
--- a/Modules/Platform/Windows-MSVC.cmake
+++ b/Modules/Platform/Windows-MSVC.cmake
@@ -39,12 +39,14 @@
 set(WIN32 1)
 
 if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
-  set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup")
-  set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup")
+  set(CMAKE_CREATE_WIN32_EXE "/entry:WinMainCRTStartup")
+  set(CMAKE_CREATE_CONSOLE_EXE "/entry:mainACRTStartup")
+  set(_PLATFORM_LINK_FLAGS " /subsystem:windowsce")
   set(WINCE 1)
 else()
   set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows")
   set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console")
+  set(_PLATFORM_LINK_FLAGS "")
 endif()
 
 if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
@@ -235,7 +237,7 @@
     set(_CMAKE_VS_LINK_EXE "<CMAKE_COMMAND> -E vs_link_exe ")
   endif()
   set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
-    "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+    "${_CMAKE_VS_LINK_DLL}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /dll /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
 
   set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY})
   set(CMAKE_${lang}_CREATE_STATIC_LIBRARY  "<CMAKE_LINKER> /lib ${CMAKE_CL_NOLOGO} <LINK_FLAGS> /out:<TARGET> <OBJECTS> ")
@@ -249,7 +251,7 @@
 
   set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1)
   set(CMAKE_${lang}_LINK_EXECUTABLE
-    "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+    "${_CMAKE_VS_LINK_EXE}<CMAKE_LINKER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /pdb:<TARGET_PDB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>${_PLATFORM_LINK_FLAGS} <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
   set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_FLAGS_${lang}}")
   set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}")
diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake
index 11ca205..f8eeef6 100644
--- a/Modules/UseSWIG.cmake
+++ b/Modules/UseSWIG.cmake
@@ -57,7 +57,7 @@
   set(SWIG_MODULE_${name}_SWIG_LANGUAGE_FLAG "${swig_lowercase_language}")
 
   set(SWIG_MODULE_${name}_REAL_NAME "${name}")
-  if (CMAKE_SWIG_FLAGS MATCHES "-noproxy")
+  if (";${CMAKE_SWIG_FLAGS};" MATCHES ";-noproxy;")
     set (SWIG_MODULE_${name}_NOPROXY TRUE)
   endif ()
   if("${SWIG_MODULE_${name}_LANGUAGE}" STREQUAL "UNKNOWN")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1937ad4..4caa608 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
 # CMake version number components.
 set(CMake_VERSION_MAJOR 3)
 set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 0)
+set(CMake_VERSION_PATCH 1)
 #set(CMake_VERSION_RC 0)
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index d5472a1..e4a146c 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -765,7 +765,11 @@
                                      const char* compilerId)
 {
   /*
-  gnu:
+  gnu >= 4.9:
+    A mod file is an ascii file compressed with gzip.
+    Compiling twice produces identical modules.
+
+  gnu < 4.9:
     A mod file is an ascii file.
     <bar.mod>
     FORTRAN module created from /path/to/foo.f90 on Sun Dec 30 22:47:58 2007
@@ -821,21 +825,30 @@
    */
   if (strcmp(compilerId, "GNU") == 0 )
     {
-    const char seq[1] = {'\n'};
-    const int seqlen = 1;
-
-    if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
+    // GNU Fortran 4.9 and later compress .mod files with gzip
+    // but also do not include a date so we can fall through to
+    // compare them without skipping any prefix.
+    unsigned char hdr[2];
+    bool okay = finModFile.read(reinterpret_cast<char*>(hdr), 2)? true:false;
+    finModFile.seekg(0);
+    if(!(okay && hdr[0] == 0x1f && hdr[1] == 0x8b))
       {
-      // The module is of unexpected format.  Assume it is different.
-      std::cerr << compilerId << " fortran module " << modFile
-                << " has unexpected format." << std::endl;
-      return true;
-      }
+      const char seq[1] = {'\n'};
+      const int seqlen = 1;
 
-    if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
-      {
-      // The stamp must differ if the sequence is not contained.
-      return true;
+      if(!cmDependsFortranStreamContainsSequence(finModFile, seq, seqlen))
+        {
+        // The module is of unexpected format.  Assume it is different.
+        std::cerr << compilerId << " fortran module " << modFile
+                  << " has unexpected format." << std::endl;
+        return true;
+        }
+
+      if(!cmDependsFortranStreamContainsSequence(finStampFile, seq, seqlen))
+        {
+        // The stamp must differ if the sequence is not contained.
+        return true;
+        }
       }
     }
   else if(strcmp(compilerId, "Intel") == 0)
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index beb10da..203735a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -804,6 +804,14 @@
       case cmPolicies::OLD:
         // OLD behavior is to convert QCC to GNU.
         mf->AddDefinition(compilerIdVar.c_str(), "GNU");
+        if(lang == "C")
+          {
+          mf->AddDefinition("CMAKE_COMPILER_IS_GNUCC", "1");
+          }
+        else if(lang == "CXX")
+          {
+          mf->AddDefinition("CMAKE_COMPILER_IS_GNUCXX", "1");
+          }
         break;
       case cmPolicies::REQUIRED_IF_USED:
       case cmPolicies::REQUIRED_ALWAYS:
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 731bc00..60643ac 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -972,7 +972,16 @@
       {
       knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) );
       }
+    //get list files which are implicit dependencies as well and will be phony
+    //for rebuild manifest
+    std::vector<std::string> const& lf = (*i)->GetMakefile()->GetListFiles();
+    typedef std::vector<std::string>::const_iterator vect_it;
+    for(vect_it j = lf.begin(); j != lf.end(); ++j)
+      {
+      knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) );
+      }
     }
+  knownDependencies.insert( "CMakeCache.txt" );
 
   for(std::vector<cmGeneratorExpressionEvaluationFile*>::const_iterator
       li = this->EvaluationFiles.begin();
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 484b28f..f7c2e87 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -837,16 +837,14 @@
   cmTarget& cmtarget,
   const std::string &lang)
 {
-  std::string fname = fullpath;
-  cmXCodeObject* fileRef = this->FileRefs[fname];
+  cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath);
+  cmXCodeObject* fileRef = this->FileRefs[key];
   if(!fileRef)
     {
     fileRef = this->CreateObject(cmXCodeObject::PBXFileReference);
-    std::string comment = fname;
-    fileRef->SetComment(fname.c_str());
-    this->FileRefs[fname] = fileRef;
+    fileRef->SetComment(fullpath.c_str());
+    this->FileRefs[key] = fileRef;
     }
-  cmStdString key = GetGroupMapKeyFromPath(cmtarget, fullpath);
   cmXCodeObject* group = this->GroupMap[key];
   cmXCodeObject* children = group->GetObject("children");
   if (!children->HasObject(fileRef))
@@ -2298,7 +2296,7 @@
       }
     }
 
-  buildSettings->AddAttribute("OTHER_LDFLAGS",
+  buildSettings->AddAttribute(this->GetTargetLinkFlagsVar(target),
                               this->CreateString(extraLinkOptions.c_str()));
   buildSettings->AddAttribute("OTHER_REZFLAGS",
                               this->CreateString(""));
@@ -2522,6 +2520,22 @@
 }
 
 //----------------------------------------------------------------------------
+const char*
+cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(cmTarget const& cmtarget) const
+{
+  if(this->XcodeVersion >= 60 &&
+     (cmtarget.GetType() == cmTarget::STATIC_LIBRARY ||
+      cmtarget.GetType() == cmTarget::OBJECT_LIBRARY))
+    {
+    return "OTHER_LIBTOOLFLAGS";
+    }
+  else
+    {
+    return "OTHER_LDFLAGS";
+    }
+}
+
+//----------------------------------------------------------------------------
 const char* cmGlobalXCodeGenerator::GetTargetFileType(cmTarget& cmtarget)
 {
   switch(cmtarget.GetType())
@@ -2834,8 +2848,9 @@
         sep = " ";
         linkObjs += this->XCodeEscapePath(oi->c_str());
         }
-      this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS",
-                                        linkObjs.c_str(), configName);
+      this->AppendBuildSettingAttribute(
+        target, this->GetTargetLinkFlagsVar(*cmtarget),
+        linkObjs.c_str(), configName);
       }
 
     // Skip link information for object libraries.
@@ -2913,8 +2928,9 @@
         target->AddDependTarget(configName, li->Target->GetName());
         }
       }
-    this->AppendBuildSettingAttribute(target, "OTHER_LDFLAGS",
-                                      linkLibs.c_str(), configName);
+    this->AppendBuildSettingAttribute(
+      target, this->GetTargetLinkFlagsVar(*cmtarget),
+      linkLibs.c_str(), configName);
     }
     }
 }
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index c9d20c2..a7b54e9 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -141,6 +141,7 @@
                                    cmXCodeObject* buildPhases);
   void ForceLinkerLanguages();
   void ForceLinkerLanguage(cmTarget& cmtarget);
+  const char* GetTargetLinkFlagsVar(cmTarget const& cmtarget) const;
   const char* GetTargetFileType(cmTarget& cmtarget);
   const char* GetTargetProductType(cmTarget& cmtarget);
   std::string AddConfigurations(cmXCodeObject* target, cmTarget& cmtarget);
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7a39f45..38d369e 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -213,6 +213,20 @@
       filesFrom.push_back(from1);
       filesTo.push_back(to1);
       }
+    else if(this->Target->IsCFBundleOnApple())
+      {
+      // Install the whole app bundle directory.
+      type = cmInstallType_DIRECTORY;
+      literal_args += " USE_SOURCE_PERMISSIONS";
+
+      std::string targetNameBase = targetName.substr(0, targetName.find('/'));
+
+      std::string from1 = fromDirConfig + targetNameBase;
+      std::string to1 = toDir + targetName;
+
+      filesFrom.push_back(from1);
+      filesTo.push_back(to1);
+      }
     else
       {
       bool haveNamelink = false;
diff --git a/Source/cmListFileLexer.c b/Source/cmListFileLexer.c
index bfa388e..af4fc3d 100644
--- a/Source/cmListFileLexer.c
+++ b/Source/cmListFileLexer.c
@@ -369,8 +369,8 @@
         *yy_cp = '\0'; \
         yyg->yy_c_buf_p = yy_cp;
 
-#define YY_NUM_RULES 23
-#define YY_END_OF_BUFFER 24
+#define YY_NUM_RULES 24
+#define YY_END_OF_BUFFER 25
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -381,10 +381,10 @@
 static yyconst flex_int16_t yy_accept[77] =
     {   0,
         0,    0,    0,    0,    0,    0,    0,    0,    4,    4,
-       24,   13,   21,    1,   15,    3,   13,    5,    6,    7,
-       22,   22,   16,   18,   19,   20,   10,   11,    8,   12,
-        9,    4,   13,    0,   13,    0,   21,    0,    0,    7,
-       13,    0,   13,    0,    2,    0,   13,   16,    0,   17,
+       25,   13,   22,    1,   16,    3,   13,    5,    6,    7,
+       15,   23,   17,   19,   20,   21,   10,   11,    8,   12,
+        9,    4,   13,    0,   13,    0,   22,    0,    0,    7,
+       13,    0,   13,    0,    2,    0,   13,   17,    0,   18,
        10,    8,    4,    0,   14,    0,    0,    0,    0,   14,
         0,    0,   14,    0,    0,    0,    2,   14,    0,    0,
         0,    0,    0,    0,    0,    0
@@ -523,10 +523,10 @@
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[24] =
+static yyconst flex_int32_t yy_rule_can_match_eol[25] =
     {   0,
-1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0,
-    0, 0, 0, 0,     };
+1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1,
+    0, 0, 0, 0, 0,     };
 
 /* The intent behind this definition is that it'll catch
  * any uses of REJECT which flex missed.
@@ -615,7 +615,7 @@
 
 
 
-#line 621 "cmListFileLexer.c"
+#line 628 "cmListFileLexer.c"
 
 #define INITIAL 0
 #define STRING 1
@@ -850,7 +850,7 @@
 #line 91 "cmListFileLexer.in.l"
 
 
-#line 858 "cmListFileLexer.c"
+#line 865 "cmListFileLexer.c"
 
         if ( !yyg->yy_init )
                 {
@@ -1111,75 +1111,84 @@
 YY_RULE_SETUP
 #line 215 "cmListFileLexer.in.l"
 {
+  lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
+  lexer->column += yyleng;
+  return 1;
+}
+case 16:
+YY_RULE_SETUP
+#line 222 "cmListFileLexer.in.l"
+{
   lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
   cmListFileLexerSetToken(lexer, "", 0);
   lexer->column += yyleng;
   BEGIN(STRING);
 }
         YY_BREAK
-case 16:
+case 17:
 YY_RULE_SETUP
-#line 222 "cmListFileLexer.in.l"
+#line 229 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
-case 17:
-/* rule 17 can match eol */
+case 18:
+/* rule 18 can match eol */
 YY_RULE_SETUP
-#line 227 "cmListFileLexer.in.l"
+#line 234 "cmListFileLexer.in.l"
 {
   /* Continuation: text is not part of string */
   ++lexer->line;
   lexer->column = 1;
 }
         YY_BREAK
-case 18:
-/* rule 18 can match eol */
+case 19:
+/* rule 19 can match eol */
 YY_RULE_SETUP
-#line 233 "cmListFileLexer.in.l"
+#line 240 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   ++lexer->line;
   lexer->column = 1;
 }
         YY_BREAK
-case 19:
+case 20:
 YY_RULE_SETUP
-#line 239 "cmListFileLexer.in.l"
+#line 246 "cmListFileLexer.in.l"
 {
   lexer->column += yyleng;
   BEGIN(INITIAL);
   return 1;
 }
-case 20:
+case 21:
 YY_RULE_SETUP
-#line 245 "cmListFileLexer.in.l"
+#line 252 "cmListFileLexer.in.l"
 {
   cmListFileLexerAppend(lexer, yytext, yyleng);
   lexer->column += yyleng;
 }
         YY_BREAK
 case YY_STATE_EOF(STRING):
-#line 250 "cmListFileLexer.in.l"
+#line 257 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadString;
   BEGIN(INITIAL);
   return 1;
 }
-case 21:
+case 22:
 YY_RULE_SETUP
-#line 256 "cmListFileLexer.in.l"
+#line 263 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_Space;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
   lexer->column += yyleng;
   return 1;
 }
-case 22:
+case 23:
 YY_RULE_SETUP
-#line 263 "cmListFileLexer.in.l"
+#line 270 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_BadCharacter;
   cmListFileLexerSetToken(lexer, yytext, yyleng);
@@ -1188,18 +1197,18 @@
 }
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(COMMENT):
-#line 270 "cmListFileLexer.in.l"
+#line 277 "cmListFileLexer.in.l"
 {
   lexer->token.type = cmListFileLexer_Token_None;
   cmListFileLexerSetToken(lexer, 0, 0);
   return 0;
 }
-case 23:
+case 24:
 YY_RULE_SETUP
-#line 276 "cmListFileLexer.in.l"
+#line 283 "cmListFileLexer.in.l"
 ECHO;
         YY_BREAK
-#line 1220 "cmListFileLexer.c"
+#line 1238 "cmListFileLexer.c"
 
         case YY_END_OF_BUFFER:
                 {
@@ -2320,7 +2329,7 @@
 
 #define YYTABLES_NAME "yytables"
 
-#line 276 "cmListFileLexer.in.l"
+#line 282 "cmListFileLexer.in.l"
 
 
 
diff --git a/Source/cmListFileLexer.in.l b/Source/cmListFileLexer.in.l
index ed4bf6b..a520c72 100644
--- a/Source/cmListFileLexer.in.l
+++ b/Source/cmListFileLexer.in.l
@@ -212,6 +212,13 @@
   return 1;
 }
 
+\[ {
+  lexer->token.type = cmListFileLexer_Token_ArgumentUnquoted;
+  cmListFileLexerSetToken(lexer, yytext, yyleng);
+  lexer->column += yyleng;
+  return 1;
+}
+
 \" {
   lexer->token.type = cmListFileLexer_Token_ArgumentQuoted;
   cmListFileLexerSetToken(lexer, "", 0);
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 2c5dd45..a8bb317 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -1786,8 +1786,8 @@
 
   std::string::size_type matchOffset = 0;
 
-  const std::string absPath = cmsys::SystemTools::GetFilenamePath(
-                   cmsys::SystemTools::GetRealPath(absFilename.c_str())) + '/';
+  const std::string realName =
+                   cmsys::SystemTools::GetRealPath(absFilename.c_str());
 
   matchOffset = 0;
   if ((strstr(contentsString.c_str(), "ui_") != NULL)
@@ -1804,7 +1804,7 @@
       // finding the correct header, so we need to remove the ui_ part
       basename = basename.substr(3);
 
-      includedUis[absPath] = basename;
+      includedUis[realName] = basename;
 
       matchOffset += uiIncludeRegExp.end();
       } while(uiIncludeRegExp.find(contentsString.c_str() + matchOffset));
@@ -1960,7 +1960,7 @@
   return false;
 }
 
-bool cmQtAutoGenerators::GenerateUi(const std::string& path,
+bool cmQtAutoGenerators::GenerateUi(const std::string& realName,
                                     const std::string& uiFileName)
 {
   if (!cmsys::SystemTools::FileExists(this->Builddir.c_str(), false))
@@ -1968,6 +1968,9 @@
     cmsys::SystemTools::MakeDirectory(this->Builddir.c_str());
     }
 
+  const std::string path = cmsys::SystemTools::GetFilenamePath(
+                                                      realName.c_str()) + '/';
+
   std::string ui_output_file = "ui_" + uiFileName + ".h";
   std::string ui_input_file = path + uiFileName + ".ui";
 
@@ -2074,6 +2077,8 @@
           }
         }
 
+      command.push_back("-name");
+      command.push_back(basename);
       command.push_back("-o");
       command.push_back(rcc_output_file);
       command.push_back(*si);
diff --git a/Source/cmQtAutoGenerators.h b/Source/cmQtAutoGenerators.h
index 2840fbf..9ddf64f 100644
--- a/Source/cmQtAutoGenerators.h
+++ b/Source/cmQtAutoGenerators.h
@@ -48,7 +48,7 @@
   bool RunAutogen(cmMakefile* makefile);
   bool GenerateMoc(const std::string& sourceFile,
                    const std::string& mocFileName);
-  bool GenerateUi(const std::string& path, const std::string& uiFileName);
+  bool GenerateUi(const std::string& realName, const std::string& uiFileName);
   bool GenerateQrc();
   void ParseCppFile(const std::string& absFilename,
                     const std::vector<std::string>& headerExtensions,
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index c7acfd0..575b973 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -2163,6 +2163,11 @@
   cmSystemToolsCMakeCommand = exe_dir;
   cmSystemToolsCMakeCommand += "/cmake";
   cmSystemToolsCMakeCommand += cmSystemTools::GetExecutableExtension();
+#ifndef CMAKE_BUILD_WITH_CMAKE
+  // The bootstrap cmake does not provide the other tools,
+  // so use the directory where they are about to be built.
+  exe_dir = CMAKE_BOOTSTRAP_BINARY_DIR "/bin";
+#endif
   cmSystemToolsCTestCommand = exe_dir;
   cmSystemToolsCTestCommand += "/ctest";
   cmSystemToolsCTestCommand += cmSystemTools::GetExecutableExtension();
@@ -2215,7 +2220,7 @@
     }
 #else
   // Bootstrap build knows its source.
-  cmSystemToolsCMakeRoot = CMAKE_ROOT_DIR;
+  cmSystemToolsCMakeRoot = CMAKE_BOOTSTRAP_SOURCE_DIR;
 #endif
 }
 
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 7cbc1da..fafcca8 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -339,16 +339,24 @@
         // The value is transformed if it is a filepath for example, so
         // we can't compare whether the value is already in the cache until
         // after we call AddCacheEntry.
-        const char *cachedValue =
-                              this->CacheManager->GetCacheValue(var.c_str());
+        bool haveValue = false;
+        std::string cachedValue;
+        if(this->WarnUnusedCli)
+          {
+          if(const char *v = this->CacheManager->GetCacheValue(var.c_str()))
+            {
+            haveValue = true;
+            cachedValue = v;
+            }
+          }
 
         this->CacheManager->AddCacheEntry(var.c_str(), value.c_str(),
           "No help, variable specified on the command line.", type);
+
         if(this->WarnUnusedCli)
           {
-          if (!cachedValue
-              || strcmp(this->CacheManager->GetCacheValue(var.c_str()),
-                        cachedValue) != 0)
+          if (!haveValue ||
+              cachedValue != this->CacheManager->GetCacheValue(var.c_str()))
             {
             this->WatchUnusedCli(var.c_str());
             }
diff --git a/Source/kwsys/CPU.h.in b/Source/kwsys/CPU.h.in
index 2e1a584..626914b 100644
--- a/Source/kwsys/CPU.h.in
+++ b/Source/kwsys/CPU.h.in
@@ -80,6 +80,10 @@
 #elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
 
+/* OpenRISC 1000 */
+#elif defined(__or1k__)
+# define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
+
 /* RS/6000 */
 #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
 # define @KWSYS_NAMESPACE@_CPU_ENDIAN_ID @KWSYS_NAMESPACE@_CPU_ENDIAN_ID_BIG
diff --git a/Source/kwsys/SystemInformation.cxx b/Source/kwsys/SystemInformation.cxx
index ec3a133..a03b39c 100644
--- a/Source/kwsys/SystemInformation.cxx
+++ b/Source/kwsys/SystemInformation.cxx
@@ -3696,7 +3696,10 @@
     // install ours
     struct sigaction sa;
     sa.sa_sigaction=(SigAction)StacktraceSignalHandler;
-    sa.sa_flags=SA_SIGINFO|SA_RESTART|SA_RESETHAND;
+    sa.sa_flags=SA_SIGINFO|SA_RESETHAND;
+# ifdef SA_RESTART
+    sa.sa_flags|=SA_RESTART;
+# endif
     sigemptyset(&sa.sa_mask);
 
     sigaction(SIGABRT,&sa,0);
diff --git a/Tests/QtAutogen/CMakeLists.txt b/Tests/QtAutogen/CMakeLists.txt
index 0821b45..d2116aa 100644
--- a/Tests/QtAutogen/CMakeLists.txt
+++ b/Tests/QtAutogen/CMakeLists.txt
@@ -64,9 +64,9 @@
   DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myotherinterface.h.in"
 )
 
-add_executable(QtAutogen main.cpp calwidget.cpp foo.cpp blub.cpp bar.cpp abc.cpp
+add_executable(QtAutogen main.cpp calwidget.cpp second_widget.cpp foo.cpp blub.cpp bar.cpp abc.cpp
                xyz.cpp yaf.cpp gadget.cpp $<TARGET_OBJECTS:privateSlot>
-               test.qrc resourcetester.cpp generated.cpp
+               test.qrc second_resource.qrc resourcetester.cpp generated.cpp
 )
 set_property(TARGET QtAutogen APPEND PROPERTY AUTOGEN_TARGET_DEPENDS generate_moc_input "${CMAKE_CURRENT_BINARY_DIR}/myotherinterface.h")
 
diff --git a/Tests/QtAutogen/resourcetester.cpp b/Tests/QtAutogen/resourcetester.cpp
index 43314e1..0c64d80 100644
--- a/Tests/QtAutogen/resourcetester.cpp
+++ b/Tests/QtAutogen/resourcetester.cpp
@@ -16,6 +16,8 @@
 {
   if (!QFile::exists(":/CMakeLists.txt"))
       qApp->exit(EXIT_FAILURE);
+  if (!QFile::exists(":/main.cpp"))
+      qApp->exit(EXIT_FAILURE);
 
   QTimer::singleShot(0, qApp, SLOT(quit()));
 }
diff --git a/Tests/QtAutogen/second_resource.qrc b/Tests/QtAutogen/second_resource.qrc
new file mode 100644
index 0000000..27bfb14
--- /dev/null
+++ b/Tests/QtAutogen/second_resource.qrc
@@ -0,0 +1,5 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+    <file>main.cpp</file>
+</qresource>
+</RCC>
diff --git a/Tests/QtAutogen/second_widget.cpp b/Tests/QtAutogen/second_widget.cpp
new file mode 100644
index 0000000..65ba962
--- /dev/null
+++ b/Tests/QtAutogen/second_widget.cpp
@@ -0,0 +1,14 @@
+
+#include "second_widget.h"
+#include "ui_second_widget.h"
+
+SecondWidget::SecondWidget(QWidget *parent)
+  : QWidget(parent), ui(new Ui::SecondWidget)
+{
+  ui->setupUi(this);
+}
+
+SecondWidget::~SecondWidget()
+{
+  delete ui;
+}
diff --git a/Tests/QtAutogen/second_widget.h b/Tests/QtAutogen/second_widget.h
new file mode 100644
index 0000000..fe4d175
--- /dev/null
+++ b/Tests/QtAutogen/second_widget.h
@@ -0,0 +1,19 @@
+
+#include <QWidget>
+
+namespace Ui
+{
+class SecondWidget;
+}
+
+class SecondWidget : public QWidget
+{
+  Q_OBJECT
+public:
+  explicit SecondWidget(QWidget *parent = 0);
+
+  ~SecondWidget();
+
+private:
+  Ui::SecondWidget* ui;
+};
diff --git a/Tests/QtAutogen/second_widget.ui b/Tests/QtAutogen/second_widget.ui
new file mode 100644
index 0000000..4effa58
--- /dev/null
+++ b/Tests/QtAutogen/second_widget.ui
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SecondWidget</class>
+ <widget class="QWidget" name="SecondWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <widget class="QPushButton" name="pushButton">
+   <property name="geometry">
+    <rect>
+     <x>80</x>
+     <y>20</y>
+     <width>94</width>
+     <height>24</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>PushButton</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt
index ff8194a..85a7a9d 100644
--- a/Tests/RunCMake/Syntax/Unquoted1-stderr.txt
+++ b/Tests/RunCMake/Syntax/Unquoted1-stderr.txt
@@ -1 +1 @@
-^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]$
+^\[\]\[=\]\[\$\$\(MV\)-DSTR=" \[="\[;\]\]\[$
diff --git a/Tests/RunCMake/Syntax/Unquoted1.cmake b/Tests/RunCMake/Syntax/Unquoted1.cmake
index 0344fbd..515161f 100644
--- a/Tests/RunCMake/Syntax/Unquoted1.cmake
+++ b/Tests/RunCMake/Syntax/Unquoted1.cmake
@@ -1 +1 @@
-message([] [=] [$ $(MV) -DSTR=" [=" [;])
+message([] [=] [$ $(MV) -DSTR=" [=" [;] ] [)
diff --git a/Utilities/KWIML/ABI.h.in b/Utilities/KWIML/ABI.h.in
index b71cdfb..21c9139 100644
--- a/Utilities/KWIML/ABI.h.in
+++ b/Utilities/KWIML/ABI.h.in
@@ -398,6 +398,10 @@
 #elif defined(__mips) || defined(__mips__) || defined(__MIPS__)
 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
 
+/* OpenRISC 1000 */
+#elif defined(__or1k__)
+# define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
+
 /* RS/6000 */
 #elif defined(__THW_RS600) || defined(_IBMR2) || defined(_POWER)
 # define @KWIML@_ABI_ENDIAN_ID @KWIML@_ABI_ENDIAN_ID_BIG
diff --git a/Utilities/cmcurl/hostip.c b/Utilities/cmcurl/hostip.c
index fd555ef..83f1564 100644
--- a/Utilities/cmcurl/hostip.c
+++ b/Utilities/cmcurl/hostip.c
@@ -609,7 +609,7 @@
   h = &buf->hostentry;
   h->h_addr_list = &buf->h_addr_list[0];
   addrentry = &buf->addrentry;
-#ifdef _CRAYC
+#ifdef _CRAY
   /* On UNICOS, s_addr is a bit field and for some reason assigning to it
    * doesn't work.  There must be a better fix than this ugly hack.
    */
diff --git a/bootstrap b/bootstrap
index 45f67cf..da84040 100755
--- a/bootstrap
+++ b/bootstrap
@@ -1474,9 +1474,11 @@
 # When bootstrapping on MinGW with MSYS we must convert the source
 # directory to a windows path.
 if ${cmake_system_mingw}; then
-    cmake_root_dir=`cd "${cmake_source_dir}"; pwd -W`
+    CMAKE_BOOTSTRAP_SOURCE_DIR=`cd "${cmake_source_dir}"; pwd -W`
+    CMAKE_BOOTSTRAP_BINARY_DIR=`cd "${cmake_binary_dir}"; pwd -W`
 else
-    cmake_root_dir="${cmake_source_dir}"
+    CMAKE_BOOTSTRAP_SOURCE_DIR="${cmake_source_dir}"
+    CMAKE_BOOTSTRAP_BINARY_DIR="${cmake_binary_dir}"
 fi
 
 # Write CMake version
@@ -1484,7 +1486,8 @@
 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_MINOR ${cmake_version_minor}"
 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION_PATCH ${cmake_version_patch}"
 cmake_report cmVersionConfig.h${_tmp} "#define CMake_VERSION \"${cmake_version}\""
-cmake_report cmConfigure.h${_tmp} "#define CMAKE_ROOT_DIR \"${cmake_root_dir}\""
+cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_SOURCE_DIR \"${CMAKE_BOOTSTRAP_SOURCE_DIR}\""
+cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP_BINARY_DIR \"${CMAKE_BOOTSTRAP_BINARY_DIR}\""
 cmake_report cmConfigure.h${_tmp} "#define CMAKE_DATA_DIR \"/bootstrap-not-insalled\""
 cmake_report cmConfigure.h${_tmp} "#define CMAKE_BOOTSTRAP"