diff options
author | Brad King <brad.king@kitware.com> | 2019-09-26 13:49:36 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-09-26 13:49:56 (GMT) |
commit | a29b8d285e176b40c9c5f1ce506dd97ed38f9c97 (patch) | |
tree | 312d94b9dc3514c0214ca3b57bddb91111d35b88 /Source/cmGlobalVisualStudio7Generator.cxx | |
parent | df982c4e189c01896db487ec5edfe85d27911007 (diff) | |
parent | 7847fef51056432e2e822b64d72b598a993e9524 (diff) | |
download | CMake-a29b8d285e176b40c9c5f1ce506dd97ed38f9c97.zip CMake-a29b8d285e176b40c9c5f1ce506dd97ed38f9c97.tar.gz CMake-a29b8d285e176b40c9c5f1ce506dd97ed38f9c97.tar.bz2 |
Merge topic 'fix-vsmacro-access-violation'
7847fef510 VS: Fix access violation when calling Visual Studio macro
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3853
Diffstat (limited to 'Source/cmGlobalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio7Generator.cxx | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 7faafba..0915189 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -45,6 +45,14 @@ static cmVS7FlagTable cmVS7ExtraFlagTable[] = { { "", "", "", "", 0 } }; +namespace { +std::string GetSLNFile(cmLocalGenerator* root) +{ + return cmStrCat(root->GetCurrentBinaryDirectory(), '/', + root->GetProjectName(), ".sln"); +} +} + cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator( cmake* cm, std::string const& platformInGeneratorName) : cmGlobalVisualStudioGenerator(cm, platformInGeneratorName) @@ -286,8 +294,10 @@ void cmGlobalVisualStudio7Generator::Generate() this->OutputSLNFile(); // If any solution or project files changed during the generation, // tell Visual Studio to reload them... - if (!cmSystemTools::GetErrorOccuredFlag()) { - this->CallVisualStudioMacro(MacroReload); + if (!cmSystemTools::GetErrorOccuredFlag() && + !this->LocalGenerators.empty()) { + this->CallVisualStudioMacro(MacroReload, + GetSLNFile(this->LocalGenerators[0])); } } @@ -298,8 +308,7 @@ void cmGlobalVisualStudio7Generator::OutputSLNFile( return; } this->CurrentProject = root->GetProjectName(); - std::string fname = cmStrCat(root->GetCurrentBinaryDirectory(), '/', - root->GetProjectName(), ".sln"); + std::string fname = GetSLNFile(root); cmGeneratedFileStream fout(fname.c_str()); fout.SetCopyIfDifferent(true); if (!fout) { |