summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluator.cxx
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Remove some c_str() calls.Stephen Kelly2014-03-111-8/+8
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* stringapi: Pass configuration names as stringsBen Boeckel2014-03-081-3/+3
|
* stringapi: Use strings for the languagesBen Boeckel2014-03-081-2/+1
|
* genex: Store predicates as a map for faster searchingBen Boeckel2014-03-081-83/+52
| | | | May warrant a fast path for predicates which more frequently.
* cmTarget: Avoid computing languages when computing transitive targets.Stephen Kelly2014-02-241-3/+3
| | | | | | | | | | | | | | | | For the OLD CMP0022 behavior, we need to treat the implementation as the interface when computing the interface libraries. Make it possible to do that without computing the link languages by adding a new GetLinkImplementationLibraries method. Extend the existing GetLinkImplementation method to populate the languages if the libraries have already been computed and cached. Change GetTransitivePropertyTargets to invoke GetLinkInterfaceLibraries instead of GetLinkInterface. This is key, as it is a method called by cmGeneratorExpressionEvaluator. Change the cmGeneratorExpressionEvaluator to invoke GetLinkImplementationLibraries instead of GetLinkImplementation.
* cmTarget: Change GetTransitivePropertyLinkLibraries to output targets.Stephen Kelly2014-02-241-16/+35
| | | | | | | The callers already skip non-targets, so unify the target search. Change supporting functions to accept a container of targets instead of strings where possible.
* cmMakefile: make some methods take const std::string& instead of const char*Rolf Eike Beer2014-01-161-7/+5
| | | | | | | | Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
* Genex: Use case-sensitive comparison for COMPILER_ID.Stephen Kelly2014-01-081-1/+23
|
* cmTarget: Deprecate COMPILE_DEFINITIONS_ properties with a policy.Stephen Kelly2014-01-081-1/+6
|
* Genex: Add a nullary form for CONFIGStephen Kelly2014-01-071-2/+6
| | | | | | | | | | | | | This is consistent with other similar expressions such as PLATFORM_ID, and makes the CONFIGURATION expression obsolete. Fix an off-by-one error in GeneratorExpressionContent::EvaluateParameters exposed by a unit test. Remove the test for 'bad' nullary use of $<CONFIG>. Add a unit test to verify that $<CONFIG> and $<CONFIGURATION> have the same value.
* Genex: Make EQUAL support upper case binary literalsStephen Kelly2014-01-061-6/+6
| | | | | | | | As C++11, python, D and java do. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3472.pdf Add test for uppercase hex literals.
* Genex: Fix case of methods in the dag checker.Stephen Kelly2014-01-061-2/+2
|
* Undefine local preprocessor loop variables.Stephen Kelly2014-01-061-0/+3
| | | | | Most occurances of this pattern already contain the undef, so add it to the rest too.
* Genex: Reform error-checking for nullary/unary expressions.Stephen Kelly2014-01-061-29/+10
| | | | | | The error messages were incorrect (reporting that the expression requires one or two parameters), and repeated. Remove the now-unused ZeroOrMoreParameters enum value.
* Genex: Add EQUAL expression.Stephen Kelly2014-01-061-0/+89
| | | | Support decimal, hex, octal and binary literals.
* Genex: Use case-sensitive comparison in PLATFORM_ID.Stephen Kelly2013-12-191-1/+1
|
* Genex: Always return immediately on error.Stephen Kelly2013-12-191-0/+4
|
* Genex: Accept arbitrary content in *_CASE and MAKE_C_IDENTIFIER.Stephen Kelly2013-12-191-0/+6
|
* Genex: Allow single param expressions to accept arbirary input.Stephen Kelly2013-12-191-31/+23
| | | | | | | | | | | | | | Existing single-parameter expressions work due to special casing which assumes that if there is only one parameter, and the node accepts arbitrary content, then the result is the input. This is true for the existing expressions matching that pattern - namely the "1" and "TARGET_NAME" expressions. However, the LOWER_CASE, and UPPER_CASE expressions should also accept arbitrary content, and in their case, the result is not the input. Refactor the cmGeneratorExpressionEvaluator to allow that extension. Actually evaluate the "1" and "0" nodes.
* Genex: Add {UPPER,LOWER}_CASE and MAKE_C_IDENTIFIER.Stephen Kelly2013-11-271-0/+48
|
* INTERFACE_LIBRARY: Avoid codepaths which set unneeded properties.Stephen Kelly2013-11-251-1/+2
| | | | | | | | | | | | | As an INTERFACE_LIBRARY has no direct link dependencies, we can short-circuit in cmGeneratorExpressionEvaluator and in cmGlobalGenerator::CheckLocalGenerators. As they do not generate any output directly, any generate- or install- related code acn also be short-circuited. Many of the local generators already do this. Because only INTERFACE related properties make sense on INTERFACE_LIBRARY targets, avoid setting other properties, for example via defaults.
* Use new cmHasLiteralPrefix functionStephen Kelly2013-11-211-2/+2
|
* Genex: Use a preprocessor foreach to follow transitive properties.Stephen Kelly2013-11-091-17/+12
|
* Genex: Simplify the preprocessor looper for interface properties.Stephen Kelly2013-11-091-1/+1
| | | | By removing the INTERFACE_ prefix, we can use this in more contexts.
* Merge topic 'object-library-no-TARGET_FILE'Brad King2013-11-021-1/+1
|\ | | | | | | | | d960589 Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)
| * Genex: Reject $<TARGET_FILE:...> for object libraries (#14532)Brad King2013-11-011-1/+1
| | | | | | | | | | | | | | | | | | Teach the cmGeneratorExpressionEvaluator filesystem artifact logic to reject OBJECT_LIBRARY targets since they have no main artifact. Without the explicit rejection evaluation falls through to an internal CMake error message in cmTarget::GetOutputInfo. Extend the RunCMake.GeneratorExpression test to cover these cases.
* | cmTarget: Make GetProperty() const.Stephen Kelly2013-10-311-5/+7
| | | | | | | | | | | | This has follow-on effects for other methods and classes. Further work on making the use of const cmTarget pointers common can be done, particularly with a view to generate-time methods.
* | cmTarget: Add interface for compatible numeric propertiesStephen Kelly2013-10-241-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using the boost MPL library, one can set a define to increase the limit of how many variadic elements should be supported. The default for BOOST_MPL_LIMIT_VECTOR_SIZE is 20: http://www.boost.org/doc/libs/1_36_0/libs/mpl/doc/refmanual/limit-vector-size.html If the foo library requires that to be set to 30, and the independent bar library requires it to be set to 40, consumers of both need to set it to 40. add_library(foo INTERFACE) set_property(TARGET foo PROPERTY INTERFACE_boost_mpl_vector_size 30) set_property(TARGET foo PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size) target_compile_definitions(foo INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>) add_library(bar INTERFACE) set_property(TARGET bar PROPERTY INTERFACE_boost_mpl_vector_size 40) # Technically the next two lines are redundant, but as foo and bar are # independent, they both set these interfaces. set_property(TARGET bar PROPERTY COMPATIBLE_INTERFACE_NUMBER_MAX boost_mpl_vector_size) target_compile_definitions(bar INTERFACE BOOST_MPL_LIMIT_VECTOR_SIZE=$<TARGET_PROPERTY:boost_mpl_vector_size>) add_executable(user) target_link_libraries(user foo bar) Because the TARGET_PROPERTY reads the boost_mpl_vector_size property from the HEAD of the dependency graph (the user target), and because that property appears in the COMPATIBLE_INTERFACE_NUMBER_MAX of the dependencies of the user target, the maximum value for it is chosen for the compile definition, ie, 40. There are also use-cases for choosing the minimum value of a number. In Qt, deprecated API can be disabled by version. Setting the definition QT_DISABLE_DEPRECATED_BEFORE=0 disables no deprecated API. Setting it to 0x501000 disables API which was deprecated before Qt 5.1 etc. If two dependencies require the use of API which was deprecated in different Qt versions, then COMPATIBLE_INTERFACE_NUMBER_MIN can be used to ensure that both can compile.
* | Merge topic 'cmarray-templates'Brad King2013-10-231-25/+10
|\ \ | | | | | | | | | | | | | | | | | | d169b1f Genex: Use cmArraySize for targetPolicyWhitelist 86d5d80 Genex: Remove use of TransitiveWhitelistCompare 73d7705 Add some templates for cleaner array iteration.
| * | Genex: Use cmArraySize for targetPolicyWhitelistStephen Kelly2013-10-221-4/+1
| | | | | | | | | | | | For better readability.
| * | Genex: Remove use of TransitiveWhitelistCompareStephen Kelly2013-10-221-21/+9
| | | | | | | | | | | | | | | Replace with generic solution based on cmArray* for better readability.
* | | use size_t for GeneratorExpressionContent::ContentLength to fix some warningsRolf Eike Beer2013-10-211-1/+1
|/ / | | | | | | | | | | CMake/Source/cmGeneratorExpressionParser.cxx: In member function ‘void cmGeneratorExpressionParser::ParseGeneratorExpression(std::vector<cmGeneratorExpressionEvaluator*>&)’: CMake/Source/cmGeneratorExpressionParser.cxx:116:55: warning: conversion to ‘unsigned int’ from ‘long int’ may alter its value [-Wconversion] CMake/Source/cmGeneratorExpressionParser.cxx:240:39: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]