mirror of
https://github.com/reactos/CMake.git
synced 2025-01-22 11:24:56 +00:00
98cbcedd74
The changes are mostly converting old-style explicit iterator for loops into ranged for statements. A number of for loops had already been changed over, but local variables had been left behind instead of being absorbed into the ranged for statement, so these have been cleaned up too. A couple of minor improvements were made in areas already being updated by the for loop changes to slightly simplify the code or to avoid unnecessary conversions between `const char*` and `std::string`.
82 lines
2.3 KiB
C++
82 lines
2.3 KiB
C++
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
file Copyright.txt or https://cmake.org/licensing for details. */
|
|
#include "cmLocalXCodeGenerator.h"
|
|
|
|
#include "cmGeneratorTarget.h"
|
|
#include "cmGlobalXCodeGenerator.h"
|
|
#include "cmSourceFile.h"
|
|
|
|
class cmGeneratorTarget;
|
|
class cmGlobalGenerator;
|
|
class cmMakefile;
|
|
|
|
cmLocalXCodeGenerator::cmLocalXCodeGenerator(cmGlobalGenerator* gg,
|
|
cmMakefile* mf)
|
|
: cmLocalGenerator(gg, mf)
|
|
{
|
|
// the global generator does this, so do not
|
|
// put these flags into the language flags
|
|
this->EmitUniversalBinaryFlags = false;
|
|
}
|
|
|
|
cmLocalXCodeGenerator::~cmLocalXCodeGenerator()
|
|
{
|
|
}
|
|
|
|
std::string cmLocalXCodeGenerator::GetTargetDirectory(
|
|
cmGeneratorTarget const*) const
|
|
{
|
|
// No per-target directory for this generator (yet).
|
|
return "";
|
|
}
|
|
|
|
void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags,
|
|
const std::string& rawFlag)
|
|
{
|
|
cmGlobalXCodeGenerator* gg =
|
|
static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator);
|
|
gg->AppendFlag(flags, rawFlag);
|
|
}
|
|
|
|
void cmLocalXCodeGenerator::Generate()
|
|
{
|
|
cmLocalGenerator::Generate();
|
|
|
|
for (auto target : this->GetGeneratorTargets()) {
|
|
target->HasMacOSXRpathInstallNameDir("");
|
|
}
|
|
}
|
|
|
|
void cmLocalXCodeGenerator::GenerateInstallRules()
|
|
{
|
|
cmLocalGenerator::GenerateInstallRules();
|
|
|
|
for (auto target : this->GetGeneratorTargets()) {
|
|
target->HasMacOSXRpathInstallNameDir("");
|
|
}
|
|
}
|
|
|
|
void cmLocalXCodeGenerator::ComputeObjectFilenames(
|
|
std::map<cmSourceFile const*, std::string>& mapping,
|
|
cmGeneratorTarget const*)
|
|
{
|
|
// Count the number of object files with each name. Warn about duplicate
|
|
// names since Xcode names them uniquely automatically with a numeric suffix
|
|
// to avoid exact duplicate file names. Note that Mac file names are not
|
|
// typically case sensitive, hence the LowerCase.
|
|
std::map<std::string, int> counts;
|
|
for (auto& si : mapping) {
|
|
cmSourceFile const* sf = si.first;
|
|
std::string objectName =
|
|
cmSystemTools::GetFilenameWithoutLastExtension(sf->GetFullPath());
|
|
objectName += ".o";
|
|
|
|
std::string objectNameLower = cmSystemTools::LowerCase(objectName);
|
|
counts[objectNameLower] += 1;
|
|
if (2 == counts[objectNameLower]) {
|
|
// TODO: emit warning about duplicate name?
|
|
}
|
|
si.second = objectName;
|
|
}
|
|
}
|