summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx42
1 files changed, 38 insertions, 4 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index d226af9..d2c81ae 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2005,6 +2005,38 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
}
}
}
+
+ // Add Watcom runtime library flags. This is activated by the presence
+ // of a default selection whether or not it is overridden by a property.
+ cmValue watcomRuntimeLibraryDefault =
+ this->Makefile->GetDefinition("CMAKE_WATCOM_RUNTIME_LIBRARY_DEFAULT");
+ if (cmNonempty(watcomRuntimeLibraryDefault)) {
+ cmValue watcomRuntimeLibraryValue =
+ target->GetProperty("WATCOM_RUNTIME_LIBRARY");
+ if (!watcomRuntimeLibraryValue) {
+ watcomRuntimeLibraryValue = watcomRuntimeLibraryDefault;
+ }
+ std::string const watcomRuntimeLibrary = cmGeneratorExpression::Evaluate(
+ *watcomRuntimeLibraryValue, this, config, target);
+ if (!watcomRuntimeLibrary.empty()) {
+ if (cmValue watcomRuntimeLibraryOptions = this->Makefile->GetDefinition(
+ "CMAKE_" + lang + "_COMPILE_OPTIONS_WATCOM_RUNTIME_LIBRARY_" +
+ watcomRuntimeLibrary)) {
+ this->AppendCompileOptions(flags, *watcomRuntimeLibraryOptions);
+ } else if ((this->Makefile->GetSafeDefinition(
+ "CMAKE_" + lang + "_COMPILER_ID") == "OpenWatcom" ||
+ this->Makefile->GetSafeDefinition(
+ "CMAKE_" + lang + "_SIMULATE_ID") == "OpenWatcom") &&
+ !cmSystemTools::GetErrorOccuredFlag()) {
+ // The compiler uses the Watcom ABI so it needs a known runtime
+ // library.
+ this->IssueMessage(MessageType::FATAL_ERROR,
+ "WATCOM_RUNTIME_LIBRARY value '" +
+ watcomRuntimeLibrary + "' not known for this " +
+ lang + " compiler.");
+ }
+ }
+ }
}
void cmLocalGenerator::AddLanguageFlagsForLinking(
@@ -2504,12 +2536,12 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
static const std::array<std::string, 4> langs = { { "C", "CXX", "OBJC",
"OBJCXX" } };
- bool haveAnyPch = false;
+ std::set<std::string> pchLangSet;
if (this->GetGlobalGenerator()->IsXcode()) {
for (const std::string& lang : langs) {
const std::string pchHeader = target->GetPchHeader(config, lang, "");
if (!pchHeader.empty()) {
- haveAnyPch = true;
+ pchLangSet.emplace(lang);
}
}
}
@@ -2554,9 +2586,11 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
const std::string pchHeader = target->GetPchHeader(config, lang, arch);
if (pchSource.empty() || pchHeader.empty()) {
- if (this->GetGlobalGenerator()->IsXcode() && haveAnyPch) {
+ if (this->GetGlobalGenerator()->IsXcode() && !pchLangSet.empty()) {
for (auto* sf : sources) {
- sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
+ if (pchLangSet.find(sf->GetLanguage()) == pchLangSet.end()) {
+ sf->SetProperty("SKIP_PRECOMPILE_HEADERS", "ON");
+ }
}
}
continue;