summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx21
1 files changed, 15 insertions, 6 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index bbb861c..f24da58 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -50,12 +50,21 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
// if one wasn't found then assume it is a single class
else
{
- cmSourceFile file;
- file.SetIsAnAbstractClass(false);
- file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
- mf.GetSourceExtensions(),
- mf.GetHeaderExtensions());
- m_SourceFiles.push_back(mf.AddSource(file));
+ // if the source file is already in the makefile, use it
+ if (mf.GetSource(temps.c_str()))
+ {
+ m_SourceFiles.push_back(mf.GetSource(temps.c_str()));
+ }
+ // otherwise try to create it
+ else
+ {
+ cmSourceFile file;
+ file.SetIsAnAbstractClass(false);
+ file.SetName(temps.c_str(), mf.GetCurrentDirectory(),
+ mf.GetSourceExtensions(),
+ mf.GetHeaderExtensions());
+ m_SourceFiles.push_back(mf.AddSource(file));
+ }
}
}