From 75cf590b21d61e1c957e2afc345053a7980634a2 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Mon, 23 Aug 2004 14:33:22 -0400 Subject: [PATCH] ENH: Implement PreLoad.cmake feature for CMakeSetup --- Source/MFCDialog/CMakeSetupDialog.cpp | 13 +++++++++++++ Source/cmake.cxx | 18 ++++++++++++------ 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Source/MFCDialog/CMakeSetupDialog.cpp b/Source/MFCDialog/CMakeSetupDialog.cpp index 54604060f..ba6c28f53 100644 --- a/Source/MFCDialog/CMakeSetupDialog.cpp +++ b/Source/MFCDialog/CMakeSetupDialog.cpp @@ -956,6 +956,19 @@ void CMakeSetupDialog::LoadCacheFromDiskToGUI() if(m_WhereBuild != "") { cachem->LoadCache(m_WhereBuild); + cmCacheManager::CacheIterator itm = cachem->NewIterator(); + if ( itm.Find("CMAKE_HOME_DIRECTORY")) + { + std::string path = ConvertToWindowsPath(itm.GetValue()); + this->m_WhereSource = path.c_str(); + this->m_WhereSourceControl.SetWindowText(this->m_WhereSource); + this->OnChangeWhereSource(); + } + m_CMakeInstance->SetHomeDirectory(m_WhereSource); + m_CMakeInstance->SetStartDirectory(m_WhereSource); + m_CMakeInstance->SetHomeOutputDirectory(m_WhereBuild); + m_CMakeInstance->SetStartOutputDirectory(m_WhereBuild); + m_CMakeInstance->PreLoadCMakeFiles(); this->FillCacheGUIFromCacheManager(); cmCacheManager::CacheIterator it = cachem->GetCacheIterator("CMAKE_GENERATOR"); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index b8e3c2474..ca07acf23 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1182,16 +1182,22 @@ bool cmake::CacheVersionMatches() void cmake::PreLoadCMakeFiles() { std::string pre_load = this->GetHomeDirectory(); - pre_load += "/PreLoad.cmake"; - if ( cmSystemTools::FileExists(pre_load.c_str()) ) + if ( pre_load.size() > 0 ) { - this->ReadListFile(pre_load.c_str()); + pre_load += "/PreLoad.cmake"; + if ( cmSystemTools::FileExists(pre_load.c_str()) ) + { + this->ReadListFile(pre_load.c_str()); + } } pre_load = this->GetHomeOutputDirectory(); - pre_load += "/PreLoad.cmake"; - if ( cmSystemTools::FileExists(pre_load.c_str()) ) + if ( pre_load.size() > 0 ) { - this->ReadListFile(pre_load.c_str()); + pre_load += "/PreLoad.cmake"; + if ( cmSystemTools::FileExists(pre_load.c_str()) ) + { + this->ReadListFile(pre_load.c_str()); + } } }