Add projectDir parameter to GenerateBuildCommand
Extend the cmGlobalGenerator::GenerateBuildCommand virtual method signature with a "projectDir" parameter specifying the top of the project build tree for which the build command will be generated. Populate it from call sites in cmGlobalGenerator::Build where a fully-generated build tree should be available.
This commit is contained in:
parent
674f918a1a
commit
de8be9ef7d
|
@ -638,7 +638,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
|
|||
= this->MakefileMap->GetDefinition("CMAKE_MAKE_PROGRAM");
|
||||
std::string buildCommand
|
||||
= globalGenerator->GenerateBuildCommand(cmakeMakeProgram,
|
||||
installProjectName.c_str(), 0,
|
||||
installProjectName.c_str(), 0, 0,
|
||||
globalGenerator->GetPreinstallTargetName(),
|
||||
buildConfig, false, false);
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
|
|
|
@ -133,7 +133,7 @@ cmCTestGenericHandler* cmCTestBuildCommand::InitializeHandler()
|
|||
std::string buildCommand
|
||||
= this->GlobalGenerator->
|
||||
GenerateBuildCommand(cmakeMakeProgram,
|
||||
cmakeProjectName,
|
||||
cmakeProjectName, 0,
|
||||
cmakeBuildAdditionalFlags, cmakeBuildTarget,
|
||||
cmakeBuildConfiguration, true, false);
|
||||
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
|
|
|
@ -122,7 +122,7 @@ bool cmBuildCommand
|
|||
//
|
||||
std::string makecommand = this->Makefile->GetLocalGenerator()
|
||||
->GetGlobalGenerator()->GenerateBuildCommand
|
||||
(makeprogram, project_name, 0, target, configuration, true, false);
|
||||
(makeprogram, project_name, 0, 0, target, configuration, true, false);
|
||||
|
||||
this->Makefile->AddDefinition(variable, makecommand.c_str());
|
||||
|
||||
|
@ -153,7 +153,7 @@ bool cmBuildCommand
|
|||
|
||||
std::string makecommand = this->Makefile->GetLocalGenerator()
|
||||
->GetGlobalGenerator()->GenerateBuildCommand
|
||||
(makeprogram.c_str(), this->Makefile->GetProjectName(), 0,
|
||||
(makeprogram.c_str(), this->Makefile->GetProjectName(), 0, 0,
|
||||
0, configType.c_str(), true, false);
|
||||
|
||||
if(cacheValue)
|
||||
|
|
|
@ -1340,11 +1340,13 @@ int cmGlobalGenerator::TryCompile(const char *srcdir, const char *bindir,
|
|||
|
||||
std::string cmGlobalGenerator
|
||||
::GenerateBuildCommand(const char* makeProgram, const char *projectName,
|
||||
const char* additionalOptions, const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool)
|
||||
const char *projectDir, const char* additionalOptions,
|
||||
const char *targetName, const char* config,
|
||||
bool ignoreErrors, bool)
|
||||
{
|
||||
// Project name and config are not used yet.
|
||||
// Project name & dir and config are not used yet.
|
||||
(void)projectName;
|
||||
(void)projectDir;
|
||||
(void)config;
|
||||
|
||||
std::string makeCommand =
|
||||
|
@ -1411,7 +1413,7 @@ int cmGlobalGenerator::Build(
|
|||
if (clean)
|
||||
{
|
||||
std::string cleanCommand =
|
||||
this->GenerateBuildCommand(makeCommandCSTR, projectName,
|
||||
this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir,
|
||||
0, "clean", config, false, fast);
|
||||
if(output)
|
||||
{
|
||||
|
@ -1443,7 +1445,7 @@ int cmGlobalGenerator::Build(
|
|||
|
||||
// now build
|
||||
std::string makeCommand =
|
||||
this->GenerateBuildCommand(makeCommandCSTR, projectName,
|
||||
this->GenerateBuildCommand(makeCommandCSTR, projectName, bindir,
|
||||
extraOptions, target,
|
||||
config, false, fast);
|
||||
if(output)
|
||||
|
|
|
@ -121,9 +121,10 @@ public:
|
|||
|
||||
virtual std::string GenerateBuildCommand(
|
||||
const char* makeProgram,
|
||||
const char *projectName, const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool fast);
|
||||
const char *projectName, const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName, const char* config,
|
||||
bool ignoreErrors, bool fast);
|
||||
|
||||
|
||||
///! Set the CMake instance
|
||||
|
|
|
@ -523,14 +523,16 @@ bool cmGlobalNinjaGenerator::UsingMinGW = false;
|
|||
std::string cmGlobalNinjaGenerator
|
||||
::GenerateBuildCommand(const char* makeProgram,
|
||||
const char* projectName,
|
||||
const char* projectDir,
|
||||
const char* additionalOptions,
|
||||
const char* targetName,
|
||||
const char* config,
|
||||
bool ignoreErrors,
|
||||
bool fast)
|
||||
{
|
||||
// Project name and config are not used yet.
|
||||
// Project name & dir and config are not used yet.
|
||||
(void)projectName;
|
||||
(void)projectDir;
|
||||
(void)config;
|
||||
// Ninja does not have -i equivalent option yet.
|
||||
(void)ignoreErrors;
|
||||
|
|
|
@ -191,6 +191,7 @@ public:
|
|||
/// Overloaded methods. @see cmGlobalGenerator::GenerateBuildCommand()
|
||||
virtual std::string GenerateBuildCommand(const char* makeProgram,
|
||||
const char* projectName,
|
||||
const char* projectDir,
|
||||
const char* additionalOptions,
|
||||
const char* targetName,
|
||||
const char* config,
|
||||
|
|
|
@ -517,11 +517,13 @@ cmGlobalUnixMakefileGenerator3
|
|||
|
||||
std::string cmGlobalUnixMakefileGenerator3
|
||||
::GenerateBuildCommand(const char* makeProgram, const char *projectName,
|
||||
const char* additionalOptions, const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool fast)
|
||||
const char *projectDir, const char* additionalOptions,
|
||||
const char *targetName, const char* config,
|
||||
bool ignoreErrors, bool fast)
|
||||
{
|
||||
// Project name and config are not used yet.
|
||||
// Project name & dir and config are not used yet.
|
||||
(void)projectName;
|
||||
(void)projectDir;
|
||||
(void)config;
|
||||
|
||||
std::string makeCommand =
|
||||
|
|
|
@ -107,7 +107,8 @@ public:
|
|||
// change the build command for speed
|
||||
virtual std::string GenerateBuildCommand
|
||||
(const char* makeProgram,
|
||||
const char *projectName, const char* additionalOptions,
|
||||
const char *projectName, const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool fast);
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase()
|
|||
|
||||
std::string cmGlobalVisualStudio10Generator
|
||||
::GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectName, const char *projectDir,
|
||||
const char* additionalOptions, const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool fast)
|
||||
{
|
||||
|
@ -230,7 +230,8 @@ std::string cmGlobalVisualStudio10Generator
|
|||
lowerCaseCommand.find("VCExpress") != std::string::npos)
|
||||
{
|
||||
return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram,
|
||||
projectName, additionalOptions, targetName, config, ignoreErrors, fast);
|
||||
projectName, projectDir, additionalOptions, targetName, config,
|
||||
ignoreErrors, fast);
|
||||
}
|
||||
|
||||
// Otherwise, assume MSBuild command line, and construct accordingly.
|
||||
|
|
|
@ -32,7 +32,7 @@ public:
|
|||
|
||||
virtual std::string
|
||||
GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectName, const char *projectDir,
|
||||
const char* additionalOptions, const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool);
|
||||
|
||||
|
|
|
@ -80,12 +80,15 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf)
|
|||
std::string cmGlobalVisualStudio6Generator
|
||||
::GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config,
|
||||
bool ignoreErrors,
|
||||
bool)
|
||||
{
|
||||
// Visual studio 6 doesn't need project dir
|
||||
(void) projectDir;
|
||||
// Ingoring errors is not implemented in visual studio 6
|
||||
(void) ignoreErrors;
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
*/
|
||||
virtual std::string GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config,
|
||||
|
|
|
@ -56,10 +56,12 @@ void cmGlobalVisualStudio7Generator
|
|||
|
||||
std::string cmGlobalVisualStudio7Generator
|
||||
::GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectName, const char *projectDir,
|
||||
const char* additionalOptions, const char *targetName,
|
||||
const char* config, bool ignoreErrors, bool)
|
||||
{
|
||||
// Visual studio 7 doesn't need project dir
|
||||
(void) projectDir;
|
||||
// Ingoring errors is not implemented in visual studio 6
|
||||
(void) ignoreErrors;
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
*/
|
||||
virtual std::string GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config,
|
||||
|
|
|
@ -260,6 +260,7 @@ void cmGlobalXCodeGenerator::EnableLanguage(std::vector<std::string>const&
|
|||
std::string cmGlobalXCodeGenerator
|
||||
::GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config,
|
||||
|
@ -268,6 +269,7 @@ std::string cmGlobalXCodeGenerator
|
|||
{
|
||||
// Config is not used yet
|
||||
(void) ignoreErrors;
|
||||
(void) projectDir;
|
||||
|
||||
// now build the test
|
||||
if(makeProgram == 0 || !strlen(makeProgram))
|
||||
|
|
|
@ -55,6 +55,7 @@ public:
|
|||
*/
|
||||
virtual std::string GenerateBuildCommand(const char* makeProgram,
|
||||
const char *projectName,
|
||||
const char *projectDir,
|
||||
const char* additionalOptions,
|
||||
const char *targetName,
|
||||
const char* config,
|
||||
|
|
Loading…
Reference in New Issue