summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Features: Define meaning for no language standard defaultBrad King2015-01-291-2/+9
| | | | | | | | | | | | Define an empty string in CMAKE_<LANG>_STANDARD_DEFAULT to mean that the toolchain has no notion of lanuage standard levels. In this case the <LANG>_STANDARD[_REQUIRED] properties will have no effect. Update the RunCMake.CompileFeatures test to exclude the LinkImplementationFeatureCycle test when there is no standard default. It can never fail because no use of specific features will adjust the CXX_STANDARD level required for any target since the standard levels have no meaning in this case.
* Replace 'foo.size() == 0' pattern with foo.empty().Stephen Kelly2015-01-181-3/+3
|
* Merge topic 'delete-algorithm'Brad King2015-01-151-24/+3
|\ | | | | | | | | | | | | | | 65b81da4 cmVariableWatch: Use the cmDeleteAll algorithm with for_each. 30d2de9a cmGeneratorExpressionEvaluator: Replace own algorithm with cmDeleteAll. 4a6e795b Use the cmDeleteAll algorithm instead of trivial raw loops. abb4a678 Add a generic algorithm for deleting items in a container.
| * cmGeneratorExpressionEvaluator: Replace own algorithm with cmDeleteAll.Stephen Kelly2015-01-131-24/+3
| |
* | Merge topic 'fix-COMPILE_FEATURES-genex'Brad King2015-01-151-1/+8
|\ \ | |/ |/| | | | | | | 45ec182d Features: Fix the COMPILE_FEATURES genex for unavailable features. 2bead0eb cmMakefile: Rename a method to what it really does.
| * Features: Fix the COMPILE_FEATURES genex for unavailable features.Stephen Kelly2015-01-121-0/+7
| | | | | | | | | | Previously, the genex tested only for CMake knowledge of the feature, but not compiler knowledge of the feature.
| * cmMakefile: Rename a method to what it really does.Stephen Kelly2015-01-121-1/+1
| | | | | | | | The method does not test availability of compile features.
* | Merge topic 'join-algorithm'Brad King2015-01-121-10/+1
|\ \ | | | | | | | | | | | | | | | | | | 55a73e6b Use the cmJoin algorithm where possible. 8dc8d756 cmStandardIncludes: Add a join algorithm for string containers. b5813cee cmInstallCommand: Remove unused variable.
| * | Use the cmJoin algorithm where possible.Stephen Kelly2015-01-081-10/+1
| | |
* | | Port all cmOStringStream to std::ostringstream.Stephen Kelly2015-01-111-7/+7
|/ / | | | | | | All compilers hosting CMake support the std class.
* | Fix some Clang -Wstring-conversion warningsSean McBride2014-12-121-2/+2
| | | | | | | | | | Some false positives, but some flagged faulty asserts where the ! was inside the string instead of outside.
* | Merge topic 'fix-transitive-OBJECT_SOURCES-context'Brad King2014-12-011-34/+40
|\ \ | |/ | | | | | | 672f1001 Genex: Fix evaluation context propagation for TARGET_OBJECTS.
| * Genex: Fix evaluation context propagation for TARGET_OBJECTS.Stephen Kelly2014-11-261-34/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extract a new method to encapsulate the requirements of evaluating dependent-expressions, namely, propagation of the EvaluateForBuildsystem setting, which is missing from the getLinkedTargetsContent implementation. Commit v3.1.0-rc1~688^2 (Genex: Only evaluate TARGET_OBJECTS to determine target sources., 2014-03-20) introduced an error case for use of TARGET_OBJECTS outside of the context of generating the buildsystem, as the path to object files may be dependent on buildsystem variables (See bug #15226). Commit v3.1.0-rc1~314^2 (Allow INTERFACE_SOURCES to specify $<TARGET_OBJECTS> (#14970), 2014-07-09) made it possible to propagate such content to dependent targets. While that commit propagated the EvaluateForBuildsystem setting for the case of a TARGET_PROPERTY expression, as generated for direct dependencies of a target in cmTargetInternals::AddInterfaceEntries, it did not add propagation for content from further transitive target dependencies, as determined by getLinkedTargetsContent.
* | Remove some unneeded c_str calls.Stephen Kelly2014-11-231-1/+1
| |
* | file(GENERATE): Evaluate early to allow generating source filesStephen Kelly2014-11-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The evaluation files must be known before cmTargetTraceDependencies attempts to find them, but we must actually generate the files after cmTargetTraceDependencies, as that can add to target SOURCES. The limitation is that the generated output name must not depend on the SOURCES of a target if the generated file is used by that target. Mark the output files as GENERATED so that trace dependencies does not expect them to already exist in the filesystem. Move the invokation of ForceLinkerLanguage in the Generate logic to after the generated file names are known. ForceLinkerLanguage tries to determine the sources of a target (in order to determine an already-known language) and otherwise fails to get information about the generated file. Test that the output of file(GENERATE) can be used as a target source file and that accessing the target SOURCES in the name of the output file is an error. Accessing the TARGET_OBJECTS would be a similar error if it was legal to use that generator expression in this context. That is not currently possible and is a different error condition, so test the current error output as a reminder to change the expected output if that becomes possible in the future. Test that generated rule files resulting from cmTargetTraceDependencies appear in the SOURCES generated in the output file.
* | Genex: Fix whitespace issue.Stephen Kelly2014-11-111-1/+1
| |
* | Merge topic 'genex-target-objects-ordering'Brad King2014-11-101-4/+8
|\ \ | |/ | | | | | | caa4b7b8 genex: Preserve order while evaluating TARGET_OBJECTS
| * genex: Preserve order while evaluating TARGET_OBJECTSClinton Stimpson2014-11-071-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The logic introduced in commit v3.1.0-rc1~688^2~9 (Genex: Evaluate TARGET_OBJECTS as a normal expression, 2014-02-26) ordered a map by pointer value and then constructed a list of object files by iterating over the map. This is not deterministic. Since commit v3.1.0-rc1~688^2~5 (cmTarget: Allow any generator expression in SOURCES property, 2014-03-18) the order produced by the above-mentioned logic started being used for the actual list of object files on the link line. Since it is not deterministic, spurious re-links occur after re-running CMake simply because the order of objects changed on the link line. Fix this by iterating over the original vector of source files instead of the map. This has a deterministic order.
* | strings: Remove redundant calls to std::string::c_str()Nils Gladitz2014-10-151-1/+1
|/ | | | | Replacements were detected and performed by the clang tool remove-cstr-calls on a linux build.
* Merge topic 'genex-build-property-no-head'Brad King2014-08-071-2/+2
|\ | | | | | | | | 3f476bea Genex: Do not consider 'head' when evaluating build properties
| * Genex: Do not consider 'head' when evaluating build propertiesBrad King2014-08-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | When $<TARGET_PROPERTY> names a build property like COMPILE_DEFINITIONS but not the usage requirement (INTERFACE_) version of it, the value should be that used to build the target. It should not be influenced by a dependent 'head' target like usage requirements are. Extend the CompileDefinitions test with a case covering the corrected behavior. Reviewed-by: Stephen Kelly <steveire@gmail.com>
* | Genex: Remove unnecessary check of context->MakefileBrad King2014-08-061-9/+6
|/ | | | | | The context->Makefile is never NULL, but our checks for it convince Clang scan-build that it might be NULL. Then it warns about later unchecked uses. Drop the unnecessary checks.
* Merge topic 'pdb-genex'Brad King2014-07-311-34/+91
|\ | | | | | | | | | | f86850ef Genex: Implement generator expressions for target PDB files. 028ad318 Genex: Simplify filesytem artifact code
| * Genex: Implement generator expressions for target PDB files.Nils Gladitz2014-07-311-0/+45
| |
| * Genex: Simplify filesytem artifact codeNils Gladitz2014-07-291-35/+47
| |
* | Genex: Track whether an expression depends on the 'head' targetBrad King2014-07-211-0/+14
|/
* Genex: Adjust code layout slightlyBrad King2014-07-161-4/+3
|
* Genex: Refactor empty element stripBrad King2014-07-161-3/+2
| | | | | | In cmGeneratorExpressionEvaluator, teach getLinkedTargetsContent to call cmGeneratorExpression::StripEmptyListElements to transform its return value so that callers do not have to do so.
* Genex: Avoid repeated search of transitive property whitelistBrad King2014-07-161-33/+26
| | | | | | | In cmGeneratorExpressionEvaluator, avoid searching through the list of transitive interface property names repeatedly during evaluation of TargetPropertyNode. Simply record the results of the first search for later re-use.
* Genex: Simplify TARGET_PROPERTY transitive lookupBrad King2014-07-161-65/+31
| | | | | | | In cmGeneratorExpressionEvaluator, make getLinkedTargetsContent a template so it can traverse over either the Libraries in a cmTarget LinkImplementationLibraries or a cmTarget LinkInterfaceLibraries. This also avoids creating a separate vector<cmTarget*>.
* cmTarget: Drop GetTransitivePropertyTargets methodBrad King2014-07-161-3/+13
| | | | Inline the implementation at the only remaining call site.
* cmTarget: Make GetLink*Libraries methods safer to useBrad King2014-07-161-1/+1
| | | | | | | | Split the library lists out of LinkImplementation and LinkInterface into LinkImplementationLibraries and LinkInterfaceLibraries parent classes, respectively. Return these from GetLinkImplementationLibraries and GetLinkInterfaceLibraries, respectively, so that callers cannot access parts of the structures that have not been populated.
* 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: Refactor LinkImplementation to allow more informationBrad King2014-07-071-2/+2
| | | | | | | 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.
* cmGeneratorExpressionEvaluator: Shorten some long linesBrad King2014-07-071-13/+16
| | | | Adjust the definitions of getLinkedTargetsContent to avoid long lines.
* Genex: Fix stack overflow in transitive property evaluation.Stephen Kelly2014-07-011-0/+13
| | | | | | | | | | | | | | | | | | | | Commit v2.8.11~156^2~2 (Expand includes and defines transitively in 'external' genexes., 2013-02-13) introduced a recursive loop and a stack overflow during evaluation of a link implementation which depends on a transitive property, such as add_library(empty1 ...) add_library(empty2 ...) target_link_libraries(empty1 PRIVATE $<$<STREQUAL:$<TARGET_PROPERTY:INCLUDE_DIRECTORIES>,/foo/bar>:empty2> ) There is no use-case for code like that currently, but it should not cause a stack overflow. Avoid the recursion by reporting an error early if a case like this is found.
* cmTarget: Lookup targets in LinkInterface and LinkImplementationBrad King2014-06-231-5/+5
| | | | | | | | | | | | | | | 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.
* Fix scope of transitive target name lookupsBrad King2014-06-231-2/+2
| | | | | | | | | | | 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: Constify GetTransitivePropertyTargets resultsBrad King2014-06-231-5/+6
| | | | Populate a vector of "cmTarget const*" instead of "cmTarget*".
* cmTarget: Remove 'head' argument from GetLinkImplementationBrad King2014-06-231-2/+1
| | | | | | | | | | | | | 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.
* regex: Search on strings where possibleBen Boeckel2014-06-091-4/+4
|
* regex: Use static regexs where possibleBen Boeckel2014-06-091-8/+4
| | | | | Rather than declaring and compiling a constant regex every time a chunk of code is executed, build the regex once.
* genex: remove the need for backtracesBen Boeckel2014-06-051-2/+2
| | | | | Rather than making dummy backtraces and passing them around, just make backtraces optional.
* Genex: Clarify error message on use with non-binary targets (#14899).Stephen Kelly2014-05-291-14/+14
|
* Features: Add COMPILE_FEATURES generator expression.Stephen Kelly2014-05-211-0/+89
| | | | | | | | | | | | Allow setting build properties based on the features available for a target. The availability of features is determined at generate-time by evaluating the link implementation. Ensure that the <LANG>_STANDARD determined while evaluating COMPILE_FEATURES in the link implementation is not lower than that provided by the INTERFACE of the link implementation. This is similar to handling of transitive properties such as POSITION_INDEPENDENT_CODE.
* Merge topic 'target-transitive-sources'Brad King2014-04-031-3/+6
|\ | | | | | | | | | | | | | | | | | | | | 9407174b target_sources: New command to add sources to target. 81ad69e0 Make the SOURCES target property writable. 6e636f2e cmTarget: Make the SOURCES origin tracable. 3676fb49 cmTarget: Allow transitive evaluation of SOURCES property. e6971df6 cmTarget: Make the source files depend on the config. df753df9 cmGeneratorTarget: Don't add computed sources to the target. 869328aa cmComputeTargetDepends: Use valid config to compute target depends.
| * cmTarget: Allow transitive evaluation of SOURCES property.Stephen Kelly2014-04-021-2/+5
| | | | | | | | | | | | | | Extend the cmGeneratorExpressionDAGChecker with an interface returning the name of the top target. Use that to determine when there is a DAG violation, as required by the RunCMake.Languages tests.
| * cmTarget: Make the source files depend on the config.Stephen Kelly2014-04-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Disallow the use of config-specific source files with the Visual Studio and Xcode generators. They don't have any way to represent the condition currently. Use the same common-config API in cmQtAutoGenerators. While it accepts config-specific files, it doesn't have to support multiple configurations yet. Loop over the configs in cmTargetTraceDependencies and cmGlobalGenerator::WriteSummary and consume all source files. Loop over the configs in cmComputeTargetDepends and compute the object library dependencies for each config.
* | Genex: Only evaluate TARGET_OBJECTS to determine target sources.Stephen Kelly2014-04-021-0/+10
|/ | | | | | | | | | The output of this expression may contain macros for IDEs to replace such as $(Configuration), $(CURRENT_ARCH) etc. To avoid generating content which is not usable in other contexts, report an error if there is an attempt to use it in other contexts. This commit may be reverted in the future if a solution to the above difference is implemented.
* Genex: Evaluate TARGET_OBJECTS as a normal expression.Stephen Kelly2014-03-311-0/+64
|