summaryrefslogtreecommitdiffstats
path: root/Source/cmTryRunCommand.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-09-22 18:42:05 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-09-22 18:42:05 (GMT)
commit692ba48c4e5762b370f2999e902b8bd677c77161 (patch)
tree0c9465d0e38a15bd0cb043f234b4e4ab0cee51a2 /Source/cmTryRunCommand.cxx
parent597185754420db18d83b2c9e3b9f1e33675bd935 (diff)
downloadCMake-692ba48c4e5762b370f2999e902b8bd677c77161.zip
CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.gz
CMake-692ba48c4e5762b370f2999e902b8bd677c77161.tar.bz2
ENH: major changes to support addition of languages from cmake modules directory.
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r--Source/cmTryRunCommand.cxx28
1 files changed, 25 insertions, 3 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index 4a77d1a..47f1d26 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -33,6 +33,7 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
// build an arg list for TryCompile and extract the runArgs
std::vector<std::string> tryCompile;
+ std::string outputVariable;
std::string runArgs;
unsigned int i;
for (i = 1; i < argv.size(); ++i)
@@ -51,13 +52,22 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
{
tryCompile.push_back(argv[i]);
}
- }
- else
+ }
+ else
{
tryCompile.push_back(argv[i]);
+ if (argv[i] == "OUTPUT_VARIABLE")
+ {
+ if ( argv.size() <= (i+1) )
+ {
+ cmSystemTools::Error(
+ "OUTPUT_VARIABLE specified but there is no variable");
+ return false;
+ }
+ outputVariable = argv[i+1];
+ }
}
}
-
// do the try compile
int res = cmTryCompileCommand::CoreTryCompileCode(m_Makefile, tryCompile, false);
@@ -102,6 +112,18 @@ bool cmTryRunCommand::InitialPass(std::vector<std::string> const& argv)
int timeout = 0;
cmSystemTools::RunSingleCommand(finalCommand.c_str(), &output, &retVal,
0, false, timeout);
+ if(outputVariable.size())
+ {
+ // if the TryCompileCore saved output in this outputVariable then
+ // prepend that output to this output
+ const char* compileOutput = m_Makefile->GetDefinition(outputVariable.c_str());
+ if(compileOutput)
+ {
+ output = std::string(compileOutput) + output;
+ }
+ m_Makefile->AddDefinition(outputVariable.c_str(), output.c_str());
+ }
+
// set the run var
char retChar[1000];
sprintf(retChar,"%i",retVal);