| 233 | } |
| 234 | |
| 235 | void 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 | |
| 273 | std::string cmGlobalVisualStudioGenerator::GetUserMacrosDirectory() |
| 274 | { |
no test coverage detected