mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 20:00:51 -05:00
cmTarget: Replace "perConfig" constructor boolean with enum
This commit is contained in:
@@ -71,7 +71,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
|
|||||||
|
|
||||||
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
|
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
|
||||||
cmTarget::VisibilityNormal, tgt->Target->GetMakefile(),
|
cmTarget::VisibilityNormal, tgt->Target->GetMakefile(),
|
||||||
true);
|
cmTarget::PerConfig::Yes);
|
||||||
|
|
||||||
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
cmGeneratorTarget gDummyHead(&dummyHead, tgt->GetLocalGenerator());
|
||||||
|
|
||||||
|
|||||||
@@ -2535,7 +2535,7 @@ void cmGlobalGenerator::AddGlobalTarget_EditCache(
|
|||||||
}
|
}
|
||||||
GlobalTargetInfo gti;
|
GlobalTargetInfo gti;
|
||||||
gti.Name = editCacheTargetName;
|
gti.Name = editCacheTargetName;
|
||||||
gti.PerConfig = false;
|
gti.PerConfig = cmTarget::PerConfig::No;
|
||||||
cmCustomCommandLine singleLine;
|
cmCustomCommandLine singleLine;
|
||||||
|
|
||||||
// Use generator preference for the edit_cache rule if it is defined.
|
// Use generator preference for the edit_cache rule if it is defined.
|
||||||
@@ -2571,7 +2571,7 @@ void cmGlobalGenerator::AddGlobalTarget_RebuildCache(
|
|||||||
gti.Name = rebuildCacheTargetName;
|
gti.Name = rebuildCacheTargetName;
|
||||||
gti.Message = "Running CMake to regenerate build system...";
|
gti.Message = "Running CMake to regenerate build system...";
|
||||||
gti.UsesTerminal = true;
|
gti.UsesTerminal = true;
|
||||||
gti.PerConfig = false;
|
gti.PerConfig = cmTarget::PerConfig::No;
|
||||||
cmCustomCommandLine singleLine;
|
cmCustomCommandLine singleLine;
|
||||||
singleLine.push_back(cmSystemTools::GetCMakeCommand());
|
singleLine.push_back(cmSystemTools::GetCMakeCommand());
|
||||||
singleLine.push_back("--regenerate-during-build");
|
singleLine.push_back("--regenerate-during-build");
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ protected:
|
|||||||
std::vector<std::string> Depends;
|
std::vector<std::string> Depends;
|
||||||
std::string WorkingDir;
|
std::string WorkingDir;
|
||||||
bool UsesTerminal = false;
|
bool UsesTerminal = false;
|
||||||
bool PerConfig = true;
|
cmTarget::PerConfig PerConfig = cmTarget::PerConfig::Yes;
|
||||||
bool StdPipesUTF8 = false;
|
bool StdPipesUTF8 = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2081,11 +2081,11 @@ cmTarget* cmMakefile::AddExecutable(const std::string& exeName,
|
|||||||
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
|
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
|
||||||
const std::string& name)
|
const std::string& name)
|
||||||
{
|
{
|
||||||
auto it =
|
auto it = this->Targets
|
||||||
this->Targets
|
.emplace(name,
|
||||||
.emplace(name,
|
cmTarget(name, type, cmTarget::VisibilityNormal, this,
|
||||||
cmTarget(name, type, cmTarget::VisibilityNormal, this, true))
|
cmTarget::PerConfig::Yes))
|
||||||
.first;
|
.first;
|
||||||
this->OrderedTargets.push_back(&it->second);
|
this->OrderedTargets.push_back(&it->second);
|
||||||
this->GetGlobalGenerator()->IndexTarget(&it->second);
|
this->GetGlobalGenerator()->IndexTarget(&it->second);
|
||||||
this->GetStateSnapshot().GetDirectory().AddNormalTargetName(name);
|
this->GetStateSnapshot().GetDirectory().AddNormalTargetName(name);
|
||||||
@@ -4261,7 +4261,7 @@ cmTarget* cmMakefile::AddImportedTarget(const std::string& name,
|
|||||||
new cmTarget(name, type,
|
new cmTarget(name, type,
|
||||||
global ? cmTarget::VisibilityImportedGlobally
|
global ? cmTarget::VisibilityImportedGlobally
|
||||||
: cmTarget::VisibilityImported,
|
: cmTarget::VisibilityImported,
|
||||||
this, true));
|
this, cmTarget::PerConfig::Yes));
|
||||||
|
|
||||||
// Add to the set of available imported targets.
|
// Add to the set of available imported targets.
|
||||||
this->ImportedTargets[name] = target.get();
|
this->ImportedTargets[name] = target.get();
|
||||||
|
|||||||
+2
-2
@@ -215,7 +215,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||||
Visibility vis, cmMakefile* mf, bool perConfig)
|
Visibility vis, cmMakefile* mf, PerConfig perConfig)
|
||||||
: impl(cm::make_unique<cmTargetInternals>())
|
: impl(cm::make_unique<cmTargetInternals>())
|
||||||
{
|
{
|
||||||
assert(mf);
|
assert(mf);
|
||||||
@@ -231,7 +231,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
|||||||
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
|
(vis == VisibilityImported || vis == VisibilityImportedGlobally);
|
||||||
impl->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
|
impl->ImportedGloballyVisible = vis == VisibilityImportedGlobally;
|
||||||
impl->BuildInterfaceIncludesAppended = false;
|
impl->BuildInterfaceIncludesAppended = false;
|
||||||
impl->PerConfig = perConfig;
|
impl->PerConfig = (perConfig == PerConfig::Yes);
|
||||||
|
|
||||||
// Check whether this is a DLL platform.
|
// Check whether this is a DLL platform.
|
||||||
impl->IsDLLPlatform =
|
impl->IsDLLPlatform =
|
||||||
|
|||||||
+7
-1
@@ -45,8 +45,14 @@ public:
|
|||||||
VisibilityImportedGlobally
|
VisibilityImportedGlobally
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class PerConfig
|
||||||
|
{
|
||||||
|
Yes,
|
||||||
|
No
|
||||||
|
};
|
||||||
|
|
||||||
cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||||
Visibility vis, cmMakefile* mf, bool perConfig);
|
Visibility vis, cmMakefile* mf, PerConfig perConfig);
|
||||||
|
|
||||||
cmTarget(cmTarget const&) = delete;
|
cmTarget(cmTarget const&) = delete;
|
||||||
cmTarget(cmTarget&&) noexcept;
|
cmTarget(cmTarget&&) noexcept;
|
||||||
|
|||||||
Reference in New Issue
Block a user