/src/CMake/Source/cmCxxModuleUsageEffects.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #include "cmCxxModuleUsageEffects.h" |
4 | | |
5 | | #include <cm/optional> |
6 | | |
7 | | #include "cmCryptoHash.h" |
8 | | #include "cmGeneratorTarget.h" |
9 | | #include "cmTarget.h" |
10 | | |
11 | | cmCxxModuleUsageEffects::cmCxxModuleUsageEffects(cmGeneratorTarget const* gt) |
12 | 0 | { |
13 | 0 | cmCryptoHash hasher(cmCryptoHash::AlgoSHA3_512); |
14 | 0 | this->Hash = hasher.HashString(gt->GetName()); |
15 | | |
16 | | // Collect compile features from the consuming target. |
17 | 0 | for (auto const& feature : gt->Target->GetCompileFeaturesEntries()) { |
18 | 0 | this->CompileFeatures.emplace_back(feature); |
19 | 0 | } |
20 | 0 | } |
21 | | |
22 | | void cmCxxModuleUsageEffects::ApplyToTarget(cmTarget* tgt) |
23 | 0 | { |
24 | 0 | for (auto const& feature : this->CompileFeatures) { |
25 | 0 | tgt->AppendProperty("COMPILE_FEATURES", feature.Value, feature.Backtrace); |
26 | 0 | } |
27 | 0 | } |
28 | | |
29 | | std::string const& cmCxxModuleUsageEffects::GetHash() const |
30 | 0 | { |
31 | 0 | return this->Hash; |
32 | 0 | } |