diff options
author | Brad King <brad.king@kitware.com> | 2005-02-17 15:03:27 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2005-02-17 15:03:27 (GMT) |
commit | 3d9d8934262df109938c0cb5498544b311d8bac7 (patch) | |
tree | 2d668df27a201319f4046a262b7c8d82c9d7a0b6 /Source/cmLocalUnixMakefileGenerator2.cxx | |
parent | cd6dd5533020357b4aa7455a17f23ddcf80b4e73 (diff) | |
download | CMake-3d9d8934262df109938c0cb5498544b311d8bac7.zip CMake-3d9d8934262df109938c0cb5498544b311d8bac7.tar.gz CMake-3d9d8934262df109938c0cb5498544b311d8bac7.tar.bz2 |
ENH: Avoid generating duplicate rules for an object file. A warning about duplicate source files in a target is now generated.
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator2.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator2.cxx | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator2.cxx b/Source/cmLocalUnixMakefileGenerator2.cxx index ee759af..57ff0c9 100644 --- a/Source/cmLocalUnixMakefileGenerator2.cxx +++ b/Source/cmLocalUnixMakefileGenerator2.cxx @@ -442,9 +442,25 @@ cmLocalUnixMakefileGenerator2 } // Get the full path name of the object file. - // TODO: Remove duplicate objects and warn. std::string obj = this->GetObjectFileName(target, source); + // Avoid generating duplicate rules. + if(m_ObjectFiles.find(obj) == m_ObjectFiles.end()) + { + m_ObjectFiles.insert(obj); + } + else + { + cmOStringStream err; + err << "Warning: Source file \"" + << source.GetSourceName().c_str() << "." + << source.GetSourceExtension().c_str() + << "\" is listed multiple times for target \"" << target.GetName() + << "\"."; + cmSystemTools::Message(err.str().c_str(), "Warning"); + return; + } + // Create the directory containing the object file. This may be a // subdirectory under the target's directory. std::string dir = cmSystemTools::GetFilenamePath(obj.c_str()); @@ -1907,11 +1923,6 @@ cmLocalUnixMakefileGenerator2 for(std::vector<std::string>::iterator i = commands.begin(); i != commands.end(); ++i) { - // TODO: Fix target output paths to use "cd...;pwd" idiom to pass - // a full path to the linker. This should be done by identifying - // a relative path and stripping the directory part off to put in - // this format. This rule is the only place that this idiom is - // needed. this->ExpandRuleVariables(*i, linkLanguage, buildObjs.c_str(), |