diff options
Diffstat (limited to 'Source/cmMSDotNETGenerator.cxx')
-rw-r--r-- | Source/cmMSDotNETGenerator.cxx | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Source/cmMSDotNETGenerator.cxx b/Source/cmMSDotNETGenerator.cxx index 804eaa1..79e30d5 100644 --- a/Source/cmMSDotNETGenerator.cxx +++ b/Source/cmMSDotNETGenerator.cxx @@ -1380,3 +1380,50 @@ std::string cmMSDotNETGenerator::ConvertToXMLOutputPathSingle(const char* path) cmSystemTools::ReplaceString(ret, "\"", ""); return ret; } + + +int cmMSDotNETGenerator::TryCompile(const char *srcdir, + const char *bindir, + const char *projectName) +{ + // now build the test + std::string makeCommand = m_Makefile->GetDefinition("CMAKE_MAKE_PROGRAM"); + if(makeCommand.size() == 0) + { + cmSystemTools::Error( + "Generator cannot find the appropriate make command."); + return 1; + } + makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); + std::string lowerCaseCommand = makeCommand; + cmSystemTools::LowerCase(lowerCaseCommand); + + /** + * Run an executable command and put the stdout in output. + */ + std::string output; + + std::string cwd = cmSystemTools::GetCurrentWorkingDirectory(); + cmSystemTools::ChangeDirectory(bindir); + +#if defined(_WIN32) && !defined(__CYGWIN__) + if(makeCommand.find(' ') != std::string::npos) + { + cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); + } +#endif + makeCommand += " "; + makeCommand += projectName; + makeCommand += ".sln /rebuild Debug /project ALL_BUILD"; + + if (!cmSystemTools::RunCommand(makeCommand.c_str(), output)) + { + cmSystemTools::Error("Generator: execution of devenv failed."); + // return to the original directory + cmSystemTools::ChangeDirectory(cwd.c_str()); + return 1; + } + cmSystemTools::ChangeDirectory(cwd.c_str()); + return 0; +} + |