diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-18 18:19:39 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2002-04-18 18:19:39 (GMT) |
commit | 5ba411dd641d4410d46c6dac9dedd542573b58f8 (patch) | |
tree | a9ba3dc256ba272de6f17a1e529f572b935413fe /Source/cmake.cxx | |
parent | fe4eb49014f31a7dbe49d2c253e50a0cc5514b56 (diff) | |
download | CMake-5ba411dd641d4410d46c6dac9dedd542573b58f8.zip CMake-5ba411dd641d4410d46c6dac9dedd542573b58f8.tar.gz CMake-5ba411dd641d4410d46c6dac9dedd542573b58f8.tar.bz2 |
ENH: check for mis-matched source directories
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index d5faaa5..2023536 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -356,6 +356,31 @@ int cmake::Generate(const std::vector<std::string>& args, bool buildMakefiles) // Read and parse the input makefile mf.MakeStartDirectoriesCurrent(); cmCacheManager::GetInstance()->LoadCache(&mf); + if(mf.GetDefinition("CMAKE_START_DIRECTORY")) + { + std::string cacheStart = + cmSystemTools::CollapseFullPath(mf.GetDefinition("CMAKE_START_DIRECTORY")); + std::string currentStart = + cmSystemTools::CollapseFullPath(mf.GetStartDirectory()); +#ifdef _WIN32 + cacheStart = cmSystemTools::LowerCase(cacheStart); + currentStart = cmSystemTools::LowerCase(currentStart); +#endif + if(cacheStart != currentStart) + { + std::string message = "Error: source directory: "; + message += currentStart; + message += "\nDoes not match source directory used to generate cache: "; + message += cacheStart; + message += "\nRe-run cmake with a different source directory."; + cmSystemTools::Error(message.c_str()); + return -1; + } + } + mf.AddCacheDefinition("CMAKE_START_DIRECTORY", mf.GetStartDirectory(), + "Start directory with the top level CMakeLists.txt file for this project", + cmCacheManager::INTERNAL); + // extract command line arguments that might add cache entries this->SetCacheArgs(mf, args); // no generator specified on the command line |