diff options
author | Brad King <brad.king@kitware.com> | 2019-07-21 11:57:08 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-07-23 10:46:34 (GMT) |
commit | 11fa818ecda0b50446aef891b06976973005e94b (patch) | |
tree | 96346a94e65e0aae090da50ad8862b9fec4b2aab /Source/cmGeneratorTarget.h | |
parent | 0239bf8ac88bb8ae9d8945be506cee2c9adb08f5 (diff) | |
download | CMake-11fa818ecda0b50446aef891b06976973005e94b.zip CMake-11fa818ecda0b50446aef891b06976973005e94b.tar.gz CMake-11fa818ecda0b50446aef891b06976973005e94b.tar.bz2 |
Genex: Optimize usage requirement TARGET_PROPERTY recursion
In large projects the generation process spends a lot of time evaluating
usage requirements through transitive interface properties on targets.
This can be seen in a contrived example with deep dependencies:
set(prev "")
foreach(i RANGE 1 500)
add_library(a${i} a.c)
target_compile_definitions(a${i} PUBLIC A${i})
target_link_libraries(a${i} PUBLIC ${prev})
set(prev a${i})
endforeach()
For each usage requirement (such as `INTERFACE_COMPILE_DEFINITIONS` or
`INTERFACE_INCLUDE_DIRECTORIES`), the value of the generator expression
`$<TARGET_PROPERTY:target,prop>` includes the values of the same
property from the transitive closure of link libraries of the target.
Previously we computed this by constructing a generator expression
string like `$<TARGET_PROPERTY:lib,INTERFACE_COMPILE_DEFINITIONS>` and
recursively evaluating it with the generator expression engine. Avoid
the string construction and parsing by creating and using a dedicated
evaluation method `cmGeneratorTarget::EvaluateInterfaceProperty` that
looks up the properties directly.
Issue: #18964, #18965
Diffstat (limited to 'Source/cmGeneratorTarget.h')
-rw-r--r-- | Source/cmGeneratorTarget.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index e86535d..b875c40 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -25,6 +25,9 @@ class cmMakefile; class cmSourceFile; class cmTarget; +struct cmGeneratorExpressionContext; +struct cmGeneratorExpressionDAGChecker; + class cmGeneratorTarget { public: @@ -674,6 +677,10 @@ public: class TargetPropertyEntry; + std::string EvaluateInterfaceProperty( + std::string const& prop, cmGeneratorExpressionContext* context, + cmGeneratorExpressionDAGChecker* dagCheckerParent) const; + bool HaveInstallTreeRPATH(const std::string& config) const; bool GetBuildRPATH(const std::string& config, std::string& rpath) const; |