ENH: Added generation of internal CMAKE cache entry with path to command-line CMake executable.

This commit is contained in:
Brad King 2001-05-03 16:55:41 -04:00
parent 5079efdc68
commit 5e4a89b1b9
3 changed files with 45 additions and 1 deletions

View File

@ -116,6 +116,21 @@ int main(int ac, char** av)
// Read and parse the input makefile // Read and parse the input makefile
mf.MakeStartDirectoriesCurrent(); mf.MakeStartDirectoriesCurrent();
cmCacheManager::GetInstance()->LoadCache(&mf); cmCacheManager::GetInstance()->LoadCache(&mf);
// Make sure the internal "CMAKE" cache entry is set.
const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue("CMAKE");
if(!cacheValue)
{
// Find our own exectuable.
std::string cMakeSelf = cmSystemTools::FindProgram(av[0]);
// Save the value in the cache
cmCacheManager::GetInstance()->AddCacheEntry("CMAKE",
cMakeSelf.c_str(),
"Path to CMake executable.",
cmCacheManager::INTERNAL);
}
// Transfer the cache into the makefile's definitions.
cmCacheManager::GetInstance()->DefineCache(&mf); cmCacheManager::GetInstance()->DefineCache(&mf);
if(!mf.ReadListFile(av[1])) if(!mf.ReadListFile(av[1]))
{ {

View File

@ -104,6 +104,20 @@ int main(int ac, char** av)
makefile.SetMakefileGenerator(pg); makefile.SetMakefileGenerator(pg);
makefile.MakeStartDirectoriesCurrent(); makefile.MakeStartDirectoriesCurrent();
cmCacheManager::GetInstance()->LoadCache(&makefile); cmCacheManager::GetInstance()->LoadCache(&makefile);
// Make sure the internal "CMAKE" cache entry is set.
const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue("CMAKE");
if(!cacheValue)
{
// Find our own exectuable.
std::string cMakeSelf = "\""+cmSystemTools::FindProgram(av[0])+"\"";
// Save the value in the cache
cmCacheManager::GetInstance()->AddCacheEntry("CMAKE",
cMakeSelf.c_str(),
"Path to CMake executable.",
cmCacheManager::INTERNAL);
}
cmCacheManager::GetInstance()->DefineCache(&makefile); cmCacheManager::GetInstance()->DefineCache(&makefile);
makefile.ReadListFile(av[1]); makefile.ReadListFile(av[1]);
makefile.GenerateMakefile(); makefile.GenerateMakefile();

View File

@ -469,7 +469,6 @@ void CMakeSetupDialog::OnChangeWhereBuild()
{ {
m_CacheEntriesList.RemoveAll(); m_CacheEntriesList.RemoveAll();
} }
} }
void CMakeSetupDialog::OnChangeWhereSource() void CMakeSetupDialog::OnChangeWhereSource()
@ -483,6 +482,22 @@ void CMakeSetupDialog::LoadCacheFromDiskToGUI()
if(m_WhereBuild != "") if(m_WhereBuild != "")
{ {
cmCacheManager::GetInstance()->LoadCache(m_WhereBuild); cmCacheManager::GetInstance()->LoadCache(m_WhereBuild);
// Make sure the internal "CMAKE" cache entry is set.
const char* cacheValue = cmCacheManager::GetInstance()->GetCacheValue("CMAKE");
if(!cacheValue)
{
// Find our own exectuable.
std::string cMakeCMD = "\""+cmSystemTools::GetProgramPath(_pgmptr);
cMakeCMD += "/CMakeSetupCMD.exe\"";
// Save the value in the cache
cmCacheManager::GetInstance()->AddCacheEntry("CMAKE",
cMakeCMD.c_str(),
"Path to CMake executable.",
cmCacheManager::INTERNAL);
}
this->FillCacheGUIFromCacheManager(); this->FillCacheGUIFromCacheManager();
} }
} }