From d1627118e74f99f0dc647fe779a5d0a186dda0d9 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Wed, 1 Feb 2023 11:50:29 -0500 Subject: cmTarget: factor out executable-requiring properties --- Source/cmTarget.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b299435..9c90536 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -303,6 +303,8 @@ struct TargetProperty // Needs to be a linkable library target (no `OBJECT` or `MODULE` // libraries). LinkableLibraryTarget, + // Needs to be an executable. + ExecutableTarget, }; enum class Repetition @@ -433,6 +435,7 @@ TargetProperty const StaticTargetProperties[] = { { "AUTORCC_OPTIONS"_s, IC::CanCompileSources }, // Linking properties + { "ENABLE_EXPORTS"_s, IC::ExecutableTarget }, { "LINK_LIBRARIES_ONLY_TARGETS"_s, IC::NormalNonImportedTarget }, { "LINK_SEARCH_START_STATIC"_s, IC::CanCompileSources }, { "LINK_SEARCH_END_STATIC"_s, IC::CanCompileSources }, @@ -456,6 +459,7 @@ TargetProperty const StaticTargetProperties[] = { { "INSTALL_RPATH_USE_LINK_PATH"_s, "OFF"_s, IC::CanCompileSources }, // -- Platforms // ---- Android + { "ANDROID_GUI"_s, IC::ExecutableTarget }, { "ANDROID_JAR_DIRECTORIES"_s, IC::CanCompileSources }, { "ANDROID_JAR_DEPENDENCIES"_s, IC::CanCompileSources }, { "ANDROID_NATIVE_LIB_DIRECTORIES"_s, IC::CanCompileSources }, @@ -555,6 +559,7 @@ TargetProperty const StaticTargetProperties[] = { { "MAP_IMPORTED_CONFIG_"_s, IC::NormalTarget, R::PerConfig }, // Metadata + { "CROSSCOMPILING_EMULATOR"_s, IC::ExecutableTarget }, { "EXPORT_COMPILE_COMMANDS"_s, IC::CanCompileSources }, { "FOLDER"_s }, @@ -962,11 +967,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, this->impl->Makefile->GetLinkDirectoriesEntries()); } - if (this->impl->TargetType == cmStateEnums::EXECUTABLE) { - initProp("ANDROID_GUI"); - initProp("CROSSCOMPILING_EMULATOR"); - initProp("ENABLE_EXPORTS"); - } if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY || this->impl->TargetType == cmStateEnums::MODULE_LIBRARY) { this->SetProperty("POSITION_INDEPENDENT_CODE", "True"); @@ -1030,6 +1030,9 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, TargetProperty::InitCondition::LinkableLibraryTarget); } } + if (this->impl->TargetType == cmStateEnums::EXECUTABLE) { + metConditions.insert(TargetProperty::InitCondition::ExecutableTarget); + } std::vector configNames = mf->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig); -- cgit v0.12