summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2023-01-30 15:24:41 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2023-08-17 18:42:53 (GMT)
commitcb356b540c0ed500383c7681ec7594ed58d517a5 (patch)
tree16a91f3ee57db921bcd52e0f5bf8b7da95e463aa
parentc1defd9dd3e9cacd4a40fcbc9f52e36493dd1d0b (diff)
downloadCMake-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.txt2
-rw-r--r--Source/cmCxxModuleUsageEffects.cxx21
-rw-r--r--Source/cmCxxModuleUsageEffects.h22
-rwxr-xr-xbootstrap1
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;
+};
diff --git a/bootstrap b/bootstrap
index 2c54dbf..68885b3 100755
--- a/bootstrap
+++ b/bootstrap
@@ -333,6 +333,7 @@ CMAKE_CXX_SOURCES="\
cmCustomCommandGenerator \
cmCustomCommandLines \
cmCxxModuleMapper \
+ cmCxxModuleUsageEffects \
cmDefinePropertyCommand \
cmDefinitions \
cmDocumentationFormatter \