[cmake-commits] alex committed cmFindBase.cxx 1.19.2.1 1.19.2.2 cmIncludeCommand.cxx 1.18.2.1 1.18.2.2 cmMakefile.cxx 1.383 1.383.2.1 cmMakefile.h 1.200 1.200.2.1

cmake-commits at cmake.org cmake-commits at cmake.org
Fri May 11 16:25:11 EDT 2007


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

Modified Files:
      Tag: CMake-CrossCompileBasic
	cmFindBase.cxx cmIncludeCommand.cxx cmMakefile.cxx 
	cmMakefile.h 
Log Message:

ENH: 
-search CMAKE_TOOLCHAIN_FILE at first relative to the CMAKE_BINARY_DIR
-if in CMAKE_C_COMPILER only the basename of the compiler without path was given then find the path
-CMAKE_FIND_PREFIX can now be a list of directories
-via CMAKE_PROGRAM_FIND_PREFIX_MODE, CMAKE_LIBRARY_FIND_PREFIX_MODE and CMAKE_INCLUDE_FIND_PREFIX_MODE 
the default behaviour for these 3 types can be adjusted:
*at first the directories with the prefixes, then without prefixes (default, unset)
*only the prefixes (useful for libs and headers, "ONLY")
*only without the prefixes (useful for programs, "NEVER")

Alex


Index: cmFindBase.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmFindBase.cxx,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -u -d -r1.19.2.1 -r1.19.2.2
--- cmFindBase.cxx	1 May 2007 20:25:03 -0000	1.19.2.1
+++ cmFindBase.cxx	11 May 2007 20:25:09 -0000	1.19.2.2
@@ -251,6 +251,21 @@
     return true;
     }
   this->AlreadyInCache = false; 
+  
+  
+  std::string findPrefixVar = "CMAKE_";
+  findPrefixVar += this->CMakePathName;
+  findPrefixVar += "_FIND_PREFIX_MODE";
+  std::string prefixMode = this->Makefile->GetSafeDefinition(findPrefixVar.c_str());
+  if (prefixMode=="NEVER")
+    {
+    this->FindPrefixMode = PrefixModeNoPrefix;
+    }
+  else if (prefixMode=="ONLY")
+    {
+    this->FindPrefixMode = PrefixModeOnlyPrefix;
+    }
+
   std::vector<std::string> userPaths;
   std::string doc;
   bool doingNames = true; // assume it starts with a name
@@ -479,17 +494,24 @@
     return;
     }
 
+  std::vector<std::string> prefixes;
+  cmSystemTools::ExpandListArgument(prefix, prefixes);
+
   std::vector<std::string> unprefixedPaths=this->SearchPaths;
   this->SearchPaths.clear();
 
-  std::vector<std::string>::iterator it;
-  for ( it = unprefixedPaths.begin();
-        it != unprefixedPaths.end();
-        ++it )
+  for (std::vector<std::string>::const_iterator prefixIt = prefixes.begin();
+       prefixIt != prefixes.end();
+       ++prefixIt )
     {
-    std::string prefixedDir=prefix;
-    prefixedDir+=*it;
-    this->SearchPaths.push_back(prefixedDir);
+    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->FindPrefixMode == PrefixModeBoth)

Index: cmIncludeCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmIncludeCommand.cxx,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -d -r1.18.2.1 -r1.18.2.2
--- cmIncludeCommand.cxx	11 May 2007 15:55:01 -0000	1.18.2.1
+++ cmIncludeCommand.cxx	11 May 2007 20:25:09 -0000	1.18.2.2
@@ -60,15 +60,16 @@
       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?fname.c_str():"NOTFOUND");
+                                    readit?fullFilePath.c_str():"NOTFOUND");
     }
 
   if(!optional && !readit && !cmSystemTools::GetFatalErrorOccured())

Index: cmMakefile.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.h,v
retrieving revision 1.200
retrieving revision 1.200.2.1
diff -u -d -r1.200 -r1.200.2.1
--- cmMakefile.h	13 Mar 2007 19:18:27 -0000	1.200
+++ cmMakefile.h	11 May 2007 20:25:09 -0000	1.200.2.1
@@ -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: cmMakefile.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmMakefile.cxx,v
retrieving revision 1.383
retrieving revision 1.383.2.1
diff -u -d -r1.383 -r1.383.2.1
--- cmMakefile.cxx	11 Apr 2007 19:13:05 -0000	1.383
+++ cmMakefile.cxx	11 May 2007 20:25:09 -0000	1.383.2.1
@@ -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");
@@ -447,9 +448,17 @@
   // push the listfile onto the stack
   this->ListFileStack.push_back(filenametoread);
   
+  if(fullPath!=0)
+    {
+    *fullPath=filenametoread;
+    }
   cmListFile cacheFile;
   if( !cacheFile.ParseFile(filenametoread, requireProjectCommand) )
     {
+    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