|
|
@@ -246,9 +246,9 @@ struct UsageRequirementProperty
|
|
|
{
|
|
|
}
|
|
|
|
|
|
- void CopyFromDirectory(cmBTStringRange directoryEntries)
|
|
|
+ void CopyFromEntries(cmBTStringRange entries)
|
|
|
{
|
|
|
- return cm::append(this->Entries, directoryEntries);
|
|
|
+ return cm::append(this->Entries, entries);
|
|
|
}
|
|
|
|
|
|
enum class Action
|
|
|
@@ -673,6 +673,11 @@ public:
|
|
|
UsageRequirementProperty InterfaceLinkLibraries;
|
|
|
UsageRequirementProperty InterfaceLinkLibrariesDirect;
|
|
|
UsageRequirementProperty InterfaceLinkLibrariesDirectExclude;
|
|
|
+ UsageRequirementProperty ImportedCxxModulesIncludeDirectories;
|
|
|
+ UsageRequirementProperty ImportedCxxModulesCompileDefinitions;
|
|
|
+ UsageRequirementProperty ImportedCxxModulesCompileFeatures;
|
|
|
+ UsageRequirementProperty ImportedCxxModulesCompileOptions;
|
|
|
+ UsageRequirementProperty ImportedCxxModulesLinkLibraries;
|
|
|
|
|
|
FileSetType HeadersFileSets;
|
|
|
FileSetType CxxModulesFileSets;
|
|
|
@@ -723,6 +728,14 @@ cmTargetInternals::cmTargetInternals()
|
|
|
, InterfaceLinkLibrariesDirect("INTERFACE_LINK_LIBRARIES_DIRECT"_s)
|
|
|
, InterfaceLinkLibrariesDirectExclude(
|
|
|
"INTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE"_s)
|
|
|
+ , ImportedCxxModulesIncludeDirectories(
|
|
|
+ "IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES"_s)
|
|
|
+ , ImportedCxxModulesCompileDefinitions(
|
|
|
+ "IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS"_s)
|
|
|
+ , ImportedCxxModulesCompileFeatures(
|
|
|
+ "IMPORTED_CXX_MODULES_COMPILE_FEATURES"_s)
|
|
|
+ , ImportedCxxModulesCompileOptions("IMPORTED_CXX_MODULES_COMPILE_OPTIONS"_s)
|
|
|
+ , ImportedCxxModulesLinkLibraries("IMPORTED_CXX_MODULES_LINK_LIBRARIES"_s)
|
|
|
, HeadersFileSets("HEADERS"_s, "HEADER_DIRS"_s, "HEADER_SET"_s,
|
|
|
"HEADER_DIRS_"_s, "HEADER_SET_"_s, "Header"_s,
|
|
|
"The default header set"_s, "Header set"_s,
|
|
|
@@ -951,7 +964,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
|
|
if (this->IsNormal()) {
|
|
|
// Initialize the INCLUDE_DIRECTORIES property based on the current value
|
|
|
// of the same directory property:
|
|
|
- this->impl->IncludeDirectories.CopyFromDirectory(
|
|
|
+ this->impl->IncludeDirectories.CopyFromEntries(
|
|
|
this->impl->Makefile->GetIncludeDirectoriesEntries());
|
|
|
|
|
|
{
|
|
|
@@ -960,11 +973,11 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
|
|
sysInc.end());
|
|
|
}
|
|
|
|
|
|
- this->impl->CompileOptions.CopyFromDirectory(
|
|
|
+ this->impl->CompileOptions.CopyFromEntries(
|
|
|
this->impl->Makefile->GetCompileOptionsEntries());
|
|
|
- this->impl->LinkOptions.CopyFromDirectory(
|
|
|
+ this->impl->LinkOptions.CopyFromEntries(
|
|
|
this->impl->Makefile->GetLinkOptionsEntries());
|
|
|
- this->impl->LinkDirectories.CopyFromDirectory(
|
|
|
+ this->impl->LinkDirectories.CopyFromEntries(
|
|
|
this->impl->Makefile->GetLinkDirectoriesEntries());
|
|
|
}
|
|
|
|
|
|
@@ -1735,6 +1748,186 @@ cmBTStringRange cmTarget::GetLinkInterfaceDirectExcludeEntries() const
|
|
|
return cmMakeRange(this->impl->InterfaceLinkLibrariesDirectExclude.Entries);
|
|
|
}
|
|
|
|
|
|
+void cmTarget::CopyPolicyStatuses(cmTarget const* tgt)
|
|
|
+{
|
|
|
+ // Normal targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsNormal());
|
|
|
+ // Imported targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsImported());
|
|
|
+ // Only imported targets can be the source of a copy.
|
|
|
+ assert(tgt->IsImported());
|
|
|
+
|
|
|
+ this->impl->PolicyMap = tgt->impl->PolicyMap;
|
|
|
+}
|
|
|
+
|
|
|
+void cmTarget::CopyImportedCxxModulesEntries(cmTarget const* tgt)
|
|
|
+{
|
|
|
+ // Normal targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsNormal());
|
|
|
+ // Imported targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsImported());
|
|
|
+ // Only imported targets can be the source of a copy.
|
|
|
+ assert(tgt->IsImported());
|
|
|
+
|
|
|
+ this->impl->IncludeDirectories.Entries.clear();
|
|
|
+ this->impl->IncludeDirectories.CopyFromEntries(
|
|
|
+ cmMakeRange(tgt->impl->ImportedCxxModulesIncludeDirectories.Entries));
|
|
|
+ this->impl->CompileDefinitions.Entries.clear();
|
|
|
+ this->impl->CompileDefinitions.CopyFromEntries(
|
|
|
+ cmMakeRange(tgt->impl->ImportedCxxModulesCompileDefinitions.Entries));
|
|
|
+ this->impl->CompileFeatures.Entries.clear();
|
|
|
+ this->impl->CompileFeatures.CopyFromEntries(
|
|
|
+ cmMakeRange(tgt->impl->ImportedCxxModulesCompileFeatures.Entries));
|
|
|
+ this->impl->CompileOptions.Entries.clear();
|
|
|
+ this->impl->CompileOptions.CopyFromEntries(
|
|
|
+ cmMakeRange(tgt->impl->ImportedCxxModulesCompileOptions.Entries));
|
|
|
+ this->impl->LinkLibraries.Entries.clear();
|
|
|
+ this->impl->LinkLibraries.CopyFromEntries(
|
|
|
+ cmMakeRange(tgt->impl->LinkLibraries.Entries));
|
|
|
+
|
|
|
+ // Copy the C++ module fileset entries from `tgt`'s `INTERFACE` to this
|
|
|
+ // target's `PRIVATE`.
|
|
|
+ this->impl->CxxModulesFileSets.SelfEntries.Entries.clear();
|
|
|
+ this->impl->CxxModulesFileSets.SelfEntries.Entries =
|
|
|
+ tgt->impl->CxxModulesFileSets.InterfaceEntries.Entries;
|
|
|
+}
|
|
|
+
|
|
|
+void cmTarget::CopyImportedCxxModulesProperties(cmTarget const* tgt)
|
|
|
+{
|
|
|
+ // Normal targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsNormal());
|
|
|
+ // Imported targets cannot be the target of a copy.
|
|
|
+ assert(!this->IsImported());
|
|
|
+ // Only imported targets can be the source of a copy.
|
|
|
+ assert(tgt->IsImported());
|
|
|
+
|
|
|
+ // The list of properties that are relevant here include:
|
|
|
+ // - compilation-specific properties for any language or platform
|
|
|
+ // - compilation-specific properties for C++
|
|
|
+ // - build graph-specific properties that affect compilation
|
|
|
+ // - IDE metadata properties
|
|
|
+ // - static analysis properties
|
|
|
+
|
|
|
+ static const std::string propertiesToCopy[] = {
|
|
|
+ // Compilation properties
|
|
|
+ "DEFINE_SYMBOL",
|
|
|
+ "DEPRECATION",
|
|
|
+ "NO_SYSTEM_FROM_IMPORTED",
|
|
|
+ "POSITION_INDEPENDENT_CODE",
|
|
|
+ "VISIBILITY_INLINES_HIDDEN",
|
|
|
+ // -- Platforms
|
|
|
+ // ---- Android
|
|
|
+ "ANDROID_API",
|
|
|
+ "ANDROID_API_MIN",
|
|
|
+ "ANDROID_ARCH",
|
|
|
+ "ANDROID_STL_TYPE",
|
|
|
+ // ---- macOS
|
|
|
+ "OSX_ARCHITECTURES",
|
|
|
+ // ---- Windows
|
|
|
+ "MSVC_DEBUG_INFORMATION_FORMAT",
|
|
|
+ "MSVC_RUNTIME_LIBRARY",
|
|
|
+ "VS_PLATFORM_TOOLSET",
|
|
|
+ // ---- OpenWatcom
|
|
|
+ "WATCOM_RUNTIME_LIBRARY",
|
|
|
+ // -- Language
|
|
|
+ // ---- C++
|
|
|
+ "CXX_COMPILER_LAUNCHER",
|
|
|
+ "CXX_STANDARD",
|
|
|
+ "CXX_STANDARD_REQUIRED",
|
|
|
+ "CXX_EXTENSIONS",
|
|
|
+ "CXX_VISIBILITY_PRESET",
|
|
|
+
|
|
|
+ // Static analysis
|
|
|
+ "CXX_CLANG_TIDY",
|
|
|
+ "CXX_CLANG_TIDY_EXPORT_FIXES_DIR",
|
|
|
+ "CXX_CPPLINT",
|
|
|
+ "CXX_CPPCHECK",
|
|
|
+ "CXX_INCLUDE_WHAT_YOU_USE",
|
|
|
+
|
|
|
+ // Build graph properties
|
|
|
+ "EXCLUDE_FROM_ALL",
|
|
|
+ "EXCLUDE_FROM_DEFAULT_BUILD",
|
|
|
+ "OPTIMIZE_DEPENDENCIES",
|
|
|
+ // -- Ninja
|
|
|
+ "JOB_POOL_COMPILE",
|
|
|
+ // -- Visual Studio
|
|
|
+ "VS_NO_COMPILE_BATCHING",
|
|
|
+ "VS_PROJECT_IMPORT",
|
|
|
+
|
|
|
+ // Metadata
|
|
|
+ "EchoString",
|
|
|
+ "EXPORT_COMPILE_COMMANDS",
|
|
|
+ "FOLDER",
|
|
|
+ "LABELS",
|
|
|
+ "PROJECT_LABEL",
|
|
|
+ "SYSTEM",
|
|
|
+ };
|
|
|
+
|
|
|
+ auto copyProperty = [this, tgt](std::string const& prop) -> cmValue {
|
|
|
+ cmValue value = tgt->GetProperty(prop);
|
|
|
+ // Always set the property; it may have been explicitly unset.
|
|
|
+ this->SetProperty(prop, value);
|
|
|
+ return value;
|
|
|
+ };
|
|
|
+
|
|
|
+ for (auto const& prop : propertiesToCopy) {
|
|
|
+ copyProperty(prop);
|
|
|
+ }
|
|
|
+
|
|
|
+ static const cm::static_string_view perConfigPropertiesToCopy[] = {
|
|
|
+ "EXCLUDE_FROM_DEFAULT_BUILD_"_s,
|
|
|
+ "IMPORTED_CXX_MODULES_"_s,
|
|
|
+ "MAP_IMPORTED_CONFIG_"_s,
|
|
|
+ "OSX_ARCHITECTURES_"_s,
|
|
|
+ };
|
|
|
+
|
|
|
+ std::vector<std::string> configNames =
|
|
|
+ this->impl->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
|
|
+ for (std::string const& configName : configNames) {
|
|
|
+ std::string configUpper = cmSystemTools::UpperCase(configName);
|
|
|
+ for (auto const& perConfigProp : perConfigPropertiesToCopy) {
|
|
|
+ copyProperty(cmStrCat(perConfigProp, configUpper));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (this->GetGlobalGenerator()->IsXcode()) {
|
|
|
+ cmValue xcodeGenerateScheme = copyProperty("XCODE_GENERATE_SCHEME");
|
|
|
+
|
|
|
+ // TODO: Make sure these show up on the imported target in the first place
|
|
|
+ // XCODE_ATTRIBUTE_???
|
|
|
+
|
|
|
+ if (xcodeGenerateScheme.IsOn()) {
|
|
|
+#ifdef __APPLE__
|
|
|
+ static const std::string xcodeSchemePropertiesToCopy[] = {
|
|
|
+ // FIXME: Do all of these apply? Do they matter?
|
|
|
+ "XCODE_SCHEME_ADDRESS_SANITIZER",
|
|
|
+ "XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN",
|
|
|
+ "XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER",
|
|
|
+ "XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS",
|
|
|
+ "XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE",
|
|
|
+ "XCODE_SCHEME_ENABLE_GPU_API_VALIDATION",
|
|
|
+ "XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION",
|
|
|
+ "XCODE_SCHEME_GUARD_MALLOC",
|
|
|
+ "XCODE_SCHEME_LAUNCH_CONFIGURATION",
|
|
|
+ "XCODE_SCHEME_MAIN_THREAD_CHECKER_STOP",
|
|
|
+ "XCODE_SCHEME_MALLOC_GUARD_EDGES",
|
|
|
+ "XCODE_SCHEME_MALLOC_SCRIBBLE",
|
|
|
+ "XCODE_SCHEME_MALLOC_STACK",
|
|
|
+ "XCODE_SCHEME_THREAD_SANITIZER",
|
|
|
+ "XCODE_SCHEME_THREAD_SANITIZER_STOP",
|
|
|
+ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER",
|
|
|
+ "XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP",
|
|
|
+ "XCODE_SCHEME_ZOMBIE_OBJECTS",
|
|
|
+ };
|
|
|
+
|
|
|
+ for (auto const& xcodeProperty : xcodeSchemePropertiesToCopy) {
|
|
|
+ copyProperty(xcodeProperty);
|
|
|
+ }
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
cmBTStringRange cmTarget::GetHeaderSetsEntries() const
|
|
|
{
|
|
|
return cmMakeRange(this->impl->HeadersFileSets.SelfEntries.Entries);
|
|
|
@@ -1777,6 +1970,11 @@ MAKE_PROP(IMPORTED);
|
|
|
MAKE_PROP(IMPORTED_GLOBAL);
|
|
|
MAKE_PROP(INCLUDE_DIRECTORIES);
|
|
|
MAKE_PROP(LINK_OPTIONS);
|
|
|
+MAKE_PROP(IMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES);
|
|
|
+MAKE_PROP(IMPORTED_CXX_MODULES_COMPILE_DEFINITIONS);
|
|
|
+MAKE_PROP(IMPORTED_CXX_MODULES_COMPILE_FEATURES);
|
|
|
+MAKE_PROP(IMPORTED_CXX_MODULES_COMPILE_OPTIONS);
|
|
|
+MAKE_PROP(IMPORTED_CXX_MODULES_LINK_LIBRARIES);
|
|
|
MAKE_PROP(LINK_DIRECTORIES);
|
|
|
MAKE_PROP(LINK_LIBRARIES);
|
|
|
MAKE_PROP(MANUALLY_ADDED_DEPENDENCIES);
|
|
|
@@ -1846,6 +2044,11 @@ void cmTarget::SetProperty(const std::string& prop, cmValue value)
|
|
|
&this->impl->InterfaceLinkLibraries,
|
|
|
&this->impl->InterfaceLinkLibrariesDirect,
|
|
|
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
|
|
+ &this->impl->ImportedCxxModulesIncludeDirectories,
|
|
|
+ &this->impl->ImportedCxxModulesCompileDefinitions,
|
|
|
+ &this->impl->ImportedCxxModulesCompileFeatures,
|
|
|
+ &this->impl->ImportedCxxModulesCompileOptions,
|
|
|
+ &this->impl->ImportedCxxModulesLinkLibraries,
|
|
|
};
|
|
|
|
|
|
for (auto* usageRequirement : usageRequirements) {
|
|
|
@@ -2019,6 +2222,11 @@ void cmTarget::AppendProperty(const std::string& prop,
|
|
|
&this->impl->InterfaceLinkLibraries,
|
|
|
&this->impl->InterfaceLinkLibrariesDirect,
|
|
|
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
|
|
+ &this->impl->ImportedCxxModulesIncludeDirectories,
|
|
|
+ &this->impl->ImportedCxxModulesCompileDefinitions,
|
|
|
+ &this->impl->ImportedCxxModulesCompileFeatures,
|
|
|
+ &this->impl->ImportedCxxModulesCompileOptions,
|
|
|
+ &this->impl->ImportedCxxModulesLinkLibraries,
|
|
|
};
|
|
|
|
|
|
for (auto* usageRequirement : usageRequirements) {
|
|
|
@@ -2445,6 +2653,11 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
|
|
|
propINTERFACE_LINK_LIBRARIES,
|
|
|
propINTERFACE_LINK_LIBRARIES_DIRECT,
|
|
|
propINTERFACE_LINK_LIBRARIES_DIRECT_EXCLUDE,
|
|
|
+ propIMPORTED_CXX_MODULES_INCLUDE_DIRECTORIES,
|
|
|
+ propIMPORTED_CXX_MODULES_COMPILE_DEFINITIONS,
|
|
|
+ propIMPORTED_CXX_MODULES_COMPILE_FEATURES,
|
|
|
+ propIMPORTED_CXX_MODULES_COMPILE_OPTIONS,
|
|
|
+ propIMPORTED_CXX_MODULES_LINK_LIBRARIES,
|
|
|
};
|
|
|
if (specialProps.count(prop)) {
|
|
|
if (prop == propC_STANDARD || prop == propCXX_STANDARD ||
|
|
|
@@ -2470,6 +2683,11 @@ cmValue cmTarget::GetProperty(const std::string& prop) const
|
|
|
&this->impl->InterfaceLinkLibraries,
|
|
|
&this->impl->InterfaceLinkLibrariesDirect,
|
|
|
&this->impl->InterfaceLinkLibrariesDirectExclude,
|
|
|
+ &this->impl->ImportedCxxModulesIncludeDirectories,
|
|
|
+ &this->impl->ImportedCxxModulesCompileDefinitions,
|
|
|
+ &this->impl->ImportedCxxModulesCompileFeatures,
|
|
|
+ &this->impl->ImportedCxxModulesCompileOptions,
|
|
|
+ &this->impl->ImportedCxxModulesLinkLibraries,
|
|
|
};
|
|
|
|
|
|
for (auto const* usageRequirement : usageRequirements) {
|
|
|
@@ -2675,6 +2893,9 @@ bool cmTarget::CanCompileSources() const
|
|
|
if (this->IsImported()) {
|
|
|
return false;
|
|
|
}
|
|
|
+ if (this->IsSynthetic()) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
switch (this->GetType()) {
|
|
|
case cmStateEnums::EXECUTABLE:
|
|
|
case cmStateEnums::STATIC_LIBRARY:
|