From 8207a3a266d85e64532a2a69ccea344fd645fe53 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Sun, 14 May 2023 17:23:19 -0400 Subject: cmDyndepCollation: add a query for visibility of an object's modules This will be used to hide private modules from the view of consuming targets. --- Source/cmDyndepCollation.cxx | 17 +++++++++++++++++ Source/cmDyndepCollation.h | 2 ++ 2 files changed, 19 insertions(+) diff --git a/Source/cmDyndepCollation.cxx b/Source/cmDyndepCollation.cxx index 53a262b..f45d81b 100644 --- a/Source/cmDyndepCollation.cxx +++ b/Source/cmDyndepCollation.cxx @@ -623,3 +623,20 @@ bool cmDyndepCollation::WriteDyndepMetadata( return result; } + +bool cmDyndepCollation::IsObjectPrivate( + std::string const& object, cmCxxModuleExportInfo const& export_info) +{ +#ifdef _WIN32 + std::string output_path = object; + cmSystemTools::ConvertToUnixSlashes(output_path); +#else + std::string const& output_path = object; +#endif + auto fileset_info_itr = export_info.ObjectToFileSet.find(output_path); + if (fileset_info_itr == export_info.ObjectToFileSet.end()) { + return false; + } + auto const& file_set = fileset_info_itr->second; + return !cmFileSetVisibilityIsForInterface(file_set.Visibility); +} diff --git a/Source/cmDyndepCollation.h b/Source/cmDyndepCollation.h index e70ac09..48afe2b 100644 --- a/Source/cmDyndepCollation.h +++ b/Source/cmDyndepCollation.h @@ -49,4 +49,6 @@ struct cmDyndepCollation std::vector const& objects, cmCxxModuleExportInfo const& export_info, cmDyndepMetadataCallbacks const& cb); + static bool IsObjectPrivate(std::string const& object, + cmCxxModuleExportInfo const& export_info); }; -- cgit v0.12