Fix try_compile when file cannot be found

The try_compile() command's COPY_FILE option should not try to actually
copy the file if it cannot be found.  Some C runtime library's fopen
cannot handle an empty file name.
This commit is contained in:
Brad King 2009-10-28 11:24:08 -04:00
parent bc3cab3634
commit 172d503c61
1 changed files with 2 additions and 1 deletions

View File

@ -317,7 +317,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if ((res==0) && (copyFile.size()))
{
if(!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
if(this->OutputFile.empty() ||
!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
copyFile.c_str()))
{
cmOStringStream emsg;