TargetTypes: Extract target-related types to dedicated header

Move some target related enumeration types from `cmStateTypes.h` to a
new header, as these really aren't "state" types. Also, make
`TargetType` a strongly-typed enumeration.
This commit is contained in:
Matthew Woehlke
2026-07-01 14:44:11 -04:00
parent 1fde7f4599
commit a5a9ec9113
113 changed files with 1400 additions and 1341 deletions
+5 -5
View File
@@ -6,9 +6,9 @@
#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
bool cmAddExecutableCommand(std::vector<std::string> const& args,
cmExecutionStatus& status)
@@ -109,15 +109,15 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
return false;
}
cmTarget* aliasedTarget =
mf.FindTargetToUse(aliasedName, { cmStateEnums::TargetDomain::NATIVE });
mf.FindTargetToUse(aliasedName, { cm::TargetDomain::NATIVE });
if (!aliasedTarget) {
status.SetError(cmStrCat("cannot create ALIAS target \"", exename,
"\" because target \"", aliasedName,
"\" does not already exist."));
return false;
}
cmStateEnums::TargetType type = aliasedTarget->GetType();
if (type != cmStateEnums::EXECUTABLE) {
cm::TargetType type = aliasedTarget->GetType();
if (type != cm::TargetType::EXECUTABLE) {
status.SetError(cmStrCat("cannot create ALIAS target \"", exename,
"\" because target \"", aliasedName,
"\" is not an executable."));
@@ -140,7 +140,7 @@ bool cmAddExecutableCommand(std::vector<std::string> const& args,
}
// Create the imported target.
mf.AddImportedTarget(exename, cmStateEnums::EXECUTABLE, importGlobal);
mf.AddImportedTarget(exename, cm::TargetType::EXECUTABLE, importGlobal);
return true;
}