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.
This commit is contained in:
parent
4ac75fdfe6
commit
5f5c92b9a2
@ -98,6 +98,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
|
|||||||
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;"
|
||||||
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
|
"ProductDir", vc10Express, cmSystemTools::KeyWOW64_32);
|
||||||
this->MasmEnabled = false;
|
this->MasmEnabled = false;
|
||||||
|
this->MSBuildCommandInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -255,7 +256,51 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase()
|
|||||||
return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros";
|
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(
|
void cmGlobalVisualStudio10Generator::GenerateBuildCommand(
|
||||||
std::vector<std::string>& makeCommand,
|
std::vector<std::string>& makeCommand,
|
||||||
const char* makeProgram,
|
const char* makeProgram,
|
||||||
|
@ -94,6 +94,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "10.0"; }
|
virtual const char* GetIDEVersion() { return "10.0"; }
|
||||||
|
|
||||||
|
std::string const& GetMSBuildCommand();
|
||||||
|
|
||||||
std::string PlatformToolset;
|
std::string PlatformToolset;
|
||||||
bool ExpressEdition;
|
bool ExpressEdition;
|
||||||
bool MasmEnabled;
|
bool MasmEnabled;
|
||||||
@ -111,5 +113,10 @@ private:
|
|||||||
std::string SourceRel;
|
std::string SourceRel;
|
||||||
};
|
};
|
||||||
LongestSourcePath LongestSource;
|
LongestSourcePath LongestSource;
|
||||||
|
|
||||||
|
std::string MSBuildCommand;
|
||||||
|
bool MSBuildCommandInitialized;
|
||||||
|
virtual std::string FindMSBuildCommand();
|
||||||
|
virtual std::string FindDevEnvCommand();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -33,6 +33,7 @@ std::string GetVS6TargetName(const std::string& targetName)
|
|||||||
cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
|
cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator()
|
||||||
{
|
{
|
||||||
this->FindMakeProgramFile = "CMakeVS6FindMake.cmake";
|
this->FindMakeProgramFile = "CMakeVS6FindMake.cmake";
|
||||||
|
this->MSDevCommandInitialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmGlobalVisualStudio6Generator
|
void cmGlobalVisualStudio6Generator
|
||||||
@ -77,6 +78,33 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string const& cmGlobalVisualStudio6Generator::GetMSDevCommand()
|
||||||
|
{
|
||||||
|
if(!this->MSDevCommandInitialized)
|
||||||
|
{
|
||||||
|
this->MSDevCommandInitialized = true;
|
||||||
|
this->MSDevCommand = this->FindMSDevCommand();
|
||||||
|
}
|
||||||
|
return this->MSDevCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmGlobalVisualStudio6Generator::FindMSDevCommand()
|
||||||
|
{
|
||||||
|
std::string vscmd;
|
||||||
|
std::string vskey = this->GetRegistryBase() + "\\Setup;VsCommonDir";
|
||||||
|
if(cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
|
||||||
|
cmSystemTools::KeyWOW64_32))
|
||||||
|
{
|
||||||
|
cmSystemTools::ConvertToUnixSlashes(vscmd);
|
||||||
|
vscmd += "/MSDev98/Bin/";
|
||||||
|
}
|
||||||
|
vscmd += "msdev.exe";
|
||||||
|
return vscmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void
|
void
|
||||||
cmGlobalVisualStudio6Generator::GenerateBuildCommand(
|
cmGlobalVisualStudio6Generator::GenerateBuildCommand(
|
||||||
std::vector<std::string>& makeCommand,
|
std::vector<std::string>& makeCommand,
|
||||||
|
@ -102,6 +102,10 @@ private:
|
|||||||
const std::set<cmStdString>& dependencies);
|
const std::set<cmStdString>& dependencies);
|
||||||
void WriteDSWFooter(std::ostream& fout);
|
void WriteDSWFooter(std::ostream& fout);
|
||||||
virtual std::string WriteUtilityDepend(cmTarget* target);
|
virtual std::string WriteUtilityDepend(cmTarget* target);
|
||||||
|
std::string MSDevCommand;
|
||||||
|
bool MSDevCommandInitialized;
|
||||||
|
std::string const& GetMSDevCommand();
|
||||||
|
std::string FindMSDevCommand();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -22,6 +22,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator(
|
|||||||
{
|
{
|
||||||
this->FindMakeProgramFile = "CMakeVS7FindMake.cmake";
|
this->FindMakeProgramFile = "CMakeVS7FindMake.cmake";
|
||||||
this->IntelProjectVersion = 0;
|
this->IntelProjectVersion = 0;
|
||||||
|
this->DevEnvCommandInitialized = false;
|
||||||
|
|
||||||
if (!platformName)
|
if (!platformName)
|
||||||
{
|
{
|
||||||
@ -110,6 +111,33 @@ void cmGlobalVisualStudio7Generator
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string const& cmGlobalVisualStudio7Generator::GetDevEnvCommand()
|
||||||
|
{
|
||||||
|
if(!this->DevEnvCommandInitialized)
|
||||||
|
{
|
||||||
|
this->DevEnvCommandInitialized = true;
|
||||||
|
this->DevEnvCommand = this->FindDevEnvCommand();
|
||||||
|
}
|
||||||
|
return this->DevEnvCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmGlobalVisualStudio7Generator::FindDevEnvCommand()
|
||||||
|
{
|
||||||
|
std::string vscmd;
|
||||||
|
std::string vskey = this->GetRegistryBase() + ";InstallDir";
|
||||||
|
if(cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd,
|
||||||
|
cmSystemTools::KeyWOW64_32))
|
||||||
|
{
|
||||||
|
cmSystemTools::ConvertToUnixSlashes(vscmd);
|
||||||
|
vscmd += "/";
|
||||||
|
}
|
||||||
|
vscmd += "devenv.com";
|
||||||
|
return vscmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
|
void cmGlobalVisualStudio7Generator::GenerateBuildCommand(
|
||||||
std::vector<std::string>& makeCommand,
|
std::vector<std::string>& makeCommand,
|
||||||
const char* makeProgram,
|
const char* makeProgram,
|
||||||
|
@ -110,6 +110,9 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "7.0"; }
|
virtual const char* GetIDEVersion() { return "7.0"; }
|
||||||
|
|
||||||
|
std::string const& GetDevEnvCommand();
|
||||||
|
virtual std::string FindDevEnvCommand();
|
||||||
|
|
||||||
static cmIDEFlagTable const* GetExtraFlagTableVS7();
|
static cmIDEFlagTable const* GetExtraFlagTableVS7();
|
||||||
virtual void OutputSLNFile(cmLocalGenerator* root,
|
virtual void OutputSLNFile(cmLocalGenerator* root,
|
||||||
std::vector<cmLocalGenerator*>& generators);
|
std::vector<cmLocalGenerator*>& generators);
|
||||||
@ -168,6 +171,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
char* IntelProjectVersion;
|
char* IntelProjectVersion;
|
||||||
|
std::string DevEnvCommand;
|
||||||
|
bool DevEnvCommandInitialized;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
|
#define CMAKE_CHECK_BUILD_SYSTEM_TARGET "ZERO_CHECK"
|
||||||
|
@ -104,6 +104,26 @@ cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
std::string cmGlobalVisualStudio8Generator::FindDevEnvCommand()
|
||||||
|
{
|
||||||
|
// First look for VCExpress.
|
||||||
|
std::string vsxcmd;
|
||||||
|
std::string vsxkey =
|
||||||
|
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\";
|
||||||
|
vsxkey += this->GetIDEVersion();
|
||||||
|
vsxkey += ";InstallDir";
|
||||||
|
if(cmSystemTools::ReadRegistryValue(vsxkey.c_str(), vsxcmd,
|
||||||
|
cmSystemTools::KeyWOW64_32))
|
||||||
|
{
|
||||||
|
cmSystemTools::ConvertToUnixSlashes(vsxcmd);
|
||||||
|
vsxcmd += "/VCExpress.exe";
|
||||||
|
return vsxcmd;
|
||||||
|
}
|
||||||
|
// Now look for devenv.
|
||||||
|
return this->cmGlobalVisualStudio71Generator::FindDevEnvCommand();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
///! Create a local generator appropriate to this Global Generator
|
///! Create a local generator appropriate to this Global Generator
|
||||||
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
|
cmLocalGenerator *cmGlobalVisualStudio8Generator::CreateLocalGenerator()
|
||||||
|
@ -69,6 +69,8 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual const char* GetIDEVersion() { return "8.0"; }
|
virtual const char* GetIDEVersion() { return "8.0"; }
|
||||||
|
|
||||||
|
virtual std::string FindDevEnvCommand();
|
||||||
|
|
||||||
virtual bool VSLinksDependencies() const { return false; }
|
virtual bool VSLinksDependencies() const { return false; }
|
||||||
|
|
||||||
bool AddCheckTarget();
|
bool AddCheckTarget();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user