diff options
Diffstat (limited to 'Source/cmGlobalVisualStudioGenerator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudioGenerator.cxx | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 9d168d0..702199d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -51,9 +51,7 @@ cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator( } } -cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() -{ -} +cmGlobalVisualStudioGenerator::~cmGlobalVisualStudioGenerator() = default; cmGlobalVisualStudioGenerator::VSVersion cmGlobalVisualStudioGenerator::GetVersion() const @@ -188,7 +186,7 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase() std::string cmGlobalVisualStudioGenerator::GetRegistryBase(const char* version) { - std::string key = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\"; + std::string key = R"(HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\)"; return key + version; } @@ -203,7 +201,6 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets() // Use no actual command lines so that the target itself is not // considered always out of date. auto cc = cm::make_unique<cmCustomCommand>(); - cc->SetCMP0116Status(cmPolicies::NEW); cc->SetEscapeOldStyle(false); cc->SetComment("Build all projects"); cmTarget* allBuild = @@ -520,13 +517,12 @@ std::string cmGlobalVisualStudioGenerator::GetStartupProjectName( std::string startup = *n; if (this->FindTarget(startup)) { return startup; - } else { - root->GetMakefile()->IssueMessage( - MessageType::AUTHOR_WARNING, - "Directory property VS_STARTUP_PROJECT specifies target " - "'" + - startup + "' that does not exist. Ignoring."); } + root->GetMakefile()->IssueMessage( + MessageType::AUTHOR_WARNING, + "Directory property VS_STARTUP_PROJECT specifies target " + "'" + + startup + "' that does not exist. Ignoring."); } // default, if not specified @@ -548,12 +544,12 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, cmSystemTools::ConvertToUnixSlashes(s1); std::string keyname; - HKEY hkey = NULL; + HKEY hkey = nullptr; LONG result = ERROR_SUCCESS; DWORD index = 0; keyname = regKeyBase + "\\OtherProjects7"; - hkey = NULL; + hkey = nullptr; result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), 0, KEY_READ, &hkey); @@ -571,7 +567,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, RegEnumKeyExW(hkey, index, subkeyname, &cch_subkeyname, 0, keyclass, &cch_keyclass, &lastWriteTime)) { // Open the subkey and query the values of interest: - HKEY hsubkey = NULL; + HKEY hsubkey = nullptr; result = RegOpenKeyExW(hkey, subkeyname, 0, KEY_READ, &hsubkey); if (ERROR_SUCCESS == result) { DWORD valueType = REG_SZ; @@ -645,7 +641,7 @@ bool IsVisualStudioMacrosFileRegistered(const std::string& macrosFile, nextAvailableSubKeyName = std::to_string(index); keyname = regKeyBase + "\\RecordingProject7"; - hkey = NULL; + hkey = nullptr; result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), 0, KEY_READ, &hkey); @@ -691,13 +687,13 @@ void WriteVSMacrosFileRegistryEntry(const std::string& nextAvailableSubKeyName, const std::string& regKeyBase) { std::string keyname = regKeyBase + "\\OtherProjects7"; - HKEY hkey = NULL; + HKEY hkey = nullptr; LONG result = RegOpenKeyExW(HKEY_CURRENT_USER, cmsys::Encoding::ToWide(keyname).c_str(), 0, KEY_READ | KEY_WRITE, &hkey); if (ERROR_SUCCESS == result) { // Create the subkey and set the values of interest: - HKEY hsubkey = NULL; + HKEY hsubkey = nullptr; wchar_t lpClass[] = L""; result = RegCreateKeyExW( hkey, cmsys::Encoding::ToWide(nextAvailableSubKeyName).c_str(), 0, @@ -961,16 +957,16 @@ void cmGlobalVisualStudioGenerator::AddSymbolExportCommand( commands.push_back(std::move(command)); } -static bool OpenSolution(std::string sln) +static bool OpenSolution(std::string const& sln) { HRESULT comInitialized = - CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); + CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); if (FAILED(comInitialized)) { return false; } - HINSTANCE hi = - ShellExecuteA(NULL, "open", sln.c_str(), NULL, NULL, SW_SHOWNORMAL); + HINSTANCE hi = ShellExecuteA(nullptr, "open", sln.c_str(), nullptr, nullptr, + SW_SHOWNORMAL); CoUninitialize(); |