summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-01-24 20:51:44 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2020-01-24 22:16:25 (GMT)
commit63c9cd2088cc1287e4d4cd858bbdb8ca88dd8313 (patch)
tree2b4632fd229f3f78037bf461ddf93160b05a0c17 /Source
parent072a95350ca914c12afd4f617cb45f0477883b14 (diff)
downloadCMake-63c9cd2088cc1287e4d4cd858bbdb8ca88dd8313.zip
CMake-63c9cd2088cc1287e4d4cd858bbdb8ca88dd8313.tar.gz
CMake-63c9cd2088cc1287e4d4cd858bbdb8ca88dd8313.tar.bz2
Ninja Multi-Config: Fix bug with MacOS frameworks
Diffstat (limited to 'Source')
-rw-r--r--Source/cmNinjaTargetGenerator.cxx26
-rw-r--r--Source/cmNinjaTargetGenerator.h8
2 files changed, 26 insertions, 8 deletions
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index 455d809..4ebdd24 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -58,12 +58,14 @@ std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New(
cmNinjaTargetGenerator::cmNinjaTargetGenerator(cmGeneratorTarget* target)
: cmCommonTargetGenerator(target)
- , MacOSXContentGenerator(nullptr)
, OSXBundleGenerator(nullptr)
, LocalGenerator(
static_cast<cmLocalNinjaGenerator*>(target->GetLocalGenerator()))
{
- MacOSXContentGenerator = cm::make_unique<MacOSXContentGeneratorType>(this);
+ for (auto const& fileConfig : target->Makefile->GetGeneratorConfigs()) {
+ this->Configs[fileConfig].MacOSXContentGenerator =
+ cm::make_unique<MacOSXContentGeneratorType>(this, fileConfig);
+ }
}
cmNinjaTargetGenerator::~cmNinjaTargetGenerator() = default;
@@ -837,13 +839,15 @@ void cmNinjaTargetGenerator::WriteObjectBuildStatements(
std::vector<cmSourceFile const*> headerSources;
this->GeneratorTarget->GetHeaderSources(headerSources, config);
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
- headerSources, this->MacOSXContentGenerator.get(), config);
+ headerSources, this->Configs[fileConfig].MacOSXContentGenerator.get(),
+ config);
}
{
std::vector<cmSourceFile const*> extraSources;
this->GeneratorTarget->GetExtraSources(extraSources, config);
this->OSXBundleGenerator->GenerateMacOSXContentStatements(
- extraSources, this->MacOSXContentGenerator.get(), config);
+ extraSources, this->Configs[fileConfig].MacOSXContentGenerator.get(),
+ config);
}
if (firstForConfig) {
const char* pchExtension =
@@ -1452,6 +1456,16 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(pkgloc,
config);
+ // Reject files that collide with files from the Ninja file's native config.
+ if (config != this->FileConfig) {
+ std::string nativeMacdir =
+ this->Generator->OSXBundleGenerator->InitMacOSXContentDirectory(
+ pkgloc, this->FileConfig);
+ if (macdir == nativeMacdir) {
+ return;
+ }
+ }
+
// Get the input file location.
std::string input = source.GetFullPath();
input = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(input);
@@ -1462,8 +1476,8 @@ void cmNinjaTargetGenerator::MacOSXContentGeneratorType::operator()(
output = this->Generator->GetGlobalGenerator()->ConvertToNinjaPath(output);
// Write a build statement to copy the content into the bundle.
- this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(input, output,
- config);
+ this->Generator->GetGlobalGenerator()->WriteMacOSXContentBuild(
+ input, output, this->FileConfig);
// Add as a dependency to the target so that it gets called.
this->Generator->Configs[config].ExtraFiles.push_back(std::move(output));
diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h
index bca12b1..8678dc3 100644
--- a/Source/cmNinjaTargetGenerator.h
+++ b/Source/cmNinjaTargetGenerator.h
@@ -9,6 +9,7 @@
#include <memory>
#include <set>
#include <string>
+#include <utility>
#include <vector>
#include "cm_jsoncpp_value.h"
@@ -173,8 +174,10 @@ protected:
struct MacOSXContentGeneratorType
: cmOSXBundleGenerator::MacOSXContentGeneratorType
{
- MacOSXContentGeneratorType(cmNinjaTargetGenerator* g)
+ MacOSXContentGeneratorType(cmNinjaTargetGenerator* g,
+ std::string fileConfig)
: Generator(g)
+ , FileConfig(std::move(fileConfig))
{
}
@@ -183,10 +186,10 @@ protected:
private:
cmNinjaTargetGenerator* Generator;
+ std::string FileConfig;
};
friend struct MacOSXContentGeneratorType;
- std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
// Properly initialized by sub-classes.
std::unique_ptr<cmOSXBundleGenerator> OSXBundleGenerator;
std::set<std::string> MacContentFolders;
@@ -209,6 +212,7 @@ private:
Json::Value SwiftOutputMap;
std::vector<cmCustomCommand const*> CustomCommands;
cmNinjaDeps ExtraFiles;
+ std::unique_ptr<MacOSXContentGeneratorType> MacOSXContentGenerator;
};
std::map<std::string, ByConfig> Configs;