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

Method SetGeneratorToolset

Source/cmGlobalGhsMultiGenerator.cxx:77–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77bool cmGlobalGhsMultiGenerator::SetGeneratorToolset(std::string const& ts,
78 bool build, cmMakefile* mf)
79{
80 /* In build mode nothing to be done.
81 * Toolset already determined and build tool absolute path is cached.
82 */
83 if (build) {
84 return true;
85 }
86
87 /* Determine the absolute directory for the toolset */
88 std::string tsp;
89 this->GetToolset(mf, tsp, ts);
90
91 /* no toolset was found */
92 if (tsp.empty()) {
93 return false;
94 }
95
96 /* set the build tool to use */
97 std::string gbuild(tsp + ((tsp.back() == '/') ? "" : "/") +
98 DEFAULT_BUILD_PROGRAM);
99 cmValue prevTool = mf->GetDefinition("CMAKE_MAKE_PROGRAM");
100
101 /* check if the toolset changed from last generate */
102 if (cmNonempty(prevTool) && !cmSystemTools::ComparePath(gbuild, *prevTool)) {
103 std::string const& e =
104 cmStrCat("toolset build tool: ", gbuild,
105 "\n"
106 "Does not match the previously used build tool: ",
107 *prevTool,
108 "\n"
109 "Either remove the CMakeCache.txt file and CMakeFiles "
110 "directory or choose a different binary directory.");
111 mf->IssueMessage(MessageType::FATAL_ERROR, e);
112 return false;
113 }
114
115 /* store the toolset that is being used for this build */
116 mf->AddCacheDefinition("CMAKE_MAKE_PROGRAM", gbuild, "build program to use",
117 cmStateEnums::INTERNAL, true);
118
119 mf->AddDefinition("CMAKE_SYSTEM_VERSION", tsp);
120
121 return true;
122}
123
124bool cmGlobalGhsMultiGenerator::SetGeneratorPlatform(std::string const& p,
125 cmMakefile* mf)

Callers

nothing calls this directly

Calls 9

GetToolsetMethod · 0.95
cmNonemptyFunction · 0.85
cmStrCatFunction · 0.70
emptyMethod · 0.45
backMethod · 0.45
GetDefinitionMethod · 0.45
IssueMessageMethod · 0.45
AddCacheDefinitionMethod · 0.45
AddDefinitionMethod · 0.45

Tested by

no test coverage detected