summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmCoreTryCompile.cxx')
-rw-r--r--Source/cmCoreTryCompile.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4b6e742..ee4fe97 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -90,6 +90,24 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
}
+ // look for COPY_FILE
+ std::string copyFile;
+ for (i = 3; i < argv.size(); ++i)
+ {
+ if (argv[i] == "COPY_FILE")
+ {
+ if ( argv.size() <= (i+1) )
+ {
+ cmSystemTools::Error(
+ "COPY_FILE specified but there is no variable");
+ return -1;
+ }
+ extraArgs += 2;
+ copyFile = argv[i+1];
+ break;
+ }
+ }
+
// do we have a srcfile signature
if (argv.size() - extraArgs == 3)
{
@@ -112,6 +130,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
"COMPILE_FLAGS specified on a srcdir type TRY_COMPILE");
return -1;
}
+ if (copyFile.size())
+ {
+ cmSystemTools::Error("COPY_FILE specified on a srcdir type TRY_COMPILE");
+ return -1;
+ }
}
// make sure the binary directory exists
cmSystemTools::MakeDirectory(this->BinaryDirectory.c_str());
@@ -262,6 +285,15 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (this->SrcFileSignature)
{
this->FindOutputFile(targetName);
+ if ((res==0) && (copyFile.size()))
+ {
+ if(!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
+ copyFile.c_str()))
+ {
+ cmSystemTools::Error("Could not COPY_FILE");
+ return -1;
+ }
+ }
}
return res;
}