summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
Commit message (Collapse)AuthorAgeFilesLines
...
| * cmTarget: Drop 'head' argument from processSourcesBrad King2014-07-141-4/+1
| | | | | | | | No call sites need it to be anything but 'this'.
| * cmTarget: Drop 'head' argument from GetSourceFilesBrad King2014-07-141-11/+9
| | | | | | | | No call sites need it to be anything but 'this'.
| * cmTarget: Drop 'head' argument from GetLanguagesBrad King2014-07-141-5/+4
| | | | | | | | No call sites need it to be anything but 'this'.
| * cmTarget: Drop 'head' argument from ComputeLinkImplementationLanguagesBrad King2014-07-141-4/+3
| | | | | | | | No call sites need it to be anything but 'this'.
* | cmTarget: Compile old-style link dependencies only for VS 6Brad King2014-07-141-0/+8
| | | | | | | | | | Compile all the "ForVS6" cmTarget members only on Windows. No other platforms support the VS 6 generator.
* | cmTarget: Run old-style link dependencies only for VS 6Brad King2014-07-141-2/+5
| | | | | | | | | | Invoke it at runtime only with the VS 6 generator. No other generators need it.
* | cmTarget: Rename old-style link dependencies code as "ForVS6"Brad King2014-07-141-39/+39
|/ | | | | | The old link dependency analysis is now needed only for the VS 6 generator code delimited by CM_USE_OLD_VS6 to support project-provided project templates. Rename the related cmTarget members to be "ForVS6".
* Merge topic 'refactor-link-internals'Brad King2014-07-141-1/+1
|\ | | | | | | | | f45ede61 cmTarget: Fix CMP0022 OLD breakage from recent refactoring
| * cmTarget: Fix CMP0022 OLD breakage from recent refactoringBrad King2014-07-101-1/+1
| | | | | | | | | | | | | | In commit 7b0834e9 (cmTarget: Refactor internal LinkImplementation map, 2014-06-19) cmTarget::GetLinkImplementationLibrariesInternal was changed accidentally to pass "this" to ComputeLinkImplementation instead of "head". Change it back.
* | Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970)Brad King2014-07-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Fix cmTarget::GetSourceFiles to set EvaluateForBuildsystem on the $<TARGET_PROPERTY:...,INTERFACE_SOURCES> generator expression so that the $<TARGET_OBJECTS> generator expression is allowed within an INTERFACE_SOURCES value. Extend the InterfaceLibrary test to cover this case. Extend the RunCMake.TargetObjects test to cover failure of $<TARGET_OBJECTS> when used through $<TARGET_PROPERTY:...,INTERFACE_SOURCES> in a non-buildsystem context.
* | cmTarget: Simplify INTERFACE_INCLUDE_DIRECTORIES usage requirement lookupBrad King2014-07-071-61/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Use the AddInterfaceEntries helper to avoid duplication. In TargetPropertyEntry, replace the TargetName string member with a reference to the full cmLinkImplItem that produced the entry. This is possible because the cmLinkImplItem is available in AddInterfaceEntries (it was not available in GetIncludeDirectories). Having the full cmLinkImplItem allows processIncludeDirectories to implement CMP0027 OLD behavior without repeating the target name lookup. Update the RunCMake.CompatibleInterface test DebugProperties case expected output for the new order of the messages.
* | cmTarget: Simplify CMP0027 logic in processIncludeDirectoriesBrad King2014-07-071-26/+20
| | | | | | | | | | | | | | | | | | Evaluate and lookup the target name only once per TargetPropertyEntry instead of repeating it for each include directory entry. Use a local checkCMP0027 variable to record whether the policy should be checked. Evaluate the target name as a generator expression only if it looks like one. Lookup the target by name only after evaluation of generator expressions.
* | cmTarget: Add to LinkImplementation whether each library was a genexBrad King2014-07-071-7/+5
| | | | | | | | | | | | Implementation of CMP0027 OLD behavior needs to know whether each entry in LinkImplementation::Libraries came from a generator expression or not. Add a FromGenex member to cmLinkImplItem to record this.
* | cmTarget: Simplify INTERFACE_COMPILE_FEATURES usage requirement lookupBrad King2014-07-071-39/+3
| | | | | | | | Use the AddInterfaceEntries helper to avoid duplication.
* | cmTarget: Simplify INTERFACE_COMPILE_DEFINITIONS usage requirement lookupBrad King2014-07-071-39/+3
| | | | | | | | Use the AddInterfaceEntries helper to avoid duplication.
* | cmTarget: Simplify INTERFACE_COMPILE_OPTIONS usage requirement lookupBrad King2014-07-071-39/+3
| | | | | | | | Use the AddInterfaceEntries helper to avoid duplication.
* | cmTarget: Simplify INTERFACE_SOURCES usage requirement lookupBrad King2014-07-071-39/+3
| | | | | | | | Use the AddInterfaceEntries helper to avoid duplication.
* | cmTarget: Add method to add usage requirements from linked interfacesBrad King2014-07-071-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create a cmTargetInternals::AddInterfaceEntries method to construct a $<TARGET_PROPERTY:tgt,INTERFACE_XYZ> generator expression and evaluate it for every target in the link implementation. This will be useful to de-duplicate such evaluation for each usage requirement separately. The new method will soon be used in the implementation of the INTERFACE_* usage requirement lookup methods (GetSourceFiles, GetCompileOptions, GetCompileDefinitions, GetCompileFeatures, GetIncludeDirectories). It is necessary for these methods to determine whether an expression in LinkImplementationPropertyEntries evaluates to a target or not because generator expression evaluation reports an error for non-targets and we construct a $<TARGET_PROPERTY:tgt,INTERFACE_XYZ> expression for each entry that is a target. The implementation of each usage requirement currently processes the LinkImplementationPropertyEntries and evaluates all generator expressions to determine targets. That is no longer necessary because GetLinkImplementationLibraries now returns resolved and cached targets together with their name. Use it to implement AddInterfaceEntries.
* | cmTarget: Add to LinkImplementation a backtrace for each libraryBrad King2014-07-071-1/+1
| | | | | | | | Allow clients to provide backtrace context on evaluation diagnostics.
* | cmTarget: Refactor LinkImplementation to allow more informationBrad King2014-07-071-8/+11
| | | | | | | | | | | | | | Create a cmLinkImplItem class derived from cmLinkItem so more information can be added to link implementation entries than link interface entries. Convert the LinkImplementation Libraries member to hold it. Update client sites accordingly.
* | Target: Return null when a transitive property is not defined.Stephen Kelly2014-07-011-0/+30
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit v2.8.11~310^2~1 (Keep track of INCLUDE_DIRECTORIES as a vector of structs., 2012-11-19) added special case of INCLUDE_DIRECTORIES for the purpose of origin-tracking of individual entries in the property. It introduced a bug in that it returned an empty string instead of '0' in the case that no includes have been set. Commit v2.8.11~289^2~2 (Handle INTERFACE properties transitively for includes and defines., 2012-09-23) introduced transitive handling of the property through the link implementation, together with a whitelist of properties which would be evaluated transitively. Because of the bug introduced previously, the 'prop' in TargetPropertyNode is non-null, meaning that the content (the empty string) would be evaluated as a generator expression. This was harmless as the follow-up code was only for 'INTERFACE_' variants of target properties, so the effect was the same. Commits v2.8.11~280^2~2 (Keep track of properties used to determine linker libraries., 2012-11-05) and v2.8.11~280^2~1 (Add API to calculate link-interface-dependent bool properties or error., 2013-01-06) added a way to track and report errors on properties which both determine and are determined by the link implementation. This was later used in generator expression evaluation by commit v2.8.11~252^2~2 (Make INTERFACE determined properties readable in generator expressions., 2013-01-19). If a property is unset (null), and the link implementation of the target was not being evaluated, this commit made it possible to evaluate the property from the link implementation instead. If the link implementation was being evaluated, an empty string was returned from the generator expression evaluation, which might be later reported as an error. The above logic was written for 'compatible interface' properties, but in fact it should have also included other properties. Because of the empty-string-instead-of-null bug, this code block is not entered for the INCLUDE_DIRECTORIES property. At this point, however, the bug still does not significantly affect behavior, because the follow-up code is still a no-op for the INCLUDE_DIRECTORIES property, and an empty string is returned regardless. Commit v2.8.11~189^2~6 (Use the link information as a source of compile definitions and includes., 2013-02-12) refactored the logic, but also without a change in behavior. Commit v2.8.11~156^2~2 (Expand includes and defines transitively in 'external' genexes., 2013-02-13) refactored the logic again, this time with a change of behavior. The INCLUDE_DIRECTORIES property was then mapped to INTERFACE_INCLUDE_DIRECTORIES during transitive generator expression evaluation. Because the transitive evaluation involved evaluation of the link implementation, this introduced a recursive loop and a segfault with code like: add_library(empty1 ...) add_library(empty2 ...) target_link_libraries(empty1 PRIVATE $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> ) As there is no real use-case for reading a target property like that while evaluating the link implementation, this went unnoticed. The same pattern was followed for other special-cased reads of transitive target properties such as COMPILE_DEFINITIONS. The segfault was fixed in the parent commit, but change the property to return null when appropriate for other future uses.
* cmTarget: Refactor ComputeLinkImplementationBrad King2014-06-251-17/+20
| | | | | | Use LinkImplementationPropertyEntries directly instead of asking GetProperty to construct a string for LINK_LIBRARIES. This gives us access to the entry backtraces.
* cmTarget: Pre-indent a block in ComputeLinkImplementationBrad King2014-06-251-37/+37
| | | | Prepare to move it into another block without extra whitespace changes.
* cmTarget: Shorten a long line in ComputeLinkImplementationBrad King2014-06-251-3/+2
| | | | Prepare to change its indentation without exceeding line length limit.
* cmTarget: Refactor internal LinkImplementation mapBrad King2014-06-251-31/+24
| | | | | | | | | If ComputeLinkImplementationLanguages were ever to cause GetLinkImplementationLibraries to be invoked then a LinkImplMap entry may appear in the middle of computing it in GetLinkInformation. Instead create the map entry up front and store in it boolean values indicating which pieces of the LinkImplementation structure have been populated. This approach leads to shorter code that is easier to follow too.
* cmTarget: Remove unnecessary 'mutable' markupBrad King2014-06-251-19/+19
| | | | | | Members of the cmTargetInternals structure do not need to be made 'mutable' even to cache data because there is no reason for the internal methods to be 'const'.
* cmTarget: De-duplicate link interface evaluation for $<LINK_ONLY>Brad King2014-06-251-32/+12
| | | | | | | | Teach GetTransitivePropertyTargets to use the GetLinkInterfaceLibraries method with usage_requirements_only==true instead of evaluating the INTERFACE_LINK_LIBRARIES property directly. This avoids duplicate evaluations and makes use of the caching done by GetLinkInterfaceLibraries.
* cmTarget: Teach GetLinkInterfaceLibraries to support $<LINK_ONLY>Brad King2014-06-251-23/+40
| | | | | | | Add a 'usage_requirements_only' parameter to GetLinkInterfaceLibraries and supporting internal APIs to pass through to ExpandLinkItems so it knows whether to use SetTransitivePropertiesOnly while evaluating generator expressions.
* cmTarget: De-duplicate link interface genex code for $<LINK_ONLY>Brad King2014-06-251-14/+6
| | | | | | Simplify the implementation of GetTransitivePropertyTargets by using ExpandLinkItems with usage_requirements_only==true to evaluate the generator expressions in the link interface for us.
* cmTarget: Teach ExpandLinkItems how to support $<LINK_ONLY>Brad King2014-06-251-3/+8
| | | | | | | Add a 'usage_requirements_only' parameter to ExpandLinkItems so that it knows whether to use SetTransitivePropertiesOnly while evaluating generator expressions. Update existing call sites to pass 'false' since they are for linking and not usage requirements.
* cmTarget: Drop GetDirectLinkLibraries methodsBrad King2014-06-231-42/+27
| | | | | Inline the implementation in the last remaining caller and drop the methods.
* cmTarget: Improve HaveBuildTreeRPATH implementationBrad King2014-06-231-3/+6
| | | | | | | Use GetLinkImplementationLibraries instead of GetDirectLinkLibraries because it tells us whether there will be any libraries to link after evaluating generator expressions. Also GetDirectLinkLibraries will be dropped soon.
* cmTarget: Lookup targets in LinkInterface and LinkImplementationBrad King2014-06-231-42/+63
| | | | | | | | | | | | | | | Instead of storing just the string names in these structures, lookup any target associated with each item and store its cmTarget pointer. Use the cmLinkItem class to hold the name and pointer together. Update client sites to use the pre-stored lookup result instead of looking up the target name again. Create a cmTarget::LookupLinkItems helper method to handle the lookup. Since lookups are now moving from cmComputeLinkDepends::AddLinkEntries to cmTarget::LookupLinkItems, move use of CheckCMP0004 to the latter. This drops use of CheckCMP0004 from entries added for _LIB_DEPENDS variables by cmComputeLinkDepends::AddVarLinkEntries, but I do not think that use was intentional originally anyway.
* cmTarget: Add GetUtilityItems to get target ordering dependenciesBrad King2014-06-231-0/+21
| | | | | | | Add a method like GetUtilities but that provides the target names already looked up and resolved to cmTarget pointers internally. Update call site in cmComputeTargetDepends::AddTargetDepend to use the already-found target instead of looking it up again.
* Fix scope of transitive target name lookupsBrad King2014-06-231-13/+10
| | | | | | | | | | | In cmTarget, cmGeneratorTarget, and cmGeneratorExpressionEvaluator, fix target name lookups to occur in the cmMakefile context of the target that referenced the name, not the current 'head' target. The context matters for imported targets because they are directory-scoped instead of globally unique. We already do this in cmComputeLinkDepends and cmComputeTargetDepends. Extend the InterfaceLibrary test with an example covering this behavior.
* cmTarget: Add method to lookup other targets in a target's scopeBrad King2014-06-231-0/+31
| | | | | Move the main implementation of cmComputeLinkDepends::FindTargetToLink into cmTarget.
* cmTarget: Constify GetLinkImplementationClosure resultsBrad King2014-06-231-10/+10
| | | | Populate a vector of "cmTarget const*" instead of "cmTarget*".
* cmTarget: Constify GetTransitivePropertyTargets resultsBrad King2014-06-231-2/+2
| | | | Populate a vector of "cmTarget const*" instead of "cmTarget*".
* cmTarget: Drop 'head' target from GetImportInfoBrad King2014-06-231-36/+62
| | | | | | | Move generator expression evaluation for imported library lists out of GetImportInfo and into a new GetImportLinkInterface helper. This avoids duplicating the computation and storage of all imported target info just because some of it is parameterized on the 'head' target.
* cmTarget: Remove 'head' argument from GetLinkImplementationBrad King2014-06-231-20/+33
| | | | | | | | | | | | | Many of the 'head' arguments added by commit v2.8.11~289^2~1 (Make linking APIs aware of 'head' target, 2013-01-04) turned out not to be needed. The "link implementation" of a target never needs to be computed with anything but itself as the 'head' target (except for CMP0022 OLD behavior because then it is the link interface). Remove the unused 'head' target paths. Add "internal" versions of cmTarget::GetDirectLinkLibraries and GetLinkImplementationLibraries to support the CMP0022 OLD behavior without otherwise exposing the 'head' target option of these methods.
* cmTarget: Drop 'head' argument from GetLinkClosureBrad King2014-06-231-12/+10
| | | | It is only ever passed the 'this' target itself.
* cmTarget: Remove 'head' argument from GetLinkerLanguageBrad King2014-06-231-9/+6
| | | | | | It is only ever called with the 'this' target as the head. Co-Author: Stephen Kelly <steveire@gmail.com>
* cmComputeLinkInformation: Remove 'head' argumentBrad King2014-06-231-1/+1
| | | | | | It is only ever constructed with the current target as its own 'head'. Co-Author: Stephen Kelly <steveire@gmail.com>
* cmTarget: Remove 'head' argument from GetLinkInformationBrad King2014-06-231-5/+3
| | | | | | No call sites use it anyway. Co-Author: Stephen Kelly <steveire@gmail.com>
* cmTarget: Cache GetLinkImplementationClosure resultsBrad King2014-06-231-12/+22
| | | | | Store them internally and return by reference to avoid duplicate computation.
* cmTarget: Rename Get{TransitiveTarget => LinkImplementation}ClosureBrad King2014-06-231-3/+3
| | | | | The method computes the transitive closure of targets starting with the current target link implementation libraries. Clarify the name.
* cmTarget: Remove 'head' argument from GetTransitiveTargetClosureBrad King2014-06-231-5/+4
| | | | The method is never called with any headTarget besides "this".
* cmTarget: Simplify processILibs implementationBrad King2014-06-231-13/+10
| | | | | Combine the outer two if() conditions into a single one with &&. Scope inner lookup result inside its condition.
* cmTarget: De-duplicate library list expansionBrad King2014-06-231-34/+27
| | | | | | | Create an ExpandLinkItems method to handle evaluation of generator expressions in a library list and expansion of the ;-list into a vector. Replace some duplicate copies of the implementation with calls to the new helper.
* cmTarget: Remove unused GetInterfaceLinkLibraries methodBrad King2014-06-231-23/+0
|