mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-09 07:11:05 -06:00
@@ -21,3 +21,10 @@ extension is changed). See the :prop_tgt:`PUBLIC_HEADER`,
|
||||
:prop_tgt:`PRIVATE_HEADER`, and :prop_tgt:`RESOURCE` target properties for
|
||||
specifying files meant for ``Headers``, ``PrivateHeaders``, or
|
||||
``Resources`` directories.
|
||||
|
||||
If the specified location is equal to ``Resources``, the resulting location
|
||||
will be the same as if the :prop_tgt:`RESOURCE` property had been used. If
|
||||
the specified location is a sub-folder of ``Resources``, it will be placed
|
||||
into the respective sub-folder. Note: For iOS Apple uses a flat bundle layout
|
||||
where no ``Resources`` folder exist. Therefore CMake strips the ``Resources``
|
||||
folder name from the specified location.
|
||||
|
||||
@@ -3315,10 +3315,18 @@ cmGeneratorTarget::GetTargetSourceFileFlags(const cmSourceFile* sf) const
|
||||
// were not listed in one of the other lists.
|
||||
if (const char* location = sf->GetProperty("MACOSX_PACKAGE_LOCATION")) {
|
||||
flags.MacFolder = location;
|
||||
const bool stripResources =
|
||||
this->GlobalGenerator->ShouldStripResourcePath(this->Makefile);
|
||||
if (strcmp(location, "Resources") == 0) {
|
||||
flags.Type = cmGeneratorTarget::SourceFileTypeResource;
|
||||
if (stripResources) {
|
||||
flags.MacFolder = "";
|
||||
}
|
||||
} else if (cmSystemTools::StringStartsWith(location, "Resources/")) {
|
||||
flags.Type = cmGeneratorTarget::SourceFileTypeDeepResource;
|
||||
if (stripResources) {
|
||||
flags.MacFolder += strlen("Resources/");
|
||||
}
|
||||
} else {
|
||||
flags.Type = cmGeneratorTarget::SourceFileTypeMacContent;
|
||||
}
|
||||
@@ -3372,7 +3380,7 @@ void cmGeneratorTarget::ConstructSourceFileFlags() const
|
||||
if (cmSourceFile* sf = this->Makefile->GetSource(*it)) {
|
||||
SourceFileFlags& flags = this->SourceFlagsMap[sf];
|
||||
flags.MacFolder = "";
|
||||
if (!this->Makefile->PlatformIsAppleIos()) {
|
||||
if (!this->GlobalGenerator->ShouldStripResourcePath(this->Makefile)) {
|
||||
flags.MacFolder = "Resources";
|
||||
}
|
||||
flags.Type = cmGeneratorTarget::SourceFileTypeResource;
|
||||
|
||||
@@ -2487,6 +2487,11 @@ std::string cmGlobalGenerator::GenerateRuleFile(
|
||||
return ruleFile;
|
||||
}
|
||||
|
||||
bool cmGlobalGenerator::ShouldStripResourcePath(cmMakefile* mf) const
|
||||
{
|
||||
return mf->PlatformIsAppleIos();
|
||||
}
|
||||
|
||||
std::string cmGlobalGenerator::GetSharedLibFlagsForLanguage(
|
||||
std::string const& l) const
|
||||
{
|
||||
|
||||
@@ -337,6 +337,10 @@ public:
|
||||
relevant for mixed macOS and iOS builds. */
|
||||
virtual bool UseEffectivePlatformName(cmMakefile*) const { return false; }
|
||||
|
||||
/** Return whether the "Resources" folder prefix should be stripped from
|
||||
MacFolder. */
|
||||
virtual bool ShouldStripResourcePath(cmMakefile*) const;
|
||||
|
||||
std::string GetSharedLibFlagsForLanguage(std::string const& lang) const;
|
||||
|
||||
/** Generate an <output>.rule file path for a given command output. */
|
||||
|
||||
@@ -1200,9 +1200,8 @@ bool cmGlobalXCodeGenerator::CreateXCodeTargets(
|
||||
this->CreateString("2147483647"));
|
||||
copyFilesBuildPhase->AddAttribute("dstSubfolderSpec",
|
||||
this->CreateString("7"));
|
||||
const std::string dstPath = mit->first.substr(strlen("Resources/"));
|
||||
copyFilesBuildPhase->AddAttribute("dstPath",
|
||||
this->CreateString(dstPath));
|
||||
this->CreateString(mit->first));
|
||||
copyFilesBuildPhase->AddAttribute("runOnlyForDeploymentPostprocessing",
|
||||
this->CreateString("0"));
|
||||
buildFiles = this->CreateObject(cmXCodeObject::OBJECT_LIST);
|
||||
@@ -3701,6 +3700,12 @@ bool cmGlobalXCodeGenerator::UseEffectivePlatformName(cmMakefile* mf) const
|
||||
return cmSystemTools::IsOn(epnValue);
|
||||
}
|
||||
|
||||
bool cmGlobalXCodeGenerator::ShouldStripResourcePath(cmMakefile*) const
|
||||
{
|
||||
// Xcode determines Resource location itself
|
||||
return true;
|
||||
}
|
||||
|
||||
void cmGlobalXCodeGenerator::ComputeTargetObjectDirectory(
|
||||
cmGeneratorTarget* gt) const
|
||||
{
|
||||
|
||||
@@ -88,6 +88,8 @@ public:
|
||||
|
||||
bool UseEffectivePlatformName(cmMakefile* mf) const CM_OVERRIDE;
|
||||
|
||||
bool ShouldStripResourcePath(cmMakefile*) const CM_OVERRIDE;
|
||||
|
||||
bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf) CM_OVERRIDE;
|
||||
void AppendFlag(std::string& flags, std::string const& flag);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user