Merge topic 'genex-target-objects-ordering'

caa4b7b8 genex: Preserve order while evaluating TARGET_OBJECTS
This commit is contained in:
Brad King 2014-11-10 10:42:59 -05:00 committed by CMake Topic Stage
commit ee6c79d1a3
1 changed files with 8 additions and 4 deletions

View File

@ -1286,12 +1286,16 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
std::string obj_dir = gt->ObjectDirectory; std::string obj_dir = gt->ObjectDirectory;
std::string result; std::string result;
const char* sep = ""; const char* sep = "";
for(std::map<cmSourceFile const*, std::string>::const_iterator it for(std::vector<cmSourceFile const*>::const_iterator it
= mapping.begin(); it != mapping.end(); ++it) = objectSources.begin(); it != objectSources.end(); ++it)
{ {
assert(!it->second.empty()); // Find the object file name corresponding to this source file.
std::map<cmSourceFile const*, std::string>::const_iterator
map_it = mapping.find(*it);
// It must exist because we populated the mapping just above.
assert(!map_it->second.empty());
result += sep; result += sep;
std::string objFile = obj_dir + it->second; std::string objFile = obj_dir + map_it->second;
cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true); cmSourceFile* sf = context->Makefile->GetOrCreateSource(objFile, true);
sf->SetObjectLibrary(tgtName); sf->SetObjectLibrary(tgtName);
sf->SetProperty("EXTERNAL_OBJECT", "1"); sf->SetProperty("EXTERNAL_OBJECT", "1");