summaryrefslogtreecommitdiffstats
path: root/Source/cmTryRunCommand.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r--Source/cmTryRunCommand.cxx34
1 files changed, 21 insertions, 13 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index c9c4ed5..4fc0b13 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -22,6 +22,14 @@ bool cmTryRunCommand
return false;
}
+ if(this->Makefile->GetCMakeInstance()->GetWorkingMode() ==
+ cmake::FIND_PACKAGE_MODE)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "The TRY_RUN() command is not supported in --find-package mode.");
+ return false;
+ }
+
// build an arg list for TryCompile and extract the runArgs,
std::vector<std::string> tryCompile;
@@ -49,8 +57,8 @@ bool cmTryRunCommand
{
tryCompile.push_back(argv[i]);
}
- }
- else
+ }
+ else
{
if (argv[i] == "OUTPUT_VARIABLE")
{
@@ -94,8 +102,8 @@ bool cmTryRunCommand
// although they could be used together, don't allow it, because
// using OUTPUT_VARIABLE makes crosscompiling harder
- if (this->OutputVariable.size()
- && ((this->RunOutputVariable.size())
+ if (this->OutputVariable.size()
+ && ((this->RunOutputVariable.size())
|| (this->CompileOutputVariable.size())))
{
cmSystemTools::Error(
@@ -141,8 +149,8 @@ bool cmTryRunCommand
std::string runOutputContents;
if (this->Makefile->IsOn("CMAKE_CROSSCOMPILING"))
{
- this->DoNotRunExecutable(runArgs,
- argv[3],
+ this->DoNotRunExecutable(runArgs,
+ argv[3],
captureRunOutput ? &runOutputContents : 0);
}
else
@@ -153,7 +161,7 @@ bool cmTryRunCommand
// now put the output into the variables
if(this->RunOutputVariable.size())
{
- this->Makefile->AddDefinition(this->RunOutputVariable.c_str(),
+ this->Makefile->AddDefinition(this->RunOutputVariable.c_str(),
runOutputContents.c_str());
}
@@ -167,7 +175,7 @@ bool cmTryRunCommand
{
runOutputContents = std::string(compileOutput) + runOutputContents;
}
- this->Makefile->AddDefinition(this->OutputVariable.c_str(),
+ this->Makefile->AddDefinition(this->OutputVariable.c_str(),
runOutputContents.c_str());
}
}
@@ -212,9 +220,9 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
/* This is only used when cross compiling. Instead of running the
executable, two cache variables are created which will hold the results
- the executable would have produced.
+ the executable would have produced.
*/
-void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
+void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
const std::string& srcFile,
std::string* out
)
@@ -249,7 +257,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
comment += "Run result of TRY_RUN(), indicates whether the executable "
"would have been able to run on its target platform.\n";
comment += detailsString;
- this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(),
+ this->Makefile->AddCacheDefinition(this->RunResultVariable.c_str(),
"PLEASE_FILL_OUT-FAILED_TO_RUN",
comment.c_str(),
cmCacheManager::STRING);
@@ -276,7 +284,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
"would have printed on stdout and stderr on its target platform.\n";
comment += detailsString;
- this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(),
+ this->Makefile->AddCacheDefinition(internalRunOutputName.c_str(),
"PLEASE_FILL_OUT-NOTFOUND",
comment.c_str(),
cmCacheManager::STRING);
@@ -294,7 +302,7 @@ void cmTryRunCommand::DoNotRunExecutable(const std::string& runArgs,
if (error)
{
static bool firstTryRun = true;
- std::ofstream file(resultFileName.c_str(),
+ std::ofstream file(resultFileName.c_str(),
firstTryRun ? std::ios::out : std::ios::app);
if ( file )
{