summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-12-12 14:11:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2024-12-12 14:11:59 (GMT)
commit2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b (patch)
treebb6ca2d99ac95c8acfbf8225e8eb05e9279953c3 /Source
parent6622ae651f1e5df996acc9729f49177131f9fd94 (diff)
parent854eba0c53505190adb8fdd32cbdaed318d8dfda (diff)
downloadCMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.zip
CMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.tar.gz
CMake-2670dd4ed1de4e7ae0b2f50bfad8f5a3b686ae9b.tar.bz2
Merge topic 'iface-public-modules' into release-3.31
854eba0c53 target_sources: Improve error message for CXX_MODULES on INTERFACE libraries cd179e7560 Tests/RunCMake/CXXModules: Rename FileSetModules cases to be more specific Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !10090
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTargetSourcesCommand.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmTargetSourcesCommand.cxx b/Source/cmTargetSourcesCommand.cxx
index babbaa5..cdb9836 100644
--- a/Source/cmTargetSourcesCommand.cxx
+++ b/Source/cmTargetSourcesCommand.cxx
@@ -265,6 +265,18 @@ bool TargetSourcesImpl::HandleOneFileSet(
return false;
}
+ if (cmFileSetVisibilityIsForSelf(visibility) &&
+ this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY &&
+ !this->Target->IsImported()) {
+ if (type == "CXX_MODULES"_s) {
+ this->SetError(R"(File set TYPE "CXX_MODULES" may not have "PUBLIC" )"
+ R"(or "PRIVATE" visibility on INTERFACE libraries.)");
+ return false;
+ }
+ }
+
+ // FIXME(https://wg21.link/P3470): This condition can go
+ // away when interface-only module units are a thing.
if (cmFileSetVisibilityIsForInterface(visibility) &&
!cmFileSetVisibilityIsForSelf(visibility) &&
!this->Target->IsImported()) {