summaryrefslogtreecommitdiffstats
path: root/Source/cmake.cxx
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-09-17 17:59:58 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-09-17 17:59:58 (GMT)
commit2a68d21e8550b64641769b11691d74ae9bb37217 (patch)
tree311f400a6633897fdeab49470985d19dbd78dfe6 /Source/cmake.cxx
parente68e917d9fbfa88426d3fc69f9eab4f36e9c585d (diff)
downloadCMake-2a68d21e8550b64641769b11691d74ae9bb37217.zip
CMake-2a68d21e8550b64641769b11691d74ae9bb37217.tar.gz
CMake-2a68d21e8550b64641769b11691d74ae9bb37217.tar.bz2
cleaned up some of the cmake interface
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r--Source/cmake.cxx50
1 files changed, 29 insertions, 21 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 2c86c4d..9042b4a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -625,15 +625,8 @@ void cmake::SetGlobalGenerator(cmGlobalGenerator *gg)
gg->SetCMakeInstance(this);
}
-int cmake::Configure(const char *arg0, const std::vector<std::string>* args)
+int cmake::Configure()
{
- // Read in the cache, but not for a try compile
- // because there will be no cache
- if (!m_InTryCompile)
- {
- m_CacheManager->LoadCache(this->GetHomeOutputDirectory());
- }
-
// do a sanity check on some values
if(m_CacheManager->GetCacheValue("CMAKE_HOME_DIRECTORY"))
{
@@ -661,18 +654,6 @@ int cmake::Configure(const char *arg0, const std::vector<std::string>* args)
cmCacheManager::INTERNAL);
}
- // extract command line arguments that might add cache entries
- if (args)
- {
- this->SetCacheArgs(*args);
- }
-
- // setup CMAKE_ROOT and CMAKE_COMMAND
- if(!this->AddCMakePaths(arg0))
- {
- return -3;
- }
-
// no generator specified on the command line
if(!m_GlobalGenerator)
{
@@ -785,6 +766,15 @@ int cmake::Run(const std::vector<std::string>& args)
// Process the arguments
this->SetArgs(args);
+ // set the cmake command
+ m_CMakeCommand = args[0];
+
+ // load the cache
+ this->LoadCache();
+
+ // Add any cache args
+ this->SetCacheArgs(args);
+
// if we are local do the local thing, otherwise do global
if (m_Local)
{
@@ -792,7 +782,7 @@ int cmake::Run(const std::vector<std::string>& args)
}
// otherwise global
- int ret = this->Configure(args[0].c_str(),&args);
+ int ret = this->Configure();
if (ret)
{
return ret;
@@ -892,3 +882,21 @@ void cmake::AddDefaultCommands()
}
}
+int cmake::LoadCache()
+{
+ m_CacheManager->LoadCache(this->GetHomeOutputDirectory());
+
+ if (m_CMakeCommand.size() < 2)
+ {
+ cmSystemTools::Error("cmake command was not specified prior to loading the cache in cmake.cxx");
+ return -1;
+ }
+
+ // setup CMAKE_ROOT and CMAKE_COMMAND
+ if(!this->AddCMakePaths(m_CMakeCommand.c_str()))
+ {
+ return -3;
+ }
+ return 0;
+}
+