From cbab76516f3cfb6a67713a04b5ea6020320eece9 Mon Sep 17 00:00:00 2001 From: Alexander Neundorf Date: Mon, 23 Jul 2007 10:47:23 -0400 Subject: ENH: try to create a file which can be used for presetting the cache values of the TRY_RUN() results when crosscompiling Alex --- Source/cmTryRunCommand.cxx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx index 1781e9c..11bd037 100644 --- a/Source/cmTryRunCommand.cxx +++ b/Source/cmTryRunCommand.cxx @@ -272,6 +272,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, error = true; } + // is the output from the executable used ? if (out!=0) { if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0) @@ -312,6 +313,25 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs, if (error) { + static bool firstRun = true; + std::string fileName = this->Makefile->GetHomeOutputDirectory(); + fileName += "/TryRunResults.cmake"; + std::ofstream file(fileName.c_str(), firstRun?std::ios::out : std::ios::app); + if ( file ) + { + file << "SET( " << internalRunOutputName << " \"" + << this->Makefile->GetDefinition(this->RunResultVariable.c_str()) + << "\" CACHE STRING \"Result from TRY_RUN\" )\n\n"; + if (out!=0) + { + file << "SET( " << this->RunResultVariable << " \"" + << this->Makefile->GetDefinition(internalRunOutputName.c_str()) + << "\" CACHE STRING \"Output from TRY_RUN\" )\n\n"; + } + file.close(); + } + firstRun = false; + std::string errorMessage = "TRY_RUN() invoked in cross-compiling mode, " "please set the following cache variables " "appropriatly:\n"; -- cgit v0.12