diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 86 |
1 files changed, 65 insertions, 21 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index dd1bdde..147c332 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -304,7 +304,7 @@ void cmTarget::DefineProperties(cmake *cm) "List of options to pass to the compiler.", "This property specifies the list of options specified " "so far for this property. " - "This property exists on directories and targets. " + "This property exists on directories and targets." "\n" "The target property values are used by the generators to set " "the options for the compiler.\n" @@ -945,6 +945,11 @@ void cmTarget::DefineProperties(cmake *cm) "OSX_ARCHITECTURES."); cm->DefineProperty + ("NAME", cmProperty::TARGET, + "Logical name for the target.", + "Read-only logical name for the target as used by CMake."); + + cm->DefineProperty ("EXPORT_NAME", cmProperty::TARGET, "Exported name for target files.", "This sets the name for the IMPORTED target generated when it this " @@ -964,6 +969,12 @@ void cmTarget::DefineProperties(cmake *cm) "This is the configuration-specific version of OUTPUT_NAME."); cm->DefineProperty + ("ALIASED_TARGET", cmProperty::TARGET, + "Name of target aliased by this target.", + "If this is an ALIAS target, this property contains the name of the " + "target aliased."); + + cm->DefineProperty ("<CONFIG>_OUTPUT_NAME", cmProperty::TARGET, "Old per-configuration target file base name.", "This is a configuration-specific version of OUTPUT_NAME. " @@ -1001,22 +1012,13 @@ void cmTarget::DefineProperties(cmake *cm) "(such as \"lib\") on a library name."); cm->DefineProperty - ("C_VISIBILITY_PRESET", cmProperty::TARGET, + ("<LANG>_VISIBILITY_PRESET", cmProperty::TARGET, "Value for symbol visibility compile flags", - "The C_VISIBILITY_PRESET property determines the value passed used in " - "a visibility related compile option, such as -fvisibility=. This " - "property only has an affect for libraries and executables with " + "The <LANG>_VISIBILITY_PRESET property determines the value passed in " + "a visibility related compile option, such as -fvisibility= for <LANG>. " + "This property only has an affect for libraries and executables with " "exports. This property is initialized by the value of the variable " - "CMAKE_C_VISIBILITY_PRESET if it is set when a target is created."); - - cm->DefineProperty - ("CXX_VISIBILITY_PRESET", cmProperty::TARGET, - "Value for symbol visibility compile flags", - "The CXX_VISIBILITY_PRESET property determines the value passed used in " - "a visibility related compile option, such as -fvisibility=. This " - "property only has an affect for libraries and executables with " - "exports. This property is initialized by the value of the variable " - "CMAKE_CXX_VISIBILITY_PRESET if it is set when a target is created."); + "CMAKE_<LANG>_VISIBILITY_PRESET if it is set when a target is created."); cm->DefineProperty ("VISIBILITY_INLINES_HIDDEN", cmProperty::TARGET, @@ -2530,6 +2532,7 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, = (sig == cmTarget::KeywordTLLSignature ? "keyword" : "plain"); s << "The uses of the " << sigString << " signature are here:\n"; + std::set<cmStdString> emitted; for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin(); it != sigs.end(); ++it) { @@ -2537,7 +2540,12 @@ void cmTarget::GetTllSignatureTraces(cmOStringStream &s, if(i != it->end()) { cmListFileContext const& lfc = *i; - s << " * " << (lfc.Line? "": " in ") << lfc << std::endl; + cmOStringStream line; + line << " * " << (lfc.Line? "": " in ") << lfc << std::endl; + if (emitted.insert(line.str()).second) + { + s << line.str(); + } ++i; } } @@ -2974,7 +2982,13 @@ void cmTarget::SetProperty(const char* prop, const char* value) { return; } - + if (strcmp(prop, "NAME") == 0) + { + cmOStringStream e; + e << "NAME property is read-only\n"; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + return; + } if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) { cmListFileBacktrace lfbt; @@ -3041,6 +3055,13 @@ void cmTarget::AppendProperty(const char* prop, const char* value, { return; } + if (strcmp(prop, "NAME") == 0) + { + cmOStringStream e; + e << "NAME property is read-only\n"; + this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); + return; + } if(strcmp(prop,"INCLUDE_DIRECTORIES") == 0) { cmListFileBacktrace lfbt; @@ -3282,7 +3303,10 @@ static void processIncludeDirectories(cmTarget *tgt, if (!noMessage) { tgt->GetMakefile()->IssueMessage(messageType, e.str().c_str()); - return; + if (messageType == cmake::FATAL_ERROR) + { + return; + } } } @@ -4056,6 +4080,11 @@ const char *cmTarget::GetProperty(const char* prop, return 0; } + if (strcmp(prop, "NAME") == 0) + { + return this->GetName(); + } + // Watch for special "computed" properties that are dependent on // other properties or variables. Always recompute them. if(this->GetType() == cmTarget::EXECUTABLE || @@ -6248,7 +6277,7 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config, } // Get the link languages. - if(this->GetType() == cmTarget::STATIC_LIBRARY) + if(this->LinkLanguagePropagatesToDependents()) { std::string linkProp = "IMPORTED_LINK_INTERFACE_LANGUAGES"; linkProp += suffix; @@ -6474,6 +6503,15 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, break; } } + else + { + iface.Libraries = impl->Libraries; + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } + } } } @@ -6502,7 +6540,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, headTarget, this, &dagChecker), iface.Libraries); - if(this->GetType() == cmTarget::SHARED_LIBRARY) + if(this->GetType() == cmTarget::SHARED_LIBRARY + || this->GetType() == cmTarget::STATIC_LIBRARY) { // Shared libraries may have runtime implementation dependencies // on other shared libraries that are not in the interface. @@ -6536,6 +6575,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, } } } + if(this->LinkLanguagePropagatesToDependents()) + { + // Targets using this archive need its language runtime libraries. + iface.Languages = impl->Languages; + } } } else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN @@ -6550,7 +6594,7 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface, iface.ImplementationIsInterface = true; iface.Libraries = impl->Libraries; iface.WrongConfigLibraries = impl->WrongConfigLibraries; - if(this->GetType() == cmTarget::STATIC_LIBRARY) + if(this->LinkLanguagePropagatesToDependents()) { // Targets using this archive need its language runtime libraries. iface.Languages = impl->Languages; |