diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2023-01-30 15:24:41 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2023-08-17 18:42:53 (GMT) |
commit | cb356b540c0ed500383c7681ec7594ed58d517a5 (patch) | |
tree | 16a91f3ee57db921bcd52e0f5bf8b7da95e463aa | |
parent | c1defd9dd3e9cacd4a40fcbc9f52e36493dd1d0b (diff) | |
download | CMake-cb356b540c0ed500383c7681ec7594ed58d517a5.zip CMake-cb356b540c0ed500383c7681ec7594ed58d517a5.tar.gz CMake-cb356b540c0ed500383c7681ec7594ed58d517a5.tar.bz2 |
cmCxxModuleUsageEffects: add a class to capture module usage effects
When importing a C++ module, there may be requirements imposed by the
importer so that the compiler can reliably read the BMI. For example,
the standard used in the importer may need to also apply to the imported
BMI.
Right now, there are no tracked requirements. As we learn more, this
class can start tracking more information.
See: https://wg21.link/p2581r2
-rw-r--r-- | Source/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/cmCxxModuleUsageEffects.cxx | 21 | ||||
-rw-r--r-- | Source/cmCxxModuleUsageEffects.h | 22 | ||||
-rwxr-xr-x | bootstrap | 1 |
4 files changed, 46 insertions, 0 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 12af5d0..67d3d8d 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -170,6 +170,8 @@ add_library( cmCustomCommandTypes.h cmCxxModuleMapper.cxx cmCxxModuleMapper.h + cmCxxModuleUsageEffects.cxx + cmCxxModuleUsageEffects.h cmDefinitions.cxx cmDefinitions.h cmDependencyProvider.h diff --git a/Source/cmCxxModuleUsageEffects.cxx b/Source/cmCxxModuleUsageEffects.cxx new file mode 100644 index 0000000..eea5245 --- /dev/null +++ b/Source/cmCxxModuleUsageEffects.cxx @@ -0,0 +1,21 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#include "cmCxxModuleUsageEffects.h" + +cmCxxModuleUsageEffects::cmCxxModuleUsageEffects( + cmGeneratorTarget const* /*gt*/) + : Hash("0000000000000000000000000000000000000000") +{ + // TODO: collect information from the generator target as to what might + // affect module consumption. +} + +void cmCxxModuleUsageEffects::ApplyToTarget(cmTarget* /*tgt*/) +{ + // TODO: apply the information collected in the constructor +} + +std::string const& cmCxxModuleUsageEffects::GetHash() const +{ + return this->Hash; +} diff --git a/Source/cmCxxModuleUsageEffects.h b/Source/cmCxxModuleUsageEffects.h new file mode 100644 index 0000000..a63919c --- /dev/null +++ b/Source/cmCxxModuleUsageEffects.h @@ -0,0 +1,22 @@ +/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying + file Copyright.txt or https://cmake.org/licensing for details. */ +#pragma once + +#include "cmConfigure.h" // IWYU pragma: keep + +#include <string> + +class cmGeneratorTarget; +class cmTarget; + +class cmCxxModuleUsageEffects +{ +public: + cmCxxModuleUsageEffects(cmGeneratorTarget const* gt); + + void ApplyToTarget(cmTarget* tgt); + std::string const& GetHash() const; + +private: + std::string Hash; +}; @@ -333,6 +333,7 @@ CMAKE_CXX_SOURCES="\ cmCustomCommandGenerator \ cmCustomCommandLines \ cmCxxModuleMapper \ + cmCxxModuleUsageEffects \ cmDefinePropertyCommand \ cmDefinitions \ cmDocumentationFormatter \ |