modified TryCompile

This commit is contained in:
Ken Martin 2002-09-10 16:49:40 -04:00
parent 820088cefc
commit 38e412626b
6 changed files with 45 additions and 15 deletions

View File

@ -138,7 +138,7 @@ void cmGlobalGenerator::LocalGenerate()
} }
int cmGlobalGenerator::TryCompile(const char *, const char *bindir, int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
const char *) const char *, const char *target)
{ {
// now build the test // now build the test
std::string makeCommand = std::string makeCommand =
@ -159,8 +159,17 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
cmSystemTools::ChangeDirectory(bindir); cmSystemTools::ChangeDirectory(bindir);
// now build // now build
makeCommand += " all"; if (target)
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) {
makeCommand += " ";
makeCommand += target;
}
else
{
makeCommand += " all";
}
int retVal;
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal))
{ {
cmSystemTools::Error("Generator: execution of make failed."); cmSystemTools::Error("Generator: execution of make failed.");
// return to the original directory // return to the original directory
@ -168,7 +177,7 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
return 1; return 1;
} }
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 0; return retVal;
} }
cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator() cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()

View File

@ -81,7 +81,7 @@ public:
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual int TryCompile(const char *srcdir, const char *bindir, virtual int TryCompile(const char *srcdir, const char *bindir,
const char *projectName); const char *projectName, const char *targetName);
///! Set the CMake instance ///! Set the CMake instance
void SetCMakeInstance(cmake *cm) { void SetCMakeInstance(cmake *cm) {

View File

@ -46,7 +46,8 @@ void cmGlobalVisualStudio6Generator::EnableLanguage(const char*,
int cmGlobalVisualStudio6Generator::TryCompile(const char *, int cmGlobalVisualStudio6Generator::TryCompile(const char *,
const char *bindir, const char *bindir,
const char *projectName) const char *projectName,
const char *targetName)
{ {
// now build the test // now build the test
std::string makeCommand = std::string makeCommand =
@ -80,9 +81,19 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
#endif #endif
makeCommand += " "; makeCommand += " ";
makeCommand += projectName; makeCommand += projectName;
makeCommand += ".dsw /MAKE \"ALL_BUILD - Debug\" /REBUILD"; makeCommand += ".dsw /MAKE \"";
if (targetName)
{
makeCommand += targetName;
}
else
{
makeCommand += "ALL_BUILD";
}
makeCommand += " - Debug\" /REBUILD";
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) int retVal;
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal))
{ {
cmSystemTools::Error("Generator: execution of msdev failed."); cmSystemTools::Error("Generator: execution of msdev failed.");
// return to the original directory // return to the original directory
@ -90,7 +101,7 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
return 1; return 1;
} }
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 0; return retVal;
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator

View File

@ -48,7 +48,7 @@ public:
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual int TryCompile(const char *srcdir, const char *bindir, virtual int TryCompile(const char *srcdir, const char *bindir,
const char *projectName); const char *projectName, const char *targetName);
/** /**
* Generate the all required files for building this project/tree. This * Generate the all required files for building this project/tree. This

View File

@ -47,7 +47,8 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(const char*,
int cmGlobalVisualStudio7Generator::TryCompile(const char *, int cmGlobalVisualStudio7Generator::TryCompile(const char *,
const char *bindir, const char *bindir,
const char *projectName) const char *projectName,
const char *targetName)
{ {
// now build the test // now build the test
std::string makeCommand = std::string makeCommand =
@ -81,9 +82,18 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
#endif #endif
makeCommand += " "; makeCommand += " ";
makeCommand += projectName; makeCommand += projectName;
makeCommand += ".sln /rebuild Debug /project ALL_BUILD"; makeCommand += ".sln /rebuild Debug /project ";
if (targetName)
{
makeCommand += targetName;
}
else
{
makeCommand += "ALL_BUILD";
}
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) int retVal;
if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal))
{ {
cmSystemTools::Error("Generator: execution of devenv failed."); cmSystemTools::Error("Generator: execution of devenv failed.");
// return to the original directory // return to the original directory
@ -91,7 +101,7 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
return 1; return 1;
} }
cmSystemTools::ChangeDirectory(cwd.c_str()); cmSystemTools::ChangeDirectory(cwd.c_str());
return 0; return retVal;
} }
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator

View File

@ -48,7 +48,7 @@ public:
* loaded commands, not as part of the usual build process. * loaded commands, not as part of the usual build process.
*/ */
virtual int TryCompile(const char *srcdir, const char *bindir, virtual int TryCompile(const char *srcdir, const char *bindir,
const char *projectName); const char *projectName, const char *targetName);
/** /**
* Generate the all required files for building this project/tree. This * Generate the all required files for building this project/tree. This