summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2002-06-25 13:59:08 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2002-06-25 13:59:08 (GMT)
commit32353c55e5f7a7e4687f5ae528cc2672e43badeb (patch)
tree3af5d0cb8d0d72febaf7c3ddc60948c448d955f7 /Source/cmTarget.cxx
parentdae99c659d25f4a6be7f99df51a83186cb5aa155 (diff)
downloadCMake-32353c55e5f7a7e4687f5ae528cc2672e43badeb.zip
CMake-32353c55e5f7a7e4687f5ae528cc2672e43badeb.tar.gz
CMake-32353c55e5f7a7e4687f5ae528cc2672e43badeb.tar.bz2
BUG: try to tell the difference between variables with sources and other variables
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 9248b31..d654342 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -72,13 +72,23 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
{
const char* varValue =
mf.GetDefinition(temps.c_str());
- if (varValue)
+ // if the definition exists
+ // and it has an extension in it then assume it is a source file
+ // the problem is that ADD_EXECUTABLE creates a definition with the
+ // same name as the executable which could be the same name as the
+ // source file without the extension, so if you do this:
+ // ADD_EXECUTABLE(foo foo) where foo.cxx is a source file, then
+ // foo will be varValue will be defined to the path of the executable, but
+ // not a source list as we expect, so look for a "." in the string to see
+ // if it is a file or not.
+ if (varValue
+ && strchr(varValue, '.'))
{
std::vector<std::string> tval;
tval.push_back(varValue);
std::vector<std::string> args;
cmSystemTools::ExpandListArguments(tval, args);
- int i;
+ unsigned int i;
for (i = 0; i < args.size(); ++i)
{
if (mf.GetSource(args[i].c_str()))