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

Method Open

Source/cmake.cxx:4132–4174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4130}
4131
4132bool cmake::Open(std::string const& dir, DryRun dryRun)
4133{
4134 if (!cmSystemTools::FileIsDirectory(dir)) {
4135 if (dryRun == DryRun::No) {
4136 std::cerr << "Error: " << dir << " is not a directory\n";
4137 }
4138 return false;
4139 }
4140
4141 std::string cachePath = FindCacheFile(dir);
4142 if (!this->LoadCache(cachePath)) {
4143 std::cerr
4144 << "Error: not a CMake build directory (missing CMakeCache.txt)\n";
4145 return false;
4146 }
4147 cmValue genName = this->State->GetCacheEntryValue("CMAKE_GENERATOR");
4148 if (!genName) {
4149 std::cerr << "Error: could not find CMAKE_GENERATOR in Cache\n";
4150 return false;
4151 }
4152 cmValue extraGenName =
4153 this->State->GetInitializedCacheValue("CMAKE_EXTRA_GENERATOR");
4154 std::string fullName =
4155 cmExternalMakefileProjectGenerator::CreateFullGeneratorName(
4156 *genName, extraGenName ? *extraGenName : "");
4157
4158 std::unique_ptr<cmGlobalGenerator> gen =
4159 this->CreateGlobalGenerator(fullName);
4160 if (!gen) {
4161 std::cerr << "Error: could not create CMAKE_GENERATOR \"" << fullName
4162 << "\"\n";
4163 return false;
4164 }
4165
4166 cmValue cachedProjectName =
4167 this->State->GetCacheEntryValue("CMAKE_PROJECT_NAME");
4168 if (!cachedProjectName) {
4169 std::cerr << "Error: could not find CMAKE_PROJECT_NAME in Cache\n";
4170 return false;
4171 }
4172
4173 return gen->Open(dir, *cachedProjectName, dryRun == DryRun::Yes);
4174}
4175
4176#if !defined(CMAKE_BOOTSTRAP)
4177template <typename T>

Callers 15

testGeneratedFileStreamFunction · 0.45
OpenOutputFileMethod · 0.45
do_openFunction · 0.45
SaveMethod · 0.45
WriteDyndepFileMethod · 0.45
CreateTarMethod · 0.45
ExecuteCMakeCommandMethod · 0.45
HandleConfigureCommandFunction · 0.45
GenerateMethod · 0.45
WriteJUnitXMLMethod · 0.45
openMethod · 0.45
checkOpenPossibleMethod · 0.45

Calls 4

LoadCacheMethod · 0.95
CreateGlobalGeneratorMethod · 0.95
GetCacheEntryValueMethod · 0.45

Tested by 3

testGeneratedFileStreamFunction · 0.36
OpenOutputFileMethod · 0.36
WriteJUnitXMLMethod · 0.36