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

Method CallVisualStudioMacro

Source/cmGlobalVisualStudioGenerator.cxx:235–271  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233}
234
235void cmGlobalVisualStudioGenerator::CallVisualStudioMacro(
236 MacroName m, std::string const& vsSolutionFile)
237{
238 // If any solution or project files changed during the generation,
239 // tell Visual Studio to reload them...
240 std::string dir = this->GetUserMacrosDirectory();
241
242 // Only really try to call the macro if:
243 // - there is a UserMacrosDirectory
244 // - the CMake vsmacros file exists
245 // - the CMake vsmacros file is registered
246 // - there were .sln/.vcproj files changed during generation
247 //
248 if (!dir.empty()) {
249 std::string macrosFile =
250 cmStrCat(dir, "/CMakeMacros/" CMAKE_VSMACROS_FILENAME);
251 std::string nextSubkeyName;
252 if (cmSystemTools::FileExists(macrosFile) &&
253 IsVisualStudioMacrosFileRegistered(
254 macrosFile, this->GetUserMacrosRegKeyBase(), nextSubkeyName)) {
255 if (m == MacroReload) {
256 std::vector<std::string> filenames;
257 this->GetFilesReplacedDuringGenerate(filenames);
258 if (!filenames.empty()) {
259 std::string projects = cmJoin(filenames, ";");
260 cmCallVisualStudioMacro::CallMacro(
261 vsSolutionFile, CMAKE_VSMACROS_RELOAD_MACRONAME, projects,
262 this->GetCMakeInstance()->GetDebugOutput());
263 }
264 } else if (m == MacroStop) {
265 cmCallVisualStudioMacro::CallMacro(
266 vsSolutionFile, CMAKE_VSMACROS_STOP_MACRONAME, "",
267 this->GetCMakeInstance()->GetDebugOutput());
268 }
269 }
270 }
271}
272
273std::string cmGlobalVisualStudioGenerator::GetUserMacrosDirectory()
274{

Callers 2

GenerateMethod · 0.95
RunMethod · 0.80

Calls 10

GetDebugOutputMethod · 0.80
cmStrCatFunction · 0.70
cmJoinFunction · 0.70
FileExistsFunction · 0.50
emptyMethod · 0.45
GetCMakeInstanceMethod · 0.45

Tested by

no test coverage detected