[cmake-commits] alex committed cmFileCommand.cxx 1.78 1.79 cmFileCommand.h 1.21 1.22 cmFindBase.cxx 1.19 1.20 cmFindBase.h 1.9 1.10 cmIncludeCommand.cxx 1.18 1.19 cmIncludeCommand.h 1.14 1.15 cmInstallTargetGenerator.cxx 1.28 1.29 cmInstallTargetGenerator.h 1.9 1.10 cmMakefile.cxx 1.386 1.387 cmMakefile.h 1.200 1.201 cmTryRunCommand.cxx 1.23 1.24 cmUtilitySourceCommand.cxx 1.22 1.23 cmUtilitySourceCommand.h 1.10 1.11

cmake-commits at cmake.org cmake-commits at cmake.org
Thu May 17 13:20:46 EDT 2007


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv15479/Source

Modified Files:
	cmFileCommand.cxx cmFileCommand.h cmFindBase.cxx cmFindBase.h 
	cmIncludeCommand.cxx cmIncludeCommand.h 
	cmInstallTargetGenerator.cxx cmInstallTargetGenerator.h 
	cmMakefile.cxx cmMakefile.h cmTryRunCommand.cxx 
	cmUtilitySourceCommand.cxx cmUtilitySourceCommand.h 
Log Message:

ENH: merge CMake-CrossCompileBasic to HEAD
-add a RESULT_VARIABLE to INCLUDE()
-add CMAKE_TOOLCHAIN_FILE for specifiying your (potentially crosscompiling) toolchain
-have TRY_RUN() complain if you try to use it in crosscompiling mode (which were compiled but cannot run on this system)
-use CMAKE_EXECUTABLE_SUFFIX in TRY_RUN(), probably TRY_RUN won't be able to 
run the executables if they have a different suffix because they are
probably crosscompiled, but nevertheless it should be able to find them
-make several cmake variables presettable by the user: CMAKE_C/CXX_COMPILER, CMAKE_C/CXX_OUTPUT_EXTENSION, CMAKE_SYSTEM_NAME, CMAKE_SYSTEM_INFO_FILE
-support prefix for GNU toolchains (arm-elf-gcc, arm-elf-ar, arm-elf-strip etc.)
-move ranlib on OSX from the file command to a command in executed in cmake_install.cmake
-add support for stripping during install in cmake_install.cmake
-split out cl.cmake from Windows-cl.cmake, first (very incomplete) step to support MS crosscompiling tools
-remove stdio.h from the simple C program which checks if the compiler works, since this may not exist for some embedded platforms
-create a new CMakeFindBinUtils.cmake which collects the search fro ar, ranlib, strip, ld, link, install_name_tool and other tools like these
-add support for CMAKE_FIND_ROOT_PATH for all FIND_XXX commands, which is a
list of directories which will be prepended to all search directories, right
now as a cmake variable, turning it into a global cmake property may need
some more work
-remove cmTestTestHandler::TryExecutable(), it's unused
-split cmFileCommand::HandleInstall() into slightly smaller functions 

Alex


Index: cmFindBase.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindBase.cxx,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- cmFindBase.cxx	28 Dec 2006 20:31:47 -0000	1.19
+++ cmFindBase.cxx	17 May 2007 17:20:44 -0000	1.20
@@ -25,6 +25,7 @@
   this->NoCMakeEnvironmentPath = false;
   this->NoSystemEnvironmentPath = false;
   this->NoCMakeSystemPath = false;
+  this->FindRootPathMode = RootPathModeBoth;
   // default is to search frameworks first on apple
 #if defined(__APPLE__)
   this->SearchFrameworkFirst = true;
@@ -250,6 +251,24 @@
     return true;
     }
   this->AlreadyInCache = false; 
+  
+  
+  std::string findRootPathVar = "CMAKE_FIND_ROOT_PATH_MODE_";
+  findRootPathVar += this->CMakePathName;
+  std::string rootPathMode = this->Makefile->GetSafeDefinition(findRootPathVar.c_str());
+  if (rootPathMode=="NEVER")
+    {
+    this->FindRootPathMode = RootPathModeNoRootPath;
+    }
+  else if (rootPathMode=="ONLY")
+    {
+    this->FindRootPathMode = RootPathModeOnlyRootPath;
+    }
+  else if (rootPathMode=="BOTH")
+    {
+    this->FindRootPathMode = RootPathModeBoth;
+    }
+
   std::vector<std::string> userPaths;
   std::string doc;
   bool doingNames = true; // assume it starts with a name
@@ -328,6 +347,21 @@
       doingNames = false;
       this->NoCMakeSystemPath = true;
       }
+    else if (args[j] == "NO_CMAKE_FIND_ROOT_PATH")
+      {
+      compatibility = false;
+      this->FindRootPathMode = RootPathModeNoRootPath;
+      }
+    else if (args[j] == "ONLY_CMAKE_FIND_ROOT_PATH")
+      {
+      compatibility = false;
+      this->FindRootPathMode = RootPathModeOnlyRootPath;
+      }
+    else if (args[j] == "CMAKE_FIND_ROOT_PATH_BOTH")
+      {
+      compatibility = false;
+      this->FindRootPathMode = RootPathModeBoth;
+      }
     else
       {
       if(doingNames)
@@ -358,7 +392,7 @@
 
   if(this->VariableDocumentation.size() == 0)
     {
-    this->VariableDocumentation = "Whare can ";
+    this->VariableDocumentation = "Where can ";
     if(this->Names.size() == 0)
       {
       this->VariableDocumentation += "the (unknown) library be found";
@@ -392,6 +426,8 @@
       }
     }
   this->ExpandPaths(userPaths);
+  
+  this->HandleCMakeFindRootPath();
   return true;
 }
 
@@ -413,7 +449,7 @@
        !(this->SearchFrameworkOnly || this->SearchAppBundleOnly))
       {
       // Add CMAKE_*_PATH environment variables
-      this->AddEnvironmentVairables();
+      this->AddEnvironmentVariables();
       }
     if(!this->NoCMakePath && 
        !(this->SearchFrameworkOnly || this->SearchAppBundleOnly))
@@ -421,13 +457,13 @@
       // Add CMake varibles of the same name as the previous environment
       // varibles CMAKE_*_PATH to be used most of the time with -D
       // command line options
-      this->AddCMakeVairables();
+      this->AddCMakeVariables();
       }
     if(!this->NoSystemEnvironmentPath && 
        !(this->SearchFrameworkOnly || this->SearchAppBundleOnly))
       {
       // add System environment PATH and (LIB or INCLUDE)
-      this->AddSystemEnvironmentVairables();
+      this->AddSystemEnvironmentVariables();
       }
     if(!this->NoCMakeSystemPath && 
        !(this->SearchFrameworkOnly || this->SearchAppBundleOnly))
@@ -453,7 +489,46 @@
   this->AddPaths(paths);
 }
 
-void cmFindBase::AddEnvironmentVairables()
+void cmFindBase::HandleCMakeFindRootPath()
+{
+  if (this->FindRootPathMode == RootPathModeNoRootPath)
+    {
+    return;
+    }
+
+  const char* rootPath =  this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
+  if ((rootPath == 0) || (strlen(rootPath) == 0))
+    {
+    return;
+    }
+
+  std::vector<std::string> prefixes;
+  cmSystemTools::ExpandListArgument(rootPath, prefixes);
+
+  std::vector<std::string> unprefixedPaths=this->SearchPaths;
+  this->SearchPaths.clear();
+
+  for (std::vector<std::string>::const_iterator prefixIt = prefixes.begin();
+       prefixIt != prefixes.end();
+       ++prefixIt )
+    {
+    for (std::vector<std::string>::const_iterator it = unprefixedPaths.begin();
+       it != unprefixedPaths.end();
+       ++it )
+      {
+      std::string prefixedDir=*prefixIt;
+      prefixedDir+=*it;
+      this->SearchPaths.push_back(prefixedDir);
+      }
+    }
+
+  if (this->FindRootPathMode == RootPathModeBoth)
+    {
+    this->AddPaths(unprefixedPaths);
+    }
+}
+
+void cmFindBase::AddEnvironmentVariables()
 { 
   std::string var = "CMAKE_";
   var += this->CMakePathName;
@@ -547,7 +622,7 @@
    this->AddPaths(paths);
 }
 
-void cmFindBase::AddCMakeVairables()
+void cmFindBase::AddCMakeVariables()
 { 
   std::string var = "CMAKE_";
   var += this->CMakePathName;
@@ -576,7 +651,7 @@
   this->AddPaths(paths);
 }
 
-void cmFindBase::AddSystemEnvironmentVairables()
+void cmFindBase::AddSystemEnvironmentVariables()
 {
   // Add LIB or INCLUDE
   std::vector<std::string> paths;

Index: cmUtilitySourceCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmUtilitySourceCommand.cxx,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- cmUtilitySourceCommand.cxx	12 May 2006 18:12:13 -0000	1.22
+++ cmUtilitySourceCommand.cxx	17 May 2007 17:20:44 -0000	1.23
@@ -88,7 +88,7 @@
   // Construct the cache entry for the executable's location.
   std::string utilityExecutable =
     utilityDirectory+"/"+cmakeCFGout+"/"
-    +utilityName+cmSystemTools::GetExecutableExtension();
+    +utilityName+this->Makefile->GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
 
   // make sure we remove any /./ in the name
   cmSystemTools::ReplaceString(utilityExecutable, "/./", "/");

Index: cmFileCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.cxx,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- cmFileCommand.cxx	26 Apr 2007 13:56:04 -0000	1.78
+++ cmFileCommand.cxx	17 May 2007 17:20:44 -0000	1.79
@@ -1018,8 +1018,194 @@
 }
 
 //----------------------------------------------------------------------------
-bool cmFileCommand::HandleInstallCommand(
-  std::vector<std::string> const& args)
+void cmFileCommand::HandleInstallPermissions(cmFileInstaller& installer, 
+                              mode_t& permissions_file,
+                              mode_t& permissions_dir,
+                              int itype,
+                              bool use_given_permissions_file,
+                              bool use_given_permissions_dir,
[...1017 lines suppressed...]
-        // Perform post-installation processing on the file depending
-        // on its type.
-#if defined(__APPLE_CC__)
-        // Static libraries need ranlib on this platform.
-        if(itype == cmTarget::STATIC_LIBRARY)
-          {
-          std::string ranlib = "ranlib ";
-          ranlib += cmSystemTools::ConvertToOutputPath(toFile.c_str());
-          if(!cmSystemTools::RunSingleCommand(ranlib.c_str()))
-            {
-            std::string err = "ranlib failed: ";
-            err += ranlib;
-            this->SetError(err.c_str());
-            return false;
-            }
-          }
-#endif
         }
       else if(!optional)
         {

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- cmMakefile.h	13 Mar 2007 19:18:27 -0000	1.200
+++ cmMakefile.h	17 May 2007 17:20:44 -0000	1.201
@@ -72,7 +72,9 @@
   /**
    * Read and parse a CMakeLists.txt file.
    */
-  bool ReadListFile(const char* listfile, const char* external= 0); 
+  bool ReadListFile(const char* listfile, 
+                    const char* external= 0, 
+                    std::string* fullPath= 0); 
 
   /**
    * Add a function blocker to this makefile

Index: cmTryRunCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmTryRunCommand.cxx,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- cmTryRunCommand.cxx	3 May 2007 19:25:41 -0000	1.23
+++ cmTryRunCommand.cxx	17 May 2007 17:20:44 -0000	1.24
@@ -18,13 +18,20 @@
 #include "cmCacheManager.h"
 #include "cmTryCompileCommand.h"
 
-// cmExecutableCommand
+// cmTryRunCommand
 bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
 {
   if(argv.size() < 4)
     {
     return false;
     }
+    
+  if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))
+    {
+    this->SetError("doesn't work when crosscompiling.");
+    cmSystemTools::SetFatalErrorOccured();
+    return false;
+    }
 
   // build an arg list for TryCompile and extract the runArgs
   std::vector<std::string> tryCompile;
@@ -75,10 +82,11 @@
     {
     int retVal = -1;
     std::string output;
+    std::string executableSuffix=this->Makefile->GetDefinition("CMAKE_EXECUTABLE_SUFFIX");
     std::string command1 = binaryDirectory;
     std::vector<std::string> attemptedPaths;
     command1 += "/cmTryCompileExec";
-    command1 += cmSystemTools::GetExecutableExtension();
+    command1 += executableSuffix;
     std::string fullPath;
     if(cmSystemTools::FileExists(command1.c_str()))
       {
@@ -97,7 +105,7 @@
         command1 += "/";
         command1 += config;
         command1 += "/cmTryCompileExec";
-        command1 += cmSystemTools::GetExecutableExtension();
+        command1 += executableSuffix;
         if(cmSystemTools::FileExists(command1.c_str()))
           {
           fullPath = cmSystemTools::CollapseFullPath(command1.c_str());
@@ -110,7 +118,7 @@
       {
       command1 = binaryDirectory;
       command1 += "/Debug/cmTryCompileExec";
-      command1 += cmSystemTools::GetExecutableExtension();
+      command1 += executableSuffix;
       if(cmSystemTools::FileExists(command1.c_str()))
         {
         fullPath = cmSystemTools::CollapseFullPath(command1.c_str());
@@ -122,7 +130,7 @@
       {
       command1 = binaryDirectory;
       command1 += "/Development/cmTryCompileExec";
-      command1 += cmSystemTools::GetExecutableExtension();
+      command1 += executableSuffix;
       if(cmSystemTools::FileExists(command1.c_str()))
         {
         fullPath = cmSystemTools::CollapseFullPath(command1.c_str());

Index: cmFindBase.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindBase.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cmFindBase.h	28 Dec 2006 20:31:47 -0000	1.9
+++ cmFindBase.h	17 May 2007 17:20:44 -0000	1.10
@@ -39,16 +39,20 @@
   virtual const char* GetFullDocumentation()
     {return this->GenericDocumentation.c_str();}
 
+  enum RootPathMode { RootPathModeBoth, RootPathModeOnlyRootPath, RootPathModeNoRootPath };
+  
 protected:
   void PrintFindStuff();
   void ExpandPaths(std::vector<std::string> userPaths);
+  void HandleCMakeFindRootPath();
+  
   // add to the SearchPaths
   void AddPaths(std::vector<std::string>& paths);
   void AddFrameWorkPaths();
   void AddAppBundlePaths();
-  void AddEnvironmentVairables();
-  void AddCMakeVairables();
-  void AddSystemEnvironmentVairables();
+  void AddEnvironmentVariables();
+  void AddCMakeVariables();
+  void AddSystemEnvironmentVariables();
   void AddCMakeSystemVariables();
   void ExpandRegistryAndCleanPath(std::vector<std::string>& paths);
   // see if the VariableName is already set in the cache,
@@ -75,6 +79,7 @@
   bool NoCMakeEnvironmentPath;
   bool NoSystemEnvironmentPath;
   bool NoCMakeSystemPath;
+  RootPathMode FindRootPathMode;
   
   bool SearchFrameworkFirst;
   bool SearchFrameworkOnly;

Index: cmFileCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFileCommand.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmFileCommand.h	25 Apr 2007 21:22:07 -0000	1.21
+++ cmFileCommand.h	17 May 2007 17:20:44 -0000	1.22
@@ -19,6 +19,8 @@
 
 #include "cmCommand.h"
 
+struct cmFileInstaller;
+
 /** \class cmFileCommand
  * \brief Command for manipulation of files
  *
@@ -146,11 +148,45 @@
   bool HandleStringsCommand(std::vector<std::string> const& args);
   bool HandleGlobCommand(std::vector<std::string> const& args, bool recurse);
   bool HandleMakeDirectoryCommand(std::vector<std::string> const& args);
-  bool HandleInstallCommand(std::vector<std::string> const& args);
+  
   bool HandleRelativePathCommand(std::vector<std::string> const& args);
   bool HandleCMakePathCommand(std::vector<std::string> const& args,
                               bool nativePath);
   void ComputeVersionedName(std::string& name, const char* version);
+  
+  // FILE(INSTALL ...) related functions
+  bool HandleInstallCommand(std::vector<std::string> const& args);
+  bool ParseInstallArgs(std::vector<std::string> const& args,
+                        cmFileInstaller& installer,
+                        std::set<cmStdString>& components,
+                        std::set<cmStdString>& configurations,
+                        std::map<cmStdString, const char*>& properties,
+                        int& itype,
+                        std::string& destination,
+                        std::string& rename,
+                        std::vector<std::string>& files,
+                        bool& optional
+                       );
+  bool DoInstall(cmFileInstaller& installer,
+                 const std::set<cmStdString>& components,
+                 const std::set<cmStdString>& configurations,
+                 std::map<cmStdString, const char*>& properties,
+                 const int itype,
+                 const std::string& rename,
+                 const std::string& destination,
+                 const std::vector<std::string>& files,
+                 const bool optional
+                );
+  void GetTargetTypeFromString(const std::string& stype, int& itype) const;
+  bool HandleInstallDestination(cmFileInstaller& installer, 
+                                std::string& destination);
+  void HandleInstallPermissions(cmFileInstaller& installer, 
+                                mode_t& permissions_file,
+                                mode_t& permissions_dir,
+                                int itype,
+                                bool use_given_permissions_file,
+                                bool use_given_permissions_dir,
+                                bool use_source_permissions) const;
 };
 
 

Index: cmIncludeCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeCommand.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cmIncludeCommand.cxx	11 May 2006 19:50:11 -0000	1.18
+++ cmIncludeCommand.cxx	17 May 2007 17:20:44 -0000	1.19
@@ -20,21 +20,55 @@
 // cmIncludeCommand
 bool cmIncludeCommand::InitialPass(std::vector<std::string> const& args)
 {
-  if (args.size()< 1 || args.size() > 2)
+  if (args.size()< 1 || args.size() > 4)
     {
       this->SetError("called with wrong number of arguments.  "
                      "Include only takes one file.");
       return false;
     }
   bool optional = false;
-
-  std::string fname = args[0].c_str();
-
-  if(args.size() == 2)
+  std::string fname = args[0];
+  std::string resultVarName;
+  
+  for (unsigned int i=1; i<args.size(); i++)
     {
-    optional = args[1] == "OPTIONAL";
+    if (args[i] == "OPTIONAL") 
+      {
+      if (optional)
+        {
+        this->SetError("called with invalid arguments: OPTIONAL used twice");
+        return false;
+        }
+      optional = true;
+      }
+    else if(args[i] == "RESULT_VARIABLE")
+      {
+      if (resultVarName.size() > 0)
+        {
+        this->SetError("called with invalid arguments: "
+            "only one result variable allowed");
+        return false;
+        }
+      if(++i < args.size())
+        {
+        resultVarName = args[i];
+        }
+      else
+        {
+        this->SetError("called with no value for RESULT_VARIABLE.");
+        return false;
+        }
+      }
+      else if(i > 1)  // compat.: in previous cmake versions the second 
+                      // parameter was ignore if it wasn't "OPTIONAL"
+        {
+        std::string errorText = "called with invalid argument: ";  
+        errorText += args[i];
+        this->SetError(errorText.c_str());
+        return false;
+        }
     }
-  
+
   if(!cmSystemTools::FileIsFullPath(fname.c_str()))
     {
     // Not a path. Maybe module.
@@ -46,9 +80,18 @@
       fname = mfile.c_str();
       }
     }
+  std::string fullFilePath;
   bool readit = 
     this->Makefile->ReadListFile( this->Makefile->GetCurrentListFile(), 
-                                  fname.c_str() );
+                                  fname.c_str(), &fullFilePath );
+  
+  // add the location of the included file if a result variable was given
+  if (resultVarName.size())
+    {
+      this->Makefile->AddDefinition(resultVarName.c_str(), 
+                                    readit?fullFilePath.c_str():"NOTFOUND");
+    }
+
   if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured())
     {
     std::string m = "Could not find include file: ";

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- cmInstallTargetGenerator.cxx	19 Mar 2007 14:00:35 -0000	1.28
+++ cmInstallTargetGenerator.cxx	17 May 2007 17:20:44 -0000	1.29
@@ -19,7 +19,6 @@
 #include "cmGlobalGenerator.h"
 #include "cmLocalGenerator.h"
 #include "cmMakefile.h"
-#include "cmTarget.h"
 #include "cmake.h"
 
 //----------------------------------------------------------------------------
@@ -171,12 +170,21 @@
                        no_rename, literal_args.c_str());
 
   // Fix the install_name settings in installed binaries.
-  if(type == cmTarget::SHARED_LIBRARY ||
+  if((type == cmTarget::SHARED_LIBRARY ||
      type == cmTarget::MODULE_LIBRARY ||
-     type == cmTarget::EXECUTABLE)
+     type == cmTarget::EXECUTABLE) &&
+     this->Target->GetMakefile()->IsSet("CMAKE_INSTALL_NAME_TOOL"))
     {
     this->AddInstallNamePatchRule(os, destination.c_str());
     }
+
+    std::string destinationFilename = destination;
+    destinationFilename += "/";
+    destinationFilename += cmSystemTools::GetFilenameName(fromFile);
+
+    this->AddRanlibRule(os, type, destinationFilename);
+
+    this->AddStripRule(os, destinationFilename);
 }
 
 //----------------------------------------------------------------------------
@@ -417,7 +425,9 @@
     component_test += this->Component;
     component_test += ")$\"";
     os << "IF(" << component_test << ")\n";
-    os << "  EXECUTE_PROCESS(COMMAND install_name_tool";
+    os << "  EXECUTE_PROCESS(COMMAND \"";
+    os <<this->Target->GetMakefile()->GetDefinition("CMAKE_INSTALL_NAME_TOOL");
+    os << "\"";
     if(!new_id.empty())
       {
       os << "\n    -id \"" << new_id << "\"";
@@ -433,3 +443,54 @@
     os << "ENDIF(" << component_test << ")\n";
     }
 }
+
+void cmInstallTargetGenerator::AddStripRule(std::ostream& os, 
+                                            const std::string& destinationFilename)
+{
+
+  // Don't handle OSX Bundles.
+  if(this->Target->GetMakefile()->IsOn("APPLE") &&
+     this->Target->GetPropertyAsBool("MACOSX_BUNDLE"))
+    {
+    return;
+    }
+
+  if(! this->Target->GetMakefile()->IsSet("CMAKE_STRIP"))
+    {
+    return;
+    }
+
+  os << "IF(CMAKE_INSTALL_DO_STRIP)\n";
+  os << "  EXECUTE_PROCESS(COMMAND \"";
+  os << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP");
+  os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
+  os << "ENDIF(CMAKE_INSTALL_DO_STRIP)\n";
+}
+
+void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, 
+                                             cmTarget::TargetType type,
+                                             const std::string& destinationFilename)
+{
+  // Static libraries need ranlib on this platform.
+  if(type != cmTarget::STATIC_LIBRARY)
+    {
+    return;
+    }
+
+  // Perform post-installation processing on the file depending
+  // on its type.
+  if(!this->Target->GetMakefile()->IsOn("APPLE"))
+    {
+    return;
+    }
+
+  std::string ranlib = this->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB");
+  if (!ranlib.size())
+    {
+    return;
+    }
+
+  os << "EXECUTE_PROCESS(COMMAND \"";
+  os << ranlib;
+  os << "\" \"$ENV{DESTDIR}" << destinationFilename << "\" )\n";
+}

Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- cmInstallTargetGenerator.h	5 Oct 2006 15:31:56 -0000	1.9
+++ cmInstallTargetGenerator.h	17 May 2007 17:20:44 -0000	1.10
@@ -18,8 +18,7 @@
 #define cmInstallTargetGenerator_h
 
 #include "cmInstallGenerator.h"
-
-class cmTarget;
+#include "cmTarget.h"
 
 /** \class cmInstallTargetGenerator
  * \brief Generate target installation rules.
@@ -45,6 +44,10 @@
   std::string GetScriptReference(cmTarget* target, const char* place,
                                  bool useSOName);
   void AddInstallNamePatchRule(std::ostream& os, const char* destination);
+  void AddStripRule(std::ostream& os, const std::string& destinationFilename);
+  void AddRanlibRule(std::ostream& os, cmTarget::TargetType type,
+                     const std::string& destinationFilename);
+
   cmTarget* Target;
   std::string Destination;
   bool ImportLibrary;

Index: cmUtilitySourceCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmUtilitySourceCommand.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cmUtilitySourceCommand.h	18 Mar 2005 15:41:41 -0000	1.10
+++ cmUtilitySourceCommand.h	17 May 2007 17:20:44 -0000	1.11
@@ -72,7 +72,14 @@
       "is assumed that the source tree of the utility will have been built "
       "before it is needed.";
     }
-  
+
+  /** This command is kept for compatibility with older CMake versions. */
+  virtual bool IsDiscouraged()
+    {
+    return true;
+    }
+
+
   cmTypeMacro(cmUtilitySourceCommand, cmCommand);
 };
 

Index: cmIncludeCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeCommand.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cmIncludeCommand.h	16 Nov 2005 19:11:09 -0000	1.14
+++ cmIncludeCommand.h	17 May 2007 17:20:44 -0000	1.15
@@ -68,12 +68,14 @@
   virtual const char* GetFullDocumentation()
     {
     return
-      "  INCLUDE(file1 [OPTIONAL])\n"
-      "  INCLUDE(module [OPTIONAL])\n"
+      "  INCLUDE(file1 [OPTIONAL] [RESULT_VARIABLE <VAR>])\n"
+      "  INCLUDE(module [OPTIONAL] [RESULT_VARIABLE <VAR>])\n"
       "Reads CMake listfile code from the given file.  Commands in the file "
       "are processed immediately as if they were written in place of the "
       "INCLUDE command.  If OPTIONAL is present, then no error "
-      "is raised if the file does not exist.\n"
+      "is raised if the file does not exist.  If RESULT_VARIABLE is given "
+      "the variable will be set to the full filename which "
+      "has been included or NOTFOUND if it failed.\n"
       "If a module is specified instead of a file, the file with name "
       "<modulename>.cmake is searched in the CMAKE_MODULE_PATH.";
     }

Index: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.386
retrieving revision 1.387
diff -u -d -r1.386 -r1.387
--- cmMakefile.cxx	9 May 2007 12:25:45 -0000	1.386
+++ cmMakefile.cxx	17 May 2007 17:20:44 -0000	1.387
@@ -370,7 +370,8 @@
 // Parse the given CMakeLists.txt file executing all commands
 //
 bool cmMakefile::ReadListFile(const char* filename_in, 
-                              const char *external_in)
+                              const char *external_in,
+                              std::string* fullPath)
 {
   std::string currentParentFile
     = this->GetSafeDefinition("CMAKE_PARENT_LIST_FILE");
@@ -446,12 +447,19 @@
       
   // push the listfile onto the stack
   this->ListFileStack.push_back(filenametoread);
-
+  if(fullPath!=0)
+    {
+    *fullPath=filenametoread;
+    }
   cmListFile cacheFile;
   if( !cacheFile.ParseFile(filenametoread, requireProjectCommand) )
     {
     // pop the listfile off the stack
     this->ListFileStack.pop_back();
+    if(fullPath!=0)
+      {
+      fullPath->clear();
+      }
     this->AddDefinition("CMAKE_PARENT_LIST_FILE", currentParentFile.c_str());
     this->AddDefinition("CMAKE_CURRENT_LIST_FILE", currentFile.c_str());
     return false;



More information about the Cmake-commits mailing list