diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-07-23 14:47:23 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-07-23 14:47:23 (GMT) |
commit | cbab76516f3cfb6a67713a04b5ea6020320eece9 (patch) | |
tree | 842eeafc9cf2da79b8d1c0f046051f86fff8a9de /Source/cmTryRunCommand.cxx | |
parent | 13db5b578ba81a72461e6d08a3b86ea698a7a0a0 (diff) | |
download | CMake-cbab76516f3cfb6a67713a04b5ea6020320eece9.zip CMake-cbab76516f3cfb6a67713a04b5ea6020320eece9.tar.gz CMake-cbab76516f3cfb6a67713a04b5ea6020320eece9.tar.bz2 |
ENH: try to create a file which can be used for presetting the cache values
of the TRY_RUN() results when crosscompiling
Alex
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r-- | Source/cmTryRunCommand.cxx | 20 |
1 files changed, 20 insertions, 0 deletions
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"; |