ENH: try to create a file which can be used for presetting the cache values
of the TRY_RUN() results when crosscompiling Alex
This commit is contained in:
parent
13db5b578b
commit
cbab76516f
|
@ -272,6 +272,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// is the output from the executable used ?
|
||||||
if (out!=0)
|
if (out!=0)
|
||||||
{
|
{
|
||||||
if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0)
|
if (this->Makefile->GetDefinition(internalRunOutputName.c_str()) == 0)
|
||||||
|
@ -312,6 +313,25 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
|
||||||
|
|
||||||
if (error)
|
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, "
|
std::string errorMessage = "TRY_RUN() invoked in cross-compiling mode, "
|
||||||
"please set the following cache variables "
|
"please set the following cache variables "
|
||||||
"appropriatly:\n";
|
"appropriatly:\n";
|
||||||
|
|
Loading…
Reference in New Issue