summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Martin <ken.martin@kitware.com>2002-09-10 20:49:40 (GMT)
committerKen Martin <ken.martin@kitware.com>2002-09-10 20:49:40 (GMT)
commit38e412626b604d7f79cac82153047fc59b55597f (patch)
treec4b06f6f515e5486f287408575d9336c52645668
parent820088cefc2831a887c141dc4daf6dd758c4c365 (diff)
downloadCMake-38e412626b604d7f79cac82153047fc59b55597f.zip
CMake-38e412626b604d7f79cac82153047fc59b55597f.tar.gz
CMake-38e412626b604d7f79cac82153047fc59b55597f.tar.bz2
modified TryCompile
-rw-r--r--Source/cmGlobalGenerator.cxx17
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx19
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx18
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
6 files changed, 45 insertions, 15 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index f20d3c2..164a138 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -138,7 +138,7 @@ void cmGlobalGenerator::LocalGenerate()
}
int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
- const char *)
+ const char *, const char *target)
{
// now build the test
std::string makeCommand =
@@ -159,8 +159,17 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
cmSystemTools::ChangeDirectory(bindir);
// now build
- makeCommand += " all";
- if (!cmSystemTools::RunCommand(makeCommand.c_str(), output))
+ if (target)
+ {
+ makeCommand += " ";
+ makeCommand += target;
+ }
+ else
+ {
+ makeCommand += " all";
+ }
+ int retVal;
+ if (!cmSystemTools::RunCommand(makeCommand.c_str(), output, retVal))
{
cmSystemTools::Error("Generator: execution of make failed.");
// return to the original directory
@@ -168,7 +177,7 @@ int cmGlobalGenerator::TryCompile(const char *, const char *bindir,
return 1;
}
cmSystemTools::ChangeDirectory(cwd.c_str());
- return 0;
+ return retVal;
}
cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 7f07b19..f219f67 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -81,7 +81,7 @@ public:
* loaded commands, not as part of the usual build process.
*/
virtual int TryCompile(const char *srcdir, const char *bindir,
- const char *projectName);
+ const char *projectName, const char *targetName);
///! Set the CMake instance
void SetCMakeInstance(cmake *cm) {
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 4c91f55..79dbba7 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -46,7 +46,8 @@ void cmGlobalVisualStudio6Generator::EnableLanguage(const char*,
int cmGlobalVisualStudio6Generator::TryCompile(const char *,
const char *bindir,
- const char *projectName)
+ const char *projectName,
+ const char *targetName)
{
// now build the test
std::string makeCommand =
@@ -80,9 +81,19 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
#endif
makeCommand += " ";
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.");
// return to the original directory
@@ -90,7 +101,7 @@ int cmGlobalVisualStudio6Generator::TryCompile(const char *,
return 1;
}
cmSystemTools::ChangeDirectory(cwd.c_str());
- return 0;
+ return retVal;
}
///! Create a local generator appropriate to this Global Generator
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 63905b0..e64eb76 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -48,7 +48,7 @@ public:
* loaded commands, not as part of the usual build process.
*/
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
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 57be2fa..01ab1ba 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -47,7 +47,8 @@ void cmGlobalVisualStudio7Generator::EnableLanguage(const char*,
int cmGlobalVisualStudio7Generator::TryCompile(const char *,
const char *bindir,
- const char *projectName)
+ const char *projectName,
+ const char *targetName)
{
// now build the test
std::string makeCommand =
@@ -81,9 +82,18 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
#endif
makeCommand += " ";
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.");
// return to the original directory
@@ -91,7 +101,7 @@ int cmGlobalVisualStudio7Generator::TryCompile(const char *,
return 1;
}
cmSystemTools::ChangeDirectory(cwd.c_str());
- return 0;
+ return retVal;
}
///! Create a local generator appropriate to this Global Generator
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 37c6586..0c8d8cd 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -48,7 +48,7 @@ public:
* loaded commands, not as part of the usual build process.
*/
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