diff options
author | Brad King <brad.king@kitware.com> | 2013-11-13 19:27:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-11-18 13:26:24 (GMT) |
commit | 5f5c92b9a2c2f9c780c08e23231b93af71f175bd (patch) | |
tree | d9c078f01baba2b21b8aacff0679921d6cf533b0 /Source/cmGlobalVisualStudio10Generator.cxx | |
parent | 4ac75fdfe6e7a91f3beea037d13b1f4c8c8b80ed (diff) | |
download | CMake-5f5c92b9a2c2f9c780c08e23231b93af71f175bd.zip CMake-5f5c92b9a2c2f9c780c08e23231b93af71f175bd.tar.gz CMake-5f5c92b9a2c2f9c780c08e23231b93af71f175bd.tar.bz2 |
VS: Add internal APIs to find MSBuild, devenv/VCExpress, and msdev
Teach the VS generators to compute the locations of these tools directly
from registry entries. Add internal APIs to get the locations on demand.
Diffstat (limited to 'Source/cmGlobalVisualStudio10Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 7be10b1..d4d67d0 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -98,6 +98,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); this->MasmEnabled = false; + this->MSBuildCommandInitialized = false; } //---------------------------------------------------------------------------- @@ -255,7 +256,51 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase() return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros"; } +//---------------------------------------------------------------------------- +std::string const& cmGlobalVisualStudio10Generator::GetMSBuildCommand() +{ + if(!this->MSBuildCommandInitialized) + { + this->MSBuildCommandInitialized = true; + this->MSBuildCommand = this->FindMSBuildCommand(); + } + return this->MSBuildCommand; +} + +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio10Generator::FindMSBuildCommand() +{ + std::string msbuild; + std::string mskey = + "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\"; + mskey += this->GetToolsVersion(); + mskey += ";MSBuildToolsPath"; + if(cmSystemTools::ReadRegistryValue(mskey.c_str(), msbuild, + cmSystemTools::KeyWOW64_32)) + { + cmSystemTools::ConvertToUnixSlashes(msbuild); + msbuild += "/"; + } + msbuild += "MSBuild.exe"; + return msbuild; +} +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio10Generator::FindDevEnvCommand() +{ + if(this->ExpressEdition) + { + // Visual Studio Express >= 10 do not have "devenv.com" or + // "VCExpress.exe" that we can use to build reliably. + // Tell the caller it needs to use MSBuild instead. + return ""; + } + // Skip over the cmGlobalVisualStudio8Generator implementation because + // we expect a real devenv and do not want to look for VCExpress. + return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand(); +} + +//---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::GenerateBuildCommand( std::vector<std::string>& makeCommand, const char* makeProgram, |