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

Method LoadEnvironmentPresets

Source/cmake.cxx:938–968  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938void cmake::LoadEnvironmentPresets()
939{
940 std::string envGenVar;
941 bool hasEnvironmentGenerator = false;
942 if (cmSystemTools::GetEnv("CMAKE_GENERATOR", envGenVar)) {
943 hasEnvironmentGenerator = true;
944 this->EnvironmentGenerator = envGenVar;
945 }
946
947 auto readGeneratorVar = [&](std::string const& name, std::string& key) {
948 std::string varValue;
949 if (cmSystemTools::GetEnv(name, varValue)) {
950 if (hasEnvironmentGenerator) {
951 key = varValue;
952 } else if (!this->GetIsInTryCompile()) {
953 std::string message =
954 cmStrCat("Warning: Environment variable ", name,
955 " will be ignored, because CMAKE_GENERATOR is not set.");
956 cmSystemTools::Message(message, "Warning");
957 }
958 }
959 };
960
961 readGeneratorVar("CMAKE_GENERATOR_INSTANCE", this->GeneratorInstance);
962 readGeneratorVar("CMAKE_GENERATOR_PLATFORM", this->GeneratorPlatform);
963 readGeneratorVar("CMAKE_GENERATOR_TOOLSET", this->GeneratorToolset);
964 this->IntermediateDirStrategy =
965 cmSystemTools::GetEnvVar("CMAKE_INTERMEDIATE_DIR_STRATEGY");
966 this->AutogenIntermediateDirStrategy =
967 cmSystemTools::GetEnvVar("CMAKE_AUTOGEN_INTERMEDIATE_DIR_STRATEGY");
968}
969
970namespace {
971enum class ListPresets

Callers 1

cmakeMethod · 0.95

Calls 3

GetIsInTryCompileMethod · 0.95
MessageClass · 0.85
cmStrCatFunction · 0.70

Tested by

no test coverage detected