diff options
author | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-22 15:55:12 (GMT) |
---|---|---|
committer | Daniel Eiband <daniel.eiband@brainlab.com> | 2019-09-24 15:44:28 (GMT) |
commit | 7847fef51056432e2e822b64d72b598a993e9524 (patch) | |
tree | b6f48fdcd0a083d5c846bf19ff39a6987e6bda72 /Source/cmGlobalVisualStudioGenerator.cxx | |
parent | ebb9346490741ddc2ce6f552bc1be57dfc730cfa (diff) | |
download | CMake-7847fef51056432e2e822b64d72b598a993e9524.zip CMake-7847fef51056432e2e822b64d72b598a993e9524.tar.gz CMake-7847fef51056432e2e822b64d72b598a993e9524.tar.bz2 |
VS: Fix access violation when calling Visual Studio macro
Fixes: #19730
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 61e8f58..1cb8b53 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -288,11 +288,10 @@ void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros() } void cmGlobalVisualStudioGenerator::CallVisualStudioMacro( - MacroName m, const char* vsSolutionFile) + MacroName m, const std::string& vsSolutionFile) { // If any solution or project files changed during the generation, // tell Visual Studio to reload them... - cmMakefile* mf = this->LocalGenerators[0]->GetMakefile(); std::string dir = this->GetUserMacrosDirectory(); // Only really try to call the macro if: @@ -307,27 +306,18 @@ void cmGlobalVisualStudioGenerator::CallVisualStudioMacro( if (cmSystemTools::FileExists(macrosFile.c_str()) && IsVisualStudioMacrosFileRegistered( macrosFile, this->GetUserMacrosRegKeyBase(), nextSubkeyName)) { - std::string topLevelSlnName; - if (vsSolutionFile) { - topLevelSlnName = vsSolutionFile; - } else { - topLevelSlnName = - cmStrCat(mf->GetCurrentBinaryDirectory(), '/', - this->LocalGenerators[0]->GetProjectName(), ".sln"); - } - if (m == MacroReload) { std::vector<std::string> filenames; this->GetFilesReplacedDuringGenerate(filenames); if (!filenames.empty()) { std::string projects = cmJoin(filenames, ";"); cmCallVisualStudioMacro::CallMacro( - topLevelSlnName, CMAKE_VSMACROS_RELOAD_MACRONAME, projects, + vsSolutionFile, CMAKE_VSMACROS_RELOAD_MACRONAME, projects, this->GetCMakeInstance()->GetDebugOutput()); } } else if (m == MacroStop) { cmCallVisualStudioMacro::CallMacro( - topLevelSlnName, CMAKE_VSMACROS_STOP_MACRONAME, "", + vsSolutionFile, CMAKE_VSMACROS_STOP_MACRONAME, "", this->GetCMakeInstance()->GetDebugOutput()); } } |