MCPcopy Create free account
hub / github.com/Kitware/CMake / DoPreConfigureChecks

Method DoPreConfigureChecks

Source/cmake.cxx:2268–2308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2266}
2267
2268int cmake::DoPreConfigureChecks()
2269{
2270 // Make sure the Source directory contains a CMakeLists.txt file.
2271 std::string srcList =
2272 cmStrCat(this->GetHomeDirectory(), '/', this->CMakeListName);
2273 if (!cmSystemTools::FileExists(srcList)) {
2274 std::ostringstream err;
2275 if (cmSystemTools::FileIsDirectory(this->GetHomeDirectory())) {
2276 err << "The source directory \"" << this->GetHomeDirectory()
2277 << "\" does not appear to contain " << this->CMakeListName << ".\n";
2278 } else if (cmSystemTools::FileExists(this->GetHomeDirectory())) {
2279 err << "The source directory \"" << this->GetHomeDirectory()
2280 << "\" is a file, not a directory.\n";
2281 } else {
2282 err << "The source directory \"" << this->GetHomeDirectory()
2283 << "\" does not exist.\n";
2284 }
2285 err << "Specify --help for usage, or press the help button on the CMake "
2286 "GUI.";
2287 cmSystemTools::Error(err.str());
2288 return -2;
2289 }
2290
2291 // do a sanity check on some values
2292 if (cmValue dir =
2293 this->State->GetInitializedCacheValue("CMAKE_HOME_DIRECTORY")) {
2294 std::string cacheStart = cmStrCat(*dir, '/', this->CMakeListName);
2295 if (!cmSystemTools::SameFile(cacheStart, srcList)) {
2296 std::string message =
2297 cmStrCat("The source \"", srcList, "\" does not match the source \"",
2298 cacheStart,
2299 "\" used to generate cache. Re-run cmake with a different "
2300 "source directory.");
2301 cmSystemTools::Error(message);
2302 return -2;
2303 }
2304 } else {
2305 return 0;
2306 }
2307 return 1;
2308}
2309struct SaveCacheEntry
2310{
2311 std::string key;

Callers 2

ActualConfigureMethod · 0.95
ConfigureMethod · 0.80

Calls 5

strMethod · 0.80
cmStrCatFunction · 0.70
ErrorClass · 0.70
FileExistsFunction · 0.50

Tested by

no test coverage detected