diff options
Diffstat (limited to 'Source/cmTargetSourcesCommand.cxx')
-rw-r--r-- | Source/cmTargetSourcesCommand.cxx | 12 |
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()) { |