From 38e412626b604d7f79cac82153047fc59b55597f Mon Sep 17 00:00:00 2001 From: Ken Martin Date: Tue, 10 Sep 2002 16:49:40 -0400 Subject: modified TryCompile --- Source/cmGlobalGenerator.cxx | 17 +++++++++++++---- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 19 +++++++++++++++---- Source/cmGlobalVisualStudio6Generator.h | 2 +- Source/cmGlobalVisualStudio7Generator.cxx | 18 ++++++++++++++---- Source/cmGlobalVisualStudio7Generator.h | 2 +- 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 -- cgit v0.12