summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-05-31 18:30:58 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-03 18:05:10 (GMT)
commitb06f4c8a745c96f19a9e9a7c7eb0ac22250472a2 (patch)
tree16391a388c369be9f7379134ff9583421f7a0ac5 /Source/cmGlobalGenerator.cxx
parent73472408c501e66c9dd8c027293b8c0907001b42 (diff)
downloadCMake-b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2.zip
CMake-b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2.tar.gz
CMake-b06f4c8a745c96f19a9e9a7c7eb0ac22250472a2.tar.bz2
Swift: disallow WIN32_EXECUTABLE properties
Currently, the compiler does not synthesize the correct entry point for the application and passing the subsystem flag does not work the same way with the Swift linker language. Add a check to prevent the application of `WIN32_EXECUTABLE` to Swift executables until they can be properly supported. This will prevent the need for a future policy change. Closes: #19325
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx35
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 26886f5..df0f33f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -331,6 +331,37 @@ bool cmGlobalGenerator::CheckTargetsForMissingSources() const
return failed;
}
+bool cmGlobalGenerator::CheckTargetsForType() const
+{
+ if (!this->GetLanguageEnabled("Swift")) {
+ return false;
+ }
+ bool failed = false;
+ for (cmLocalGenerator* generator : this->LocalGenerators) {
+ for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) {
+ std::vector<std::string> configs;
+ target->Makefile->GetConfigurations(configs);
+ if (configs.empty()) {
+ configs.emplace_back();
+ }
+
+ for (std::string const& config : configs) {
+ if (target->GetLinkerLanguage(config) == "Swift") {
+ if (target->GetPropertyAsBool("WIN32_EXECUTABLE")) {
+ this->GetCMakeInstance()->IssueMessage(
+ MessageType::FATAL_ERROR,
+ "WIN32_EXECUTABLE property is not supported on Swift "
+ "executables",
+ target->GetBacktrace());
+ failed = true;
+ }
+ }
+ }
+ }
+ }
+ return failed;
+}
+
bool cmGlobalGenerator::IsExportedTargetsFile(
const std::string& filename) const
{
@@ -1414,6 +1445,10 @@ bool cmGlobalGenerator::Compute()
return false;
}
+ if (this->CheckTargetsForType()) {
+ return false;
+ }
+
for (cmLocalGenerator* localGen : this->LocalGenerators) {
localGen->ComputeHomeRelativeOutputPath();
}