Browse Source

ENH: Moved cache entry addition into cmMakefile::AddLibrary and AddExecutable so that commands do not have to add it explicitly.

Brad King 24 years ago
parent
commit
0829faa9e1
3 changed files with 12 additions and 11 deletions
  1. 0 5
      Source/cmAddExecutableCommand.cxx
  2. 0 6
      Source/cmAddLibraryCommand.cxx
  3. 12 0
      Source/cmMakefile.cxx

+ 0 - 5
Source/cmAddExecutableCommand.cxx

@@ -54,11 +54,6 @@ bool cmAddExecutableCommand::Invoke(std::vector<std::string>& args)
   std::vector<std::string> srclists(++s, args.end());
   
   m_Makefile->AddExecutable(args[0].c_str(),srclists); 
-  // Add an entry into the cache 
-  cmCacheManager::GetInstance()->
-    AddCacheEntry(args[0].c_str(),
-                  m_Makefile->GetCurrentOutputDirectory(),
-                  "Path to an executable", cmCacheManager::INTERNAL);
   return true;
 }
 

+ 0 - 6
Source/cmAddLibraryCommand.cxx

@@ -54,12 +54,6 @@ bool cmAddLibraryCommand::Invoke(std::vector<std::string>& args)
   std::vector<std::string> srclists(++s, args.end());
   
   m_Makefile->AddLibrary(args[0].c_str(),srclists);
-
-  // Add an entry into the cache 
-  cmCacheManager::GetInstance()->
-    AddCacheEntry(args[0].c_str(),
-                  m_Makefile->GetCurrentOutputDirectory(),
-                  "Path to a library", cmCacheManager::INTERNAL);
   return true;
 }
 

+ 12 - 0
Source/cmMakefile.cxx

@@ -470,6 +470,12 @@ void cmMakefile::AddLibrary(const char* lname, const std::vector<std::string> &s
   target.SetInAll(true);
   target.GetSourceLists() = srcs;
   m_Targets.insert(cmTargets::value_type(lname,target));
+
+  // Add an entry into the cache 
+  cmCacheManager::GetInstance()->
+    AddCacheEntry(lname,
+                  this->GetCurrentOutputDirectory(),
+                  "Path to a library", cmCacheManager::INTERNAL);
 }
 
 void cmMakefile::AddExecutable(const char *exeName, 
@@ -480,6 +486,12 @@ void cmMakefile::AddExecutable(const char *exeName,
   target.SetInAll(true);
   target.GetSourceLists() = srcs;
   m_Targets.insert(cmTargets::value_type(exeName,target));
+  
+  // Add an entry into the cache 
+  cmCacheManager::GetInstance()->
+    AddCacheEntry(exeName,
+                  this->GetCurrentOutputDirectory(),
+                  "Path to an executable", cmCacheManager::INTERNAL);
 }