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
+2 -1
View File
@@ -522,13 +522,14 @@ add_library(
cmSystemTools.h
cmTarget.cxx
cmTarget.h
cmTargetExport.h
cmTargetPropertyComputer.cxx
cmTargetPropertyComputer.h
cmTargetPropertyEntry.cxx
cmTargetPropertyEntry.h
cmTargetExport.h
cmTargetTraceDependencies.cxx
cmTargetTraceDependencies.h
cmTargetTypes.h
cmTest.cxx
cmTest.h
cmTestGenerator.cxx
+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;
}
+34 -34
View File
@@ -10,10 +10,10 @@
#include "cmMessageType.h"
#include "cmPolicies.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
bool cmAddLibraryCommand(std::vector<std::string> const& args,
@@ -27,9 +27,9 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
cmMakefile& mf = status.GetMakefile();
// Library type defaults to value of BUILD_SHARED_LIBS, if it exists,
// otherwise it defaults to static library.
cmStateEnums::TargetType type = cmStateEnums::SHARED_LIBRARY;
cm::TargetType type = cm::TargetType::SHARED_LIBRARY;
if (mf.GetDefinition("BUILD_SHARED_LIBS").IsOff()) {
type = cmStateEnums::STATIC_LIBRARY;
type = cm::TargetType::STATIC_LIBRARY;
}
bool excludeFromAll = false;
bool importTarget = false;
@@ -50,52 +50,52 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
while (s != args.end()) {
std::string libType = *s;
if (libType == "STATIC") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting STATIC type.");
return false;
}
++s;
type = cmStateEnums::STATIC_LIBRARY;
type = cm::TargetType::STATIC_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "SHARED") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting SHARED type.");
return false;
}
++s;
type = cmStateEnums::SHARED_LIBRARY;
type = cm::TargetType::SHARED_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "MODULE") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting MODULE type.");
return false;
}
++s;
type = cmStateEnums::MODULE_LIBRARY;
type = cm::TargetType::MODULE_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "OBJECT") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting OBJECT type.");
return false;
}
++s;
type = cmStateEnums::OBJECT_LIBRARY;
type = cm::TargetType::OBJECT_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "UNKNOWN") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting UNKNOWN type.");
return false;
}
++s;
type = cmStateEnums::UNKNOWN_LIBRARY;
type = cm::TargetType::UNKNOWN_LIBRARY;
haveSpecifiedType = true;
} else if (libType == "ALIAS") {
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"INTERFACE library specified with conflicting ALIAS type.");
return false;
@@ -114,7 +114,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
return false;
}
++s;
type = cmStateEnums::INTERFACE_LIBRARY;
type = cm::TargetType::INTERFACE_LIBRARY;
haveSpecifiedType = true;
} else if (*s == "EXCLUDE_FROM_ALL") {
++s;
@@ -128,7 +128,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
} else if (importTarget && *s == "GLOBAL") {
++s;
importGlobal = true;
} else if (type == cmStateEnums::INTERFACE_LIBRARY && *s == "GLOBAL") {
} else if (type == cm::TargetType::INTERFACE_LIBRARY && *s == "GLOBAL") {
status.SetError(
"GLOBAL option may only be used with IMPORTED libraries.");
return false;
@@ -141,7 +141,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
importGlobal = mf.IsImportedTargetGlobalScope();
}
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
if (importGlobal && !importTarget) {
status.SetError(
"INTERFACE library specified as GLOBAL, but not as IMPORTED.");
@@ -196,20 +196,20 @@ bool cmAddLibraryCommand(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 \"", libName,
"\" because target \"", aliasedName,
"\" does not already exist."));
return false;
}
cmStateEnums::TargetType aliasedType = aliasedTarget->GetType();
if (aliasedType != cmStateEnums::SHARED_LIBRARY &&
aliasedType != cmStateEnums::STATIC_LIBRARY &&
aliasedType != cmStateEnums::MODULE_LIBRARY &&
aliasedType != cmStateEnums::OBJECT_LIBRARY &&
aliasedType != cmStateEnums::INTERFACE_LIBRARY &&
!(aliasedType == cmStateEnums::UNKNOWN_LIBRARY &&
cm::TargetType aliasedType = aliasedTarget->GetType();
if (aliasedType != cm::TargetType::SHARED_LIBRARY &&
aliasedType != cm::TargetType::STATIC_LIBRARY &&
aliasedType != cm::TargetType::MODULE_LIBRARY &&
aliasedType != cm::TargetType::OBJECT_LIBRARY &&
aliasedType != cm::TargetType::INTERFACE_LIBRARY &&
!(aliasedType == cm::TargetType::UNKNOWN_LIBRARY &&
aliasedTarget->IsImported())) {
status.SetError(cmStrCat("cannot create ALIAS target \"", libName,
"\" because target \"", aliasedName,
@@ -231,8 +231,8 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
CMAKE_${LANG}_CREATE_SHARED_LIBRARY is defined and if not default to
STATIC. But at this point we know only the name of the target, but not
yet its linker language. */
if ((type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) &&
if ((type == cm::TargetType::SHARED_LIBRARY ||
type == cm::TargetType::MODULE_LIBRARY) &&
!mf.GetState()->GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS")) {
switch (status.GetMakefile().GetPolicyStatus(cmPolicies::CMP0164)) {
case cmPolicies::WARN:
@@ -240,20 +240,20 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
cmDiagnostics::CMD_AUTHOR,
cmStrCat(
"ADD_LIBRARY called with ",
(type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE"),
(type == cm::TargetType::SHARED_LIBRARY ? "SHARED" : "MODULE"),
" option but the target platform does not support dynamic "
"linking. "
"Building a STATIC library instead. This may lead to problems."));
CM_FALLTHROUGH;
case cmPolicies::OLD:
type = cmStateEnums::STATIC_LIBRARY;
type = cm::TargetType::STATIC_LIBRARY;
break;
case cmPolicies::NEW:
mf.IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat(
"ADD_LIBRARY called with ",
(type == cmStateEnums::SHARED_LIBRARY ? "SHARED" : "MODULE"),
(type == cm::TargetType::SHARED_LIBRARY ? "SHARED" : "MODULE"),
" option but the target platform does not support dynamic "
"linking."));
cmSystemTools::SetFatalErrorOccurred();
@@ -270,7 +270,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
status.SetError("called with IMPORTED argument but no library type.");
return false;
}
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
if (!cmGeneratorExpression::IsValidTargetName(libName)) {
status.SetError(cmStrCat(
"Invalid name for IMPORTED INTERFACE library target: ", libName));
@@ -293,7 +293,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
}
// A non-imported target may not have UNKNOWN type.
if (type == cmStateEnums::UNKNOWN_LIBRARY) {
if (type == cm::TargetType::UNKNOWN_LIBRARY) {
mf.IssueMessage(
MessageType::FATAL_ERROR,
"The UNKNOWN library type may be used only for IMPORTED libraries.");
@@ -309,7 +309,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
}
}
if (type == cmStateEnums::INTERFACE_LIBRARY) {
if (type == cm::TargetType::INTERFACE_LIBRARY) {
if (!cmGeneratorExpression::IsValidTargetName(libName) ||
libName.find("::") != std::string::npos) {
status.SetError(
@@ -318,7 +318,7 @@ bool cmAddLibraryCommand(std::vector<std::string> const& args,
}
}
if (symbolicTarget && type != cmStateEnums::INTERFACE_LIBRARY) {
if (symbolicTarget && type != cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
"SYMBOLIC option may only be used with INTERFACE libraries");
return false;
+5 -3
View File
@@ -5,10 +5,12 @@
#include <string>
#include "cmStateTypes.h"
class cmRuntimeDependencyArchive;
namespace cm {
enum class TargetType;
} // namespace cm
class cmBinUtilsLinker
{
public:
@@ -18,7 +20,7 @@ public:
virtual bool Prepare() { return true; }
virtual bool ScanDependencies(std::string const& file,
cmStateEnums::TargetType type) = 0;
cm::TargetType type) = 0;
protected:
cmRuntimeDependencyArchive* Archive;
+2 -2
View File
@@ -89,8 +89,8 @@ bool cmBinUtilsLinuxELFLinker::Prepare()
return true;
}
bool cmBinUtilsLinuxELFLinker::ScanDependencies(
std::string const& file, cmStateEnums::TargetType /* unused */)
bool cmBinUtilsLinuxELFLinker::ScanDependencies(std::string const& file,
cm::TargetType /* unused */)
{
cmELF elf(file.c_str());
if (!elf) {
+1 -3
View File
@@ -13,7 +13,6 @@
#include "cmBinUtilsLinker.h"
#include "cmBinUtilsLinuxELFGetRuntimeDependenciesTool.h"
#include "cmLDConfigTool.h"
#include "cmStateTypes.h"
class cmRuntimeDependencyArchive;
@@ -24,8 +23,7 @@ public:
bool Prepare() override;
bool ScanDependencies(std::string const& file,
cmStateEnums::TargetType type) override;
bool ScanDependencies(std::string const& file, cm::TargetType type) override;
private:
std::unique_ptr<cmBinUtilsLinuxELFGetRuntimeDependenciesTool> Tool;
+4 -3
View File
@@ -14,6 +14,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
namespace {
bool IsMissingSystemDylib(std::string const& path)
@@ -73,11 +74,11 @@ auto cmBinUtilsMacOSMachOLinker::GetFileInfo(std::string const& file)
return &iter_inserted.first->second;
}
bool cmBinUtilsMacOSMachOLinker::ScanDependencies(
std::string const& file, cmStateEnums::TargetType type)
bool cmBinUtilsMacOSMachOLinker::ScanDependencies(std::string const& file,
cm::TargetType type)
{
std::string executableFile;
if (type == cmStateEnums::EXECUTABLE) {
if (type == cm::TargetType::EXECUTABLE) {
executableFile = file;
} else {
executableFile = this->Archive->GetBundleExecutable();
+1 -3
View File
@@ -10,7 +10,6 @@
#include "cmBinUtilsLinker.h"
#include "cmBinUtilsMacOSMachOGetRuntimeDependenciesTool.h"
#include "cmStateTypes.h"
class cmRuntimeDependencyArchive;
@@ -21,8 +20,7 @@ public:
bool Prepare() override;
bool ScanDependencies(std::string const& file,
cmStateEnums::TargetType type) override;
bool ScanDependencies(std::string const& file, cm::TargetType type) override;
private:
struct FileInfo
+4 -3
View File
@@ -16,6 +16,7 @@
#include "cmRuntimeDependencyArchive.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#ifdef _WIN32
# include <windows.h>
@@ -77,8 +78,8 @@ bool cmBinUtilsWindowsPELinker::Prepare()
return true;
}
bool cmBinUtilsWindowsPELinker::ScanDependencies(
std::string const& file, cmStateEnums::TargetType /* unused */)
bool cmBinUtilsWindowsPELinker::ScanDependencies(std::string const& file,
cm::TargetType /* unused */)
{
std::vector<std::string> needed;
if (!this->Tool->GetFileInfo(file, needed)) {
@@ -119,7 +120,7 @@ bool cmBinUtilsWindowsPELinker::ScanDependencies(
bool unique;
this->Archive->AddResolvedPath(lib.Original, path, unique);
if (unique &&
!this->ScanDependencies(path, cmStateEnums::SHARED_LIBRARY)) {
!this->ScanDependencies(path, cm::TargetType::SHARED_LIBRARY)) {
return false;
}
}
+1 -3
View File
@@ -8,7 +8,6 @@
#include "cmBinUtilsLinker.h"
#include "cmBinUtilsWindowsPEGetRuntimeDependenciesTool.h"
#include "cmStateTypes.h"
class cmRuntimeDependencyArchive;
@@ -19,8 +18,7 @@ public:
bool Prepare() override;
bool ScanDependencies(std::string const& file,
cmStateEnums::TargetType type) override;
bool ScanDependencies(std::string const& file, cm::TargetType type) override;
private:
std::unique_ptr<cmBinUtilsWindowsPEGetRuntimeDependenciesTool> Tool;
+6 -5
View File
@@ -30,6 +30,7 @@
#include "cmSubcommandTable.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include <cmllpkgc/llpkgc.h>
@@ -850,7 +851,7 @@ bool CheckPackageDependencies(
auto* tgt = imEnv.status.GetMakefile().FindTargetToUse(
cmStrCat("@foreign_pkgcfg::", prefix, dep.Name),
cmStateEnums::TargetDomain::FOREIGN);
cm::TargetDomain::FOREIGN);
if (tgt) {
auto ver = tgt->GetProperty("VERSION");
if (!cmPkgConfigResolver::CheckVersion(dep.VerReq, *ver)) {
@@ -982,7 +983,7 @@ bool HandlePopulateCommand(std::vector<std::string> const& args,
auto& mf = status.GetMakefile();
if (mf.FindTargetToUse(foreign_name, cmStateEnums::TargetDomain::FOREIGN)) {
if (mf.FindTargetToUse(foreign_name, cm::TargetDomain::FOREIGN)) {
mf.AddDefinition(found_var, "TRUE");
return true;
}
@@ -1022,7 +1023,7 @@ bool HandleImportCommand(std::vector<std::string> const& args,
return true;
}
if (!mf.FindTargetToUse(foreign_name, cmStateEnums::TargetDomain::FOREIGN)) {
if (!mf.FindTargetToUse(foreign_name, cm::TargetDomain::FOREIGN)) {
auto result = PopulatePCTarget(parsedArgs, status);
if (!result.second) {
mf.AddDefinition(found_var, "FALSE");
@@ -1031,8 +1032,8 @@ bool HandleImportCommand(std::vector<std::string> const& args,
}
mf.AddDefinition(found_var, "TRUE");
auto* tgt = mf.AddImportedTarget(
local_name, cmStateEnums::TargetType::INTERFACE_LIBRARY, false);
auto* tgt =
mf.AddImportedTarget(local_name, cm::TargetType::INTERFACE_LIBRARY, false);
tgt->AppendProperty("INTERFACE_LINK_LIBRARIES", foreign_name);
return true;
}
+4 -4
View File
@@ -26,9 +26,9 @@
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmCommonTargetGenerator::cmCommonTargetGenerator(cmGeneratorTarget* gt)
@@ -245,7 +245,7 @@ cmCommonTargetGenerator::GetLinkedTargetDirectories(
// We can ignore the INTERFACE_LIBRARY items because
// Target->GetLinkInformation already processed their
// link interface and they don't have any output themselves.
&& (mappedLinkee->GetType() != cmStateEnums::INTERFACE_LIBRARY
&& (mappedLinkee->GetType() != cm::TargetType::INTERFACE_LIBRARY
// Synthesized targets may have relevant rules.
|| mappedLinkee->IsSynthetic()) &&
((lang == "CXX"_s && mappedLinkee->HaveCxx20ModuleSources()) ||
@@ -298,7 +298,7 @@ std::string cmCommonTargetGenerator::ComputeTargetCompilePDB(
std::string const& config) const
{
std::string compilePdbPath;
if (this->GeneratorTarget->GetType() > cmStateEnums::OBJECT_LIBRARY) {
if (this->GeneratorTarget->GetType() > cm::TargetType::OBJECT_LIBRARY) {
return compilePdbPath;
}
@@ -312,7 +312,7 @@ std::string cmCommonTargetGenerator::ComputeTargetCompilePDB(
compilePdbPath += config;
}
compilePdbPath += "/";
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY) {
// Match VS default for static libs: `$(IntDir)$(ProjectName).pdb`.
compilePdbPath += this->GeneratorTarget->GetName();
compilePdbPath += ".pdb";
+25 -26
View File
@@ -32,9 +32,9 @@
#include "cmPolicies.h"
#include "cmRange.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -206,11 +206,11 @@ bool IsFeatureSupported(cmMakefile* makefile, std::string const& linkLanguage,
// LINK_LIBRARY feature attributes management
struct LinkLibraryFeatureAttributeSet
{
std::set<cmStateEnums::TargetType> LibraryTypes = {
cmStateEnums::EXECUTABLE, cmStateEnums::STATIC_LIBRARY,
cmStateEnums::SHARED_LIBRARY, cmStateEnums::MODULE_LIBRARY,
cmStateEnums::UNKNOWN_LIBRARY
};
std::set<cm::TargetType> LibraryTypes = { cm::TargetType::EXECUTABLE,
cm::TargetType::STATIC_LIBRARY,
cm::TargetType::SHARED_LIBRARY,
cm::TargetType::MODULE_LIBRARY,
cm::TargetType::UNKNOWN_LIBRARY };
std::set<std::string> Override;
enum DeduplicationKind
@@ -261,15 +261,16 @@ LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
cmTokenize(processingOption.match(2), ',')) {
if (value == "STATIC") {
featureAttributes.LibraryTypes.emplace(
cmStateEnums::STATIC_LIBRARY);
cm::TargetType::STATIC_LIBRARY);
} else if (value == "SHARED") {
featureAttributes.LibraryTypes.emplace(
cmStateEnums::SHARED_LIBRARY);
cm::TargetType::SHARED_LIBRARY);
} else if (value == "MODULE") {
featureAttributes.LibraryTypes.emplace(
cmStateEnums::MODULE_LIBRARY);
cm::TargetType::MODULE_LIBRARY);
} else if (value == "EXECUTABLE") {
featureAttributes.LibraryTypes.emplace(cmStateEnums::EXECUTABLE);
featureAttributes.LibraryTypes.emplace(
cm::TargetType::EXECUTABLE);
} else {
errorMessage += cmStrCat(" ", option, '\n');
break;
@@ -277,7 +278,7 @@ LinkLibraryFeatureAttributeSet const& GetLinkLibraryFeatureAttributes(
}
// Always add UNKNOWN type
featureAttributes.LibraryTypes.emplace(
cmStateEnums::UNKNOWN_LIBRARY);
cm::TargetType::UNKNOWN_LIBRARY);
} else if (processingOption.match(1) == "DEDUPLICATION") {
if (processingOption.match(2) == "YES") {
featureAttributes.Deduplication =
@@ -466,7 +467,7 @@ public:
for (auto index : libEntries) {
LinkEntry const& entry = this->Entries[index];
if (!entry.Target ||
entry.Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
entry.Target->GetType() != cm::TargetType::STATIC_LIBRARY) {
entries.emplace_back(index);
continue;
}
@@ -567,7 +568,7 @@ private:
return this->Deduplication == None ||
(this->Deduplication == Shared &&
(!entry.Target ||
entry.Target->GetType() != cmStateEnums::SHARED_LIBRARY)) ||
entry.Target->GetType() != cm::TargetType::SHARED_LIBRARY)) ||
(this->Deduplication == All && entry.Kind != LinkEntry::Library);
}
@@ -854,7 +855,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry qe)
if (cmLinkInterface const* iface =
entry.Target->GetLinkInterface(this->Config, this->Target)) {
bool const isIface =
entry.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY;
entry.Target->GetType() == cm::TargetType::INTERFACE_LIBRARY;
// This target provides its own link interface information.
this->AddLinkEntries(depender_index, iface->Libraries);
this->AddLinkObjects(iface->Objects);
@@ -1110,22 +1111,20 @@ void cmComputeLinkDepends::AddLinkEntries(cm::optional<size_t> depender_index,
auto const& itemFeature =
this->GetCurrentFeature(entry.Item.Value, item.Feature);
if (group && ale.second && entry.Target &&
(entry.Target->GetType() == cmStateEnums::TargetType::OBJECT_LIBRARY ||
entry.Target->GetType() ==
cmStateEnums::TargetType::INTERFACE_LIBRARY)) {
(entry.Target->GetType() == cm::TargetType::OBJECT_LIBRARY ||
entry.Target->GetType() == cm::TargetType::INTERFACE_LIBRARY)) {
supportedItem = false;
auto const& groupFeature = this->EntryList[group->first].Feature;
this->CMakeInstance->IssueDiagnostic(
cmDiagnostics::CMD_AUTHOR,
cmStrCat(
"The feature '", groupFeature,
"', specified as part of a generator-expression "
"'$",
LG_BEGIN, groupFeature, ">', will not be applied to the ",
(entry.Target->GetType() == cmStateEnums::TargetType::OBJECT_LIBRARY
? "OBJECT"
: "INTERFACE"),
" library '", entry.Item.Value, "'."),
cmStrCat("The feature '", groupFeature,
"', specified as part of a generator-expression "
"'$",
LG_BEGIN, groupFeature, ">', will not be applied to the ",
(entry.Target->GetType() == cm::TargetType::OBJECT_LIBRARY
? "OBJECT"
: "INTERFACE"),
" library '", entry.Item.Value, "'."),
this->Target->GetBacktrace());
}
// check if feature is applicable to this item
+24 -22
View File
@@ -31,6 +31,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmXcFramework.h"
#include "cmake.h"
@@ -286,7 +287,7 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// to use when creating a plugin (module) that obtains symbols from
// the program that will load it.
if (!this->Target->IsDLLPlatform() &&
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
this->Target->GetType() == cm::TargetType::MODULE_LIBRARY) {
std::string loader_flag_var =
cmStrCat("CMAKE_SHARED_MODULE_LOADER_", this->LinkLanguage, "_FLAG");
this->LoaderFlag = this->Makefile->GetDefinition(loader_flag_var);
@@ -324,10 +325,11 @@ cmComputeLinkInformation::cmComputeLinkInformation(
// Get options needed to specify RPATHs.
this->RuntimeUseChrpath = false;
if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
char const* tType = ((this->Target->GetType() == cmStateEnums::EXECUTABLE)
? "EXECUTABLE"
: "SHARED_LIBRARY");
if (this->Target->GetType() != cm::TargetType::STATIC_LIBRARY) {
char const* tType =
((this->Target->GetType() == cm::TargetType::EXECUTABLE)
? "EXECUTABLE"
: "SHARED_LIBRARY");
std::string rtVar =
cmStrCat("CMAKE_", tType, "_RUNTIME_", this->LinkLanguage, "_FLAG");
std::string rtSepVar = cmStrCat(rtVar, "_SEP");
@@ -527,10 +529,10 @@ bool cmComputeLinkInformation::Compute()
{
// Skip targets that do not link or have link-like information consumers may
// need (namely modules).
if (!(this->Target->GetType() == cmStateEnums::EXECUTABLE ||
this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
if (!(this->Target->GetType() == cm::TargetType::EXECUTABLE ||
this->Target->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->Target->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->Target->GetType() == cm::TargetType::STATIC_LIBRARY ||
(this->Target->CanCompileSources() &&
(this->Target->HaveCxxModuleSupport(this->Config) ==
cmGeneratorTarget::Cxx20SupportLevel::Supported ||
@@ -1157,7 +1159,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
? "__CMAKE_LINK_EXECUTABLE"
: entry.Feature));
this->Depends.push_back(std::move(exe));
} else if (tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
} else if (tgt->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
// Add the interface library as an item so it can be considered as part
// of COMPATIBLE_INTERFACE_ enforcement. The generators will ignore
// this for the actual link line.
@@ -1168,7 +1170,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
if (!libName.empty()) {
this->AddItem(BT<std::string>(libName, item.Backtrace));
}
} else if (tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
} else if (tgt->GetType() == cm::TargetType::OBJECT_LIBRARY) {
this->Items.emplace_back(item, ItemIsPath::No, tgt);
} else if (this->GlobalGenerator->IsXcode() &&
!tgt->GetImportedXcFrameworkPath(config).empty()) {
@@ -1196,7 +1198,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
return;
}
if (!this->LinkDependsNoShared ||
tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
tgt->GetType() != cm::TargetType::SHARED_LIBRARY) {
this->Depends.push_back(lib.Value);
}
@@ -1211,7 +1213,7 @@ void cmComputeLinkInformation::AddItem(LinkEntry const& entry)
} else {
this->AddLibraryRuntimeInfo(lib.Value, tgt);
}
if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
if (tgt && tgt->GetType() == cm::TargetType::SHARED_LIBRARY &&
this->Target->IsDLLPlatform()) {
this->AddRuntimeDLL(tgt);
}
@@ -1272,7 +1274,7 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
cmGeneratorTarget const* tgt = entry.Target;
// Record dependencies on DLLs.
if (tgt && tgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
if (tgt && tgt->GetType() == cm::TargetType::SHARED_LIBRARY &&
this->Target->IsDLLPlatform() &&
this->SharedDependencyMode != SharedDepModeLink) {
this->AddRuntimeDLL(tgt);
@@ -1288,7 +1290,7 @@ void cmComputeLinkInformation::AddSharedDepItem(LinkEntry const& entry)
if (tgt) {
// The target will provide a full path. Make sure it is a shared
// library.
if (tgt->GetType() != cmStateEnums::SHARED_LIBRARY) {
if (tgt->GetType() != cm::TargetType::SHARED_LIBRARY) {
return;
}
} else {
@@ -1390,13 +1392,13 @@ void cmComputeLinkInformation::ComputeLinkTypeInfo()
cmValue shared_link_type_flag = nullptr;
char const* target_type_str = nullptr;
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
target_type_str = "EXE";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
target_type_str = "SHARED_LIBRARY";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
target_type_str = "SHARED_MODULE";
break;
default:
@@ -1618,12 +1620,12 @@ void cmComputeLinkInformation::AddTargetItem(LinkEntry const& entry)
BT<std::string> const& item = entry.Item;
cmGeneratorTarget const* target = entry.Target;
if (target->GetType() != cmStateEnums::STATIC_LIBRARY) {
if (target->GetType() != cm::TargetType::STATIC_LIBRARY) {
this->SetCurrentLinkType(LinkShared);
}
// Keep track of shared library targets linked.
if (target->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (target->GetType() == cm::TargetType::SHARED_LIBRARY) {
this->SharedLibrariesLinked.insert(target);
}
@@ -2109,13 +2111,13 @@ void cmComputeLinkInformation::AddLibraryRuntimeInfo(
// Libraries with unknown type must be handled using just the file
// on disk.
if (target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
if (target->GetType() == cm::TargetType::UNKNOWN_LIBRARY) {
this->AddLibraryRuntimeInfo(fullPath);
return;
}
// Skip targets that are not shared libraries (modules cannot be linked).
if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
if (target->GetType() != cm::TargetType::SHARED_LIBRARY) {
return;
}
+13 -12
View File
@@ -21,11 +21,11 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocationKind.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -313,7 +313,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if (dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
if (dependee && dependee->GetType() == cm::TargetType::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
dependee = nullptr;
}
@@ -339,11 +339,11 @@ void cmComputeTargetDepends::AddObjectDepends(size_t depender_index,
cmLinkItem const& objItem =
depender->ResolveLinkItem(BT<std::string>(objLib));
if (emitted.insert(objItem).second) {
if (depender->GetType() != cmStateEnums::EXECUTABLE &&
depender->GetType() != cmStateEnums::STATIC_LIBRARY &&
depender->GetType() != cmStateEnums::SHARED_LIBRARY &&
depender->GetType() != cmStateEnums::MODULE_LIBRARY &&
depender->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (depender->GetType() != cm::TargetType::EXECUTABLE &&
depender->GetType() != cm::TargetType::STATIC_LIBRARY &&
depender->GetType() != cm::TargetType::SHARED_LIBRARY &&
depender->GetType() != cm::TargetType::MODULE_LIBRARY &&
depender->GetType() != cm::TargetType::OBJECT_LIBRARY) {
this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
"Only executables and libraries may reference target objects.",
@@ -367,7 +367,7 @@ void cmComputeTargetDepends::AddTargetDepend(size_t depender_index,
cmGeneratorTarget const* dependee = dependee_name.Target;
if (!dependee && !linking &&
(depender->GetType() != cmStateEnums::GLOBAL_TARGET)) {
(depender->GetType() != cm::TargetType::GLOBAL_TARGET)) {
this->GlobalGenerator->GetCMakeInstance()->IssueMessage(
MessageType::FATAL_ERROR,
cmStrCat("The dependency target \"", dependee_name.AsStr(),
@@ -378,7 +378,8 @@ void cmComputeTargetDepends::AddTargetDepend(size_t depender_index,
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if (linking && dependee && dependee->GetType() == cmStateEnums::EXECUTABLE &&
if (linking && dependee &&
dependee->GetType() == cm::TargetType::EXECUTABLE &&
!dependee->IsExecutableWithExports()) {
dependee = nullptr;
}
@@ -465,8 +466,8 @@ void cmComputeTargetDepends::ComputeIntermediateGraph()
auto const& initialEdges = this->InitialGraph[i];
auto& intermediateEdges = this->IntermediateGraph[i];
cmGeneratorTarget const* gt = this->Targets[i];
if (gt->GetType() != cmStateEnums::STATIC_LIBRARY &&
gt->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (gt->GetType() != cm::TargetType::STATIC_LIBRARY &&
gt->GetType() != cm::TargetType::OBJECT_LIBRARY) {
intermediateEdges = initialEdges;
} else {
if (cmValue optimizeDependencies =
@@ -614,7 +615,7 @@ bool cmComputeTargetDepends::CheckComponents(
// Make sure the component is all STATIC_LIBRARY targets.
for (size_t ni : nl) {
if (this->Targets[ni]->GetType() != cmStateEnums::STATIC_LIBRARY) {
if (this->Targets[ni]->GetType() != cm::TargetType::STATIC_LIBRARY) {
this->ComplainAboutBadComponent(ccg, c);
return false;
}
+13 -11
View File
@@ -29,9 +29,11 @@
#include "cmRange.h"
#include "cmScriptGenerator.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -312,7 +314,7 @@ Arguments cmCoreTryCompile::ParseArgs(
}
cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
Arguments& arguments, cmStateEnums::TargetType targetType)
Arguments& arguments, cm::TargetType targetType)
{
this->OutputFile.clear();
// which signature were we called with ?
@@ -376,12 +378,12 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
for (std::string const& i : *arguments.LinkLibraries) {
if (cmTarget* tgt = this->Makefile->FindTargetToUse(i)) {
switch (tgt->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if (tgt->IsExecutableWithExports()) {
break;
}
@@ -598,7 +600,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
// when the only language is ISPC we know that the output
// type must by a static library
if (testLangs.size() == 1 && testLangs.count("ISPC") == 1) {
targetType = cmStateEnums::STATIC_LIBRARY;
targetType = cm::TargetType::STATIC_LIBRARY;
}
std::string const tcConfig =
@@ -860,7 +862,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
auto const& aliasTarget =
this->Makefile->FindTargetToUse(alias->second);
// Create equivalent library/executable alias
if (aliasTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (aliasTarget->GetType() == cm::TargetType::EXECUTABLE) {
fprintf(fout, "add_executable(\"%s\" ALIAS \"%s\")\n", i.c_str(),
alias->second.c_str());
} else {
@@ -929,13 +931,13 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
"include(\"${CMAKE_ROOT}/Modules/Internal/"
"HeaderpadWorkaround.cmake\")\n");
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
/* Put the executable at a known location (for COPY_FILE). */
fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n",
this->BinaryDirectory.c_str());
/* Create the actual executable. */
fprintf(fout, "add_executable(%s)\n", targetName.c_str());
} else // if (targetType == cmStateEnums::STATIC_LIBRARY)
} else // if (targetType == cm::TargetType::STATIC_LIBRARY)
{
/* Put the static library at a known location (for COPY_FILE). */
fprintf(fout, "set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY \"%s\")\n",
@@ -1067,7 +1069,7 @@ cm::optional<cmTryCompileResult> cmCoreTryCompile::TryCompileCode(
options.emplace_back(cmScriptGenerator::Quote(option));
}
if (targetType == cmStateEnums::STATIC_LIBRARY) {
if (targetType == cm::TargetType::STATIC_LIBRARY) {
fprintf(fout,
"set_property(TARGET %s PROPERTY STATIC_LIBRARY_OPTIONS %s)\n",
targetName.c_str(), cmJoin(options, " ").c_str());
+6 -3
View File
@@ -15,13 +15,16 @@
#include "cmArgumentParser.h"
#include "cmArgumentParserTypes.h"
#include "cmList.h"
#include "cmStateTypes.h"
class cmConfigureLog;
class cmMakefile;
template <typename Iter>
class cmRange;
namespace cm {
enum class TargetType;
} // namespace cm
struct cmTryCompileResult
{
cm::optional<std::string> LogDescription;
@@ -125,8 +128,8 @@ public:
* This function requires at least two \p arguments and will crash if given
* fewer.
*/
cm::optional<cmTryCompileResult> TryCompileCode(
Arguments& arguments, cmStateEnums::TargetType targetType);
cm::optional<cmTryCompileResult> TryCompileCode(Arguments& arguments,
cm::TargetType targetType);
/**
* Returns \c true if \p path resides within a CMake temporary directory,
+4 -4
View File
@@ -20,9 +20,9 @@
#include "cmList.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmTransformDepfile.h"
#include "cmValue.h"
@@ -206,7 +206,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
// If the command references an executable target by name,
// collect the target to add a target-level dependency on it.
cmGeneratorTarget* gt = this->LG->FindGeneratorTargetToUse(argv.front());
if (gt && gt->GetType() == cmStateEnums::EXECUTABLE) {
if (gt && gt->GetType() == cm::TargetType::EXECUTABLE) {
// GetArgv0Location uses the command config, so use a cross-dependency.
bool const cross = true;
this->Utilities.emplace(BT<std::pair<std::string, bool>>(
@@ -292,7 +292,7 @@ void cmCustomCommandGenerator::FillEmulatorsWithArguments()
// launch it with its emulator.
std::string const& argv0 = this->CommandLines[c][0];
cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
if (target && target->GetType() == cmStateEnums::EXECUTABLE &&
if (target && target->GetType() == cm::TargetType::EXECUTABLE &&
!target->IsImported()) {
cmValue emulator_property =
@@ -326,7 +326,7 @@ char const* cmCustomCommandGenerator::GetArgv0Location(unsigned int c) const
// with the path to the executable artifact in the command config.
std::string const& argv0 = this->CommandLines[c][0];
cmGeneratorTarget* target = this->LG->FindGeneratorTargetToUse(argv0);
if (target && target->GetType() == cmStateEnums::EXECUTABLE &&
if (target && target->GetType() == cm::TargetType::EXECUTABLE &&
(target->IsImported() ||
target->GetProperty("CROSSCOMPILING_EMULATOR") ||
!this->LG->GetMakefile()->IsOn("CMAKE_CROSSCOMPILING"))) {
+13 -13
View File
@@ -12,9 +12,9 @@
#include "cmGeneratorTarget.h"
#include "cmLinkItem.h"
#include "cmList.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
cmExportAndroidMKGenerator::cmExportAndroidMKGenerator() = default;
@@ -66,8 +66,8 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
std::string const& lib = item.AsStr();
if (gt) {
if (gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (gt->GetType() == cm::TargetType::SHARED_LIBRARY ||
gt->GetType() == cm::TargetType::MODULE_LIBRARY) {
sharedLibs = cmStrCat(std::move(sharedLibs), ' ', lib);
} else {
staticLibs = cmStrCat(std::move(staticLibs), ' ', lib);
@@ -119,7 +119,7 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
}
// Tell the NDK build system if prebuilt static libraries use C++.
if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (target->GetType() == cm::TargetType::STATIC_LIBRARY) {
cmLinkImplementation const* li =
target->GetLinkImplementation(config, cmGeneratorTarget::UseTo::Link);
if (cm::contains(li->Languages, "CXX")) {
@@ -128,19 +128,19 @@ void cmExportAndroidMKGenerator::GenerateInterfaceProperties(
}
switch (target->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
os << "include $(PREBUILT_SHARED_LIBRARY)\n";
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
os << "include $(PREBUILT_STATIC_LIBRARY)\n";
break;
case cmStateEnums::EXECUTABLE:
case cmStateEnums::UTILITY:
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::UTILITY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
os << "\n";
+7 -4
View File
@@ -11,10 +11,13 @@
#include <cm/string_view>
#include "cmExportFileGenerator.h"
#include "cmStateTypes.h"
class cmGeneratorTarget;
namespace cm {
enum class TargetType;
} // namespace cm
/** \class cmExportAndroidMKGenerator
* \brief Generate CMake configuration files exporting targets from a build or
* install tree.
@@ -51,9 +54,9 @@ protected:
bool GenerateImportFile(std::ostream& os) override;
virtual void GenerateImportHeaderCode(std::ostream& os,
std::string const& config = "") = 0;
virtual void GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType) = 0;
virtual void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target,
cm::TargetType targetType) = 0;
void GenerateImportTargetsConfig(std::ostream& /*os*/,
std::string const& /*config*/,
+1 -2
View File
@@ -10,7 +10,6 @@
#include "cmDiagnosticContext.h"
#include "cmGeneratorExpression.h"
#include "cmGeneratorTarget.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
@@ -57,7 +56,7 @@ void cmExportBuildAndroidMKGenerator::GenerateImportHeaderCode(
void cmExportBuildAndroidMKGenerator::GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType /*targetType*/)
cm::TargetType /*targetType*/)
{
std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
os << "include $(CLEAR_VARS)\n";
+3 -4
View File
@@ -9,7 +9,6 @@
#include "cmExportAndroidMKGenerator.h"
#include "cmExportBuildFileGenerator.h"
#include "cmStateTypes.h"
class cmDiagnosticContext;
@@ -39,9 +38,9 @@ protected:
bool GenerateMainFile(std::ostream& os) override;
void GenerateImportHeaderCode(std::ostream& os,
std::string const& config = "") override;
void GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType /*targetType*/) override;
void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target,
cm::TargetType /*targetType*/) override;
std::string GetCxxModulesDirectory() const override { return {}; }
};
+5 -4
View File
@@ -21,10 +21,10 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
cmExportBuildCMakeConfigGenerator::cmExportBuildCMakeConfigGenerator(
cmDiagnosticContext context)
@@ -45,7 +45,7 @@ bool cmExportBuildCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
sep = " ";
generatedInterfaceRequired |=
this->GetExportTargetType(te) == cmStateEnums::INTERFACE_LIBRARY;
this->GetExportTargetType(te) == cm::TargetType::INTERFACE_LIBRARY;
};
if (!this->CollectExports(visitor)) {
@@ -121,13 +121,14 @@ void cmExportBuildCMakeConfigGenerator::GenerateImportTargetsConfig(
// Collect import properties for this target.
ImportPropertyMap properties;
if (this->GetExportTargetType(target) != cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetExportTargetType(target) !=
cm::TargetType::INTERFACE_LIBRARY) {
this->SetImportLocationProperty(config, suffix, target, properties);
}
if (!properties.empty()) {
// Get the rest of the target details.
if (this->GetExportTargetType(target) !=
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
this->SetImportDetailProperties(config, suffix, target, properties);
this->SetImportLinkInterface(config, suffix,
cmGeneratorExpression::BuildInterface,
+5 -5
View File
@@ -49,17 +49,17 @@ void cmExportBuildFileGenerator::Compute(cmLocalGenerator* lg)
}
}
cmStateEnums::TargetType cmExportBuildFileGenerator::GetExportTargetType(
cm::TargetType cmExportBuildFileGenerator::GetExportTargetType(
cmGeneratorTarget const* target) const
{
cmStateEnums::TargetType targetType = target->GetType();
cm::TargetType targetType = target->GetType();
// An object library exports as an interface library if we cannot
// tell clients where to find the objects. This is sufficient
// to support transitive usage requirements on other targets that
// use the object library.
if (targetType == cmStateEnums::OBJECT_LIBRARY &&
if (targetType == cm::TargetType::OBJECT_LIBRARY &&
!target->Target->HasKnownObjectFileLocation(nullptr)) {
targetType = cmStateEnums::INTERFACE_LIBRARY;
targetType = cm::TargetType::INTERFACE_LIBRARY;
}
return targetType;
}
@@ -76,7 +76,7 @@ void cmExportBuildFileGenerator::SetImportLocationProperty(
// Get the makefile in which to lookup target information.
cmMakefile* mf = target->Makefile;
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
std::string prop = cmStrCat("IMPORTED_OBJECTS", suffix);
// Compute all the object files inside this target and setup
+2 -3
View File
@@ -15,7 +15,7 @@
#include "cmDiagnosticContext.h"
#include "cmDiagnostics.h"
#include "cmExportFileGenerator.h"
#include "cmStateTypes.h"
#include "cmTargetTypes.h"
class cmExportSet;
class cmGeneratorTarget;
@@ -87,8 +87,7 @@ public:
static cmDiagnosticContext CaptureContext(cmMakefile const& mf);
protected:
cmStateEnums::TargetType GetExportTargetType(
cmGeneratorTarget const* target) const;
cm::TargetType GetExportTargetType(cmGeneratorTarget const* target) const;
/** Walk the list of targets to be exported. Returns true iff no duplicates
are found. */
+5 -4
View File
@@ -21,8 +21,8 @@
#include "cmGeneratorTarget.h"
#include "cmList.h"
#include "cmPackageInfoArguments.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTargetTypes.h"
cmExportBuildPackageInfoGenerator::cmExportBuildPackageInfoGenerator(
cmPackageInfoArguments arguments, cmDiagnosticContext context)
@@ -50,7 +50,7 @@ bool cmExportBuildPackageInfoGenerator::GenerateMainFile(std::ostream& os)
// Create all the imported targets.
for (auto const& exp : this->Exports) {
cmGeneratorTarget* const target = exp.Target;
cmStateEnums::TargetType targetType = this->GetExportTargetType(target);
cm::TargetType targetType = this->GetExportTargetType(target);
Json::Value* const component =
this->GenerateImportTarget(components, target, targetType);
@@ -65,7 +65,7 @@ bool cmExportBuildPackageInfoGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceLinkLibrariesProperty(
target, cmGeneratorExpression::InstallInterface, properties);
if (targetType != cmStateEnums::INTERFACE_LIBRARY) {
if (targetType != cm::TargetType::INTERFACE_LIBRARY) {
auto configurations = Json::Value{ Json::objectValue };
// Add per-configuration properties.
@@ -109,7 +109,8 @@ void cmExportBuildPackageInfoGenerator::GenerateInterfacePropertiesConfig(
ImportPropertyMap properties;
assert(this->GetExportTargetType(target) != cmStateEnums::INTERFACE_LIBRARY);
assert(this->GetExportTargetType(target) !=
cm::TargetType::INTERFACE_LIBRARY);
this->SetImportLocationProperty(config, suffix, target, properties);
if (properties.empty()) {
return;
+9 -10
View File
@@ -24,10 +24,10 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmScriptGenerator.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmVersionMacros.h"
@@ -265,8 +265,7 @@ void cmExportCMakeConfigGenerator::GenerateExpectedTargetsCode(
}
void cmExportCMakeConfigGenerator::GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType)
std::ostream& os, cmGeneratorTarget const* target, cm::TargetType targetType)
{
// Construct the imported target name.
std::string targetName = this->Namespace;
@@ -276,25 +275,25 @@ void cmExportCMakeConfigGenerator::GenerateImportTargetCode(
// Create the imported target.
os << "# Create imported target " << targetName << "\n";
switch (targetType) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
os << "add_executable(" << targetName << " IMPORTED)\n";
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
os << "add_library(" << targetName << " STATIC IMPORTED)\n";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
os << "add_library(" << targetName << " SHARED IMPORTED)\n";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
os << "add_library(" << targetName << " MODULE IMPORTED)\n";
break;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
os << "add_library(" << targetName << " UNKNOWN IMPORTED)\n";
break;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
os << "add_library(" << targetName << " OBJECT IMPORTED)\n";
break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
if (target->IsSymbolic()) {
os << "if(CMAKE_VERSION VERSION_GREATER_EQUAL \"4.2.0\")\n"
" add_library("
+5 -2
View File
@@ -13,12 +13,15 @@
#include "cmExportFileGenerator.h"
#include "cmGeneratorExpression.h"
#include "cmStateTypes.h"
class cmGeneratorFileSet;
class cmGeneratorTarget;
class cmTargetExport;
namespace cm {
enum class TargetType;
} // namespace cm
/** \class cmExportCMakeConfigGenerator
* \brief Generate CMake configuration files exporting targets from a build or
* install tree.
@@ -56,7 +59,7 @@ protected:
void GenerateImportVersionCode(std::ostream& os);
virtual void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType);
cm::TargetType targetType);
virtual void GenerateImportPropertyCode(
std::ostream& os, std::string const& config, std::string const& suffix,
cmGeneratorTarget const* target, ImportPropertyMap const& properties,
+2 -2
View File
@@ -34,11 +34,11 @@
#include "cmPolicies.h"
#include "cmRange.h"
#include "cmSbomArguments.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSubcommandTable.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#if defined(__HAIKU__)
@@ -104,7 +104,7 @@ static bool ValidateExportableTarget(std::string const& name, cmMakefile& mf,
"\" which is not built by this project."));
return false;
}
if (target->GetType() == cmStateEnums::UTILITY) {
if (target->GetType() == cm::TargetType::UTILITY) {
status.SetError(cmStrCat("given custom target \"", name,
"\" which may not be exported."));
return false;
+7 -6
View File
@@ -26,10 +26,10 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmPropertyMap.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmExportFileGenerator::cmExportFileGenerator() = default;
@@ -283,7 +283,7 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget const* target,
std::set<std::string>& ifaceProperties,
std::string const& config)
{
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
// object libraries have no link information, so nothing to compute
return;
}
@@ -303,7 +303,8 @@ void getCompatibleInterfaceProperties(cmGeneratorTarget const* target,
cmComputeLinkInformation::ItemVector const& deps = info->GetItems();
for (auto const& dep : deps) {
if (!dep.Target || dep.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (!dep.Target ||
dep.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
continue;
}
getPropertyContents(dep.Target, "COMPATIBLE_INTERFACE_BOOL",
@@ -339,7 +340,7 @@ void cmExportFileGenerator::PopulateCompatibleInterfaceProperties(
getPropertyContents(gtarget, "COMPATIBLE_INTERFACE_NUMBER_MAX",
ifaceProperties);
if (gtarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (gtarget->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
std::vector<std::string> configNames =
gtarget->Target->GetMakefile()->GetGeneratorConfigs(
cmMakefile::IncludeEmptyConfig);
@@ -571,8 +572,8 @@ void cmExportFileGenerator::SetImportDetailProperties(
cmMakefile* mf = target->Makefile;
// Add the soname for unix shared libraries.
if (target->GetType() == cmStateEnums::SHARED_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (target->GetType() == cm::TargetType::SHARED_LIBRARY ||
target->GetType() == cm::TargetType::MODULE_LIBRARY) {
if (!target->IsDLLPlatform()) {
std::string prop;
std::string value;
+3 -3
View File
@@ -13,11 +13,11 @@
#include "cmGeneratorTarget.h"
#include "cmInstallExportGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
cmExportInstallAndroidMKGenerator::cmExportInstallAndroidMKGenerator(
cmInstallExportGenerator* iegen)
@@ -82,7 +82,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
for (std::unique_ptr<cmTargetExport> const& te :
this->IEGen->GetExportSet()->GetTargetExports()) {
// Collect import properties for this target.
if (te->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (te->Target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
std::string dest;
@@ -98,7 +98,7 @@ void cmExportInstallAndroidMKGenerator::GenerateImportHeaderCode(
void cmExportInstallAndroidMKGenerator::GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType /*targetType*/)
cm::TargetType /*targetType*/)
{
std::string targetName = cmStrCat(this->Namespace, target->GetExportName());
os << "include $(CLEAR_VARS)\n";
+3 -4
View File
@@ -10,7 +10,6 @@
#include "cmExportAndroidMKGenerator.h"
#include "cmExportInstallFileGenerator.h"
#include "cmStateTypes.h"
class cmGeneratorTarget;
class cmInstallExportGenerator;
@@ -47,9 +46,9 @@ protected:
bool GenerateMainFile(std::ostream& os) override;
void GenerateImportHeaderCode(std::ostream& os,
std::string const& config = "") override;
void GenerateImportTargetCode(
std::ostream& os, cmGeneratorTarget const* target,
cmStateEnums::TargetType /*targetType*/) override;
void GenerateImportTargetCode(std::ostream& os,
cmGeneratorTarget const* target,
cm::TargetType /*targetType*/) override;
void ComplainAboutMissingTarget(cmGeneratorTarget const* depender,
cmGeneratorTarget const* dependee,
@@ -22,10 +22,10 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmExportInstallCMakeConfigGenerator::cmExportInstallCMakeConfigGenerator(
@@ -67,10 +67,10 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
// Create all the imported targets.
for (cmTargetExport const* te : allTargets) {
cmGeneratorTarget* gt = te->Target;
cmStateEnums::TargetType targetType = this->GetExportTargetType(te);
cm::TargetType targetType = this->GetExportTargetType(te);
requiresConfigFiles =
requiresConfigFiles || targetType != cmStateEnums::INTERFACE_LIBRARY;
requiresConfigFiles || targetType != cm::TargetType::INTERFACE_LIBRARY;
this->GenerateImportTargetCode(os, gt, targetType);
@@ -89,7 +89,7 @@ bool cmExportInstallCMakeConfigGenerator::GenerateMainFile(std::ostream& os)
!this->ExportOld) {
this->SetRequiredCMakeVersion(2, 8, 12);
}
if (targetType == cmStateEnums::INTERFACE_LIBRARY) {
if (targetType == cm::TargetType::INTERFACE_LIBRARY) {
this->SetRequiredCMakeVersion(3, 0, 0);
}
if (gt->GetProperty("INTERFACE_SOURCES")) {
@@ -242,7 +242,7 @@ void cmExportInstallCMakeConfigGenerator::GenerateImportTargetsConfig(
this->GetExportSet()->GetTargetExports()) {
// Collect import properties for this target.
if (this->GetExportTargetType(te.get()) ==
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
+5 -5
View File
@@ -174,7 +174,7 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
// Store the property.
properties[prop] = value;
importedLocations.insert(prop);
} else if (itgen->GetTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
} else if (itgen->GetTarget()->GetType() == cm::TargetType::OBJECT_LIBRARY) {
// Construct the property name.
std::string prop = cmStrCat("IMPORTED_OBJECTS", suffix);
@@ -225,15 +225,15 @@ void cmExportInstallFileGenerator::SetImportLocationProperty(
}
}
cmStateEnums::TargetType cmExportInstallFileGenerator::GetExportTargetType(
cm::TargetType cmExportInstallFileGenerator::GetExportTargetType(
cmTargetExport const* targetExport) const
{
cmStateEnums::TargetType targetType = targetExport->Target->GetType();
cm::TargetType targetType = targetExport->Target->GetType();
// An OBJECT library installed with no OBJECTS DESTINATION
// is transformed to an INTERFACE library.
if (targetType == cmStateEnums::OBJECT_LIBRARY &&
if (targetType == cm::TargetType::OBJECT_LIBRARY &&
!targetExport->ObjectsGenerator) {
targetType = cmStateEnums::INTERFACE_LIBRARY;
targetType = cm::TargetType::INTERFACE_LIBRARY;
}
return targetType;
}
+2 -3
View File
@@ -16,7 +16,7 @@
#include "cmExportFileGenerator.h"
#include "cmGeneratorExpression.h"
#include "cmInstallExportGenerator.h"
#include "cmStateTypes.h"
#include "cmTargetTypes.h"
class cmGeneratorTarget;
class cmGeneratorFileSet;
@@ -69,8 +69,7 @@ public:
virtual std::string GetConfigImportFileGlob() const = 0;
protected:
cmStateEnums::TargetType GetExportTargetType(
cmTargetExport const* targetExport) const;
cm::TargetType GetExportTargetType(cmTargetExport const* targetExport) const;
virtual std::string const& GetExportName() const;
@@ -32,11 +32,11 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmPackageInfoArguments.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
cmExportInstallPackageInfoGenerator::cmExportInstallPackageInfoGenerator(
cmInstallExportGenerator* iegen, cmPackageInfoArguments arguments)
@@ -85,7 +85,7 @@ bool cmExportInstallPackageInfoGenerator::GenerateMainFile(std::ostream& os)
// Create all the imported targets.
for (cmTargetExport const* te : allTargets) {
cmGeneratorTarget* gt = te->Target;
cmStateEnums::TargetType targetType = this->GetExportTargetType(te);
cm::TargetType targetType = this->GetExportTargetType(te);
Json::Value* const component =
this->GenerateImportTarget(components, gt, targetType);
@@ -100,7 +100,7 @@ bool cmExportInstallPackageInfoGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceLinkLibrariesProperty(
gt, cmGeneratorExpression::InstallInterface, properties);
if (targetType != cmStateEnums::INTERFACE_LIBRARY) {
if (targetType != cm::TargetType::INTERFACE_LIBRARY) {
this->RequiresConfigFiles = true;
}
@@ -156,7 +156,7 @@ void cmExportInstallPackageInfoGenerator::GenerateImportTargetsConfig(
std::set<std::string> importedLocations;
if (this->GetExportTargetType(te.get()) !=
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
this->PopulateImportProperties(config, suffix, te.get(), properties,
importedLocations);
}
+7 -6
View File
@@ -32,6 +32,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
static std::string const kCPS_VERSION_STR = "0.14.1";
@@ -234,7 +235,7 @@ void cmExportPackageInfoGenerator::GeneratePackageRequires(
Json::Value* cmExportPackageInfoGenerator::GenerateImportTarget(
Json::Value& components, cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType) const
cm::TargetType targetType) const
{
auto const& name = target->GetExportName();
if (name.empty()) {
@@ -245,19 +246,19 @@ Json::Value* cmExportPackageInfoGenerator::GenerateImportTarget(
Json::Value& type = component["type"];
switch (targetType) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
type = "executable";
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
type = "archive";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
type = "dylib";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
type = "module";
break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
type = target->IsSymbolic() ? "symbolic" : "interface";
break;
default:
+5 -2
View File
@@ -13,7 +13,10 @@
#include "cmExportFileGenerator.h"
#include "cmFindPackageStack.h"
#include "cmStateTypes.h"
namespace cm {
enum class TargetType;
} // namespace cm
namespace Json {
class Value;
@@ -57,7 +60,7 @@ protected:
Json::Value GeneratePackageInfo() const;
Json::Value* GenerateImportTarget(Json::Value& components,
cmGeneratorTarget const* target,
cmStateEnums::TargetType targetType) const;
cm::TargetType targetType) const;
void GeneratePackageRequires(Json::Value& package) const;
+2 -2
View File
@@ -20,10 +20,10 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmExportTryCompileFileGenerator::cmExportTryCompileFileGenerator(
@@ -114,7 +114,7 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*prop);
cmTarget dummyHead("try_compile_dummy_exe", cmStateEnums::EXECUTABLE,
cmTarget dummyHead("try_compile_dummy_exe", cm::TargetType::EXECUTABLE,
cmTarget::Visibility::Normal, tgt->Target->GetMakefile(),
cmTarget::PerConfig::Yes);
dummyHead.SetIsForTryCompile();
+22 -22
View File
@@ -19,9 +19,9 @@
#include "cmMakefile.h"
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -293,7 +293,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
case cm::TargetType::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
@@ -301,7 +301,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
makeArgs);
}
} break;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if ((cmHasLiteralPrefix(targetName, "Nightly") &&
@@ -316,11 +316,11 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
this->AppendTarget(xml, targetName, nullptr, make, lg, compiler,
makeArgs);
break;
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY: {
cmGeneratorTarget* gt = target.get();
this->AppendTarget(xml, targetName, gt, make, lg, compiler,
makeArgs);
@@ -350,12 +350,12 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
auto const& targets = lg->GetGeneratorTargets();
for (auto const& target : targets) {
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::UTILITY: // can have sources since 2.6.3
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::UTILITY: // can have sources since 2.6.3
{
std::vector<cmSourceFile*> sources;
target->GetSourceFiles(
@@ -363,7 +363,7 @@ void cmExtraCodeBlocksGenerator::CreateNewProjectFile(
for (cmSourceFile* s : sources) {
// don't add source files from UTILITY target which have the
// GENERATED property set:
if (target->GetType() == cmStateEnums::UTILITY &&
if (target->GetType() == cm::TargetType::UTILITY &&
s->GetIsGenerated()) {
continue;
}
@@ -497,7 +497,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
if (target) {
int cbTargetType = this->GetCBTargetType(target);
std::string workingDir = lg->GetCurrentBinaryDirectory();
if (target->GetType() == cmStateEnums::EXECUTABLE) {
if (target->GetType() == cm::TargetType::EXECUTABLE) {
// Determine the directory where the executable target is created, and
// set the working directory to this dir.
cmValue runtimeOutputDir =
@@ -515,7 +515,7 @@ void cmExtraCodeBlocksGenerator::AppendTarget(
std::string buildType = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::string location;
if (target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
location = this->CreateDummyTargetFile(target);
} else {
location = target->GetLocation(buildType);
@@ -697,18 +697,18 @@ std::string cmExtraCodeBlocksGenerator::GetCBCompilerId(cmMakefile const* mf)
int cmExtraCodeBlocksGenerator::GetCBTargetType(cmGeneratorTarget* target)
{
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if ((target->IsWin32Executable(
target->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"))) ||
(target->GetPropertyAsBool("MACOSX_BUNDLE"))) {
return 0;
}
return 1;
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return 2;
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return 3;
default:
return 4;
+17 -17
View File
@@ -17,9 +17,9 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -120,7 +120,7 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
auto const& lgs = this->GlobalGenerator->GetLocalGenerators();
for (auto const& lg : lgs) {
for (auto const& lt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType type = lt->GetType();
cm::TargetType type = lt->GetType();
std::string const& outputDir = lg->GetCurrentBinaryDirectory();
std::string targetName = lt->GetName();
std::string filename = cmStrCat(outputDir, '/', targetName, ".project");
@@ -130,12 +130,12 @@ std::vector<std::string> cmExtraCodeLiteGenerator::CreateProjectsByTarget(
cmSystemTools::RelativePath(this->WorkspacePath, filename);
std::string visualname = targetName;
switch (type) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
visualname = cmStrCat("lib", visualname);
CM_FALLTHROUGH;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
xml->StartElement("Project");
xml->Attribute("Name", visualname);
xml->Attribute("Path", relafilename);
@@ -197,14 +197,14 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
{
std::string projectType;
switch (gt->GetType()) {
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
projectType = "Executable";
} break;
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
projectType = "Static Library";
} break;
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
projectType = "Dynamic Library";
} break;
default:
@@ -212,10 +212,10 @@ std::string cmExtraCodeLiteGenerator::CollectSourceFiles(
}
switch (gt->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
cmake const* cm = makefile->GetCMakeInstance();
std::vector<cmSourceFile*> sources;
gt->GetSourceFiles(sources,
@@ -551,9 +551,9 @@ void cmExtraCodeLiteGenerator::CreateNewProjectFile(
std::string targetName = gt->GetName();
std::string visualname = targetName;
switch (gt->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
visualname = "lib" + targetName;
break;
default:
+19 -18
View File
@@ -28,6 +28,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmXMLWriter.h"
#include "cmake.h"
@@ -507,14 +508,14 @@ void cmExtraEclipseCDT4Generator::CreateLinksForTargets(cmXMLWriter& xml)
for (auto const& target : targets) {
std::string linkName2 = cmStrCat(linkName, '/');
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY: {
char const* prefix =
(target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
: "[lib] ");
(target->GetType() == cm::TargetType::EXECUTABLE ? "[exe] "
: "[lib] ");
linkName2 += prefix;
linkName2 += target->GetName();
cmExtraEclipseCDT4Generator::AppendLinkedResource(
@@ -861,7 +862,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
for (auto const& lgen : this->GlobalGenerator->GetLocalGenerators()) {
auto const& targets = lgen->GetGeneratorTargets();
for (auto const& target : targets) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
std::vector<std::string> includeDirs;
@@ -924,7 +925,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
case cm::TargetType::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (subdir.empty()) {
@@ -932,7 +933,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
makeArgs, subdir, ": ");
}
} break;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if ((cmHasLiteralPrefix(targetName, "Nightly") &&
@@ -947,14 +948,14 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make,
makeArgs, subdir, ": ");
break;
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY: {
char const* prefix =
(target->GetType() == cmStateEnums::EXECUTABLE ? "[exe] "
: "[lib] ");
(target->GetType() == cm::TargetType::EXECUTABLE ? "[exe] "
: "[lib] ");
cmExtraEclipseCDT4Generator::AppendTarget(xml, targetName, make,
makeArgs, subdir, prefix);
std::string fastTarget = cmStrCat(targetName, "/fast");
@@ -980,7 +981,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
virtDir, "", "");
}
} break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
default:
break;
}
+8 -8
View File
@@ -15,9 +15,9 @@
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmExtraKateGenerator::cmExtraKateGenerator() = default;
@@ -124,7 +124,7 @@ void cmExtraKateGenerator::WriteTargets(cmLocalGenerator const& lg,
for (auto const& target : targets) {
std::string const& targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
case cm::TargetType::GLOBAL_TARGET: {
bool insertTarget = false;
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
@@ -146,7 +146,7 @@ void cmExtraKateGenerator::WriteTargets(cmLocalGenerator const& lg,
currentDir, homeOutputDir);
}
} break;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if ((cmHasLiteralPrefix(targetName, "Nightly") &&
@@ -161,11 +161,11 @@ void cmExtraKateGenerator::WriteTargets(cmLocalGenerator const& lg,
this->AppendTarget(fout, targetName, configs, make, makeArgs,
currentDir, homeOutputDir);
break;
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY: {
this->AppendTarget(fout, targetName, configs, make, makeArgs,
currentDir, homeOutputDir);
if (!this->UseNinja) {
+8 -8
View File
@@ -19,9 +19,9 @@
#include "cmMakefile.h"
#include "cmMessageType.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -190,7 +190,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
for (auto const& target : targets) {
std::string targetName = target->GetName();
switch (target->GetType()) {
case cmStateEnums::GLOBAL_TARGET: {
case cm::TargetType::GLOBAL_TARGET: {
// Only add the global targets from CMAKE_BINARY_DIR,
// not from the subdirs
if (lg->GetCurrentBinaryDirectory() == lg->GetBinaryDirectory()) {
@@ -199,7 +199,7 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
false);
}
} break;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
// Add all utility targets, except the Nightly/Continuous/
// Experimental-"sub"targets as e.g. NightlyStart
if ((cmHasLiteralPrefix(targetName, "Nightly") &&
@@ -215,11 +215,11 @@ void cmExtraSublimeTextGenerator::AppendAllTargets(
makefile, compiler.c_str(), sourceFileFlags,
false);
break;
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY: {
this->AppendTarget(fout, targetName, lg, target.get(), make.c_str(),
makefile, compiler.c_str(), sourceFileFlags,
false);
+35 -33
View File
@@ -53,6 +53,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -308,17 +309,17 @@ bool cmFastbuildNormalTargetGenerator::DetectBaseLinkerCommand(
}
linkFlags += cmJoin({ rpath, frameworkPath, linkPath }, " ");
cmStateEnums::TargetType const targetType = this->GeneratorTarget->GetType();
cm::TargetType const targetType = this->GeneratorTarget->GetType();
// Add OS X version flags, if any.
if (targetType == cmStateEnums::SHARED_LIBRARY ||
targetType == cmStateEnums::MODULE_LIBRARY) {
if (targetType == cm::TargetType::SHARED_LIBRARY ||
targetType == cm::TargetType::MODULE_LIBRARY) {
this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true);
this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false);
}
// Add Arch flags to link flags for binaries
if (targetType == cmStateEnums::SHARED_LIBRARY ||
targetType == cmStateEnums::MODULE_LIBRARY ||
targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::SHARED_LIBRARY ||
targetType == cm::TargetType::MODULE_LIBRARY ||
targetType == cm::TargetType::EXECUTABLE) {
this->LocalCommonGenerator->AddArchitectureFlags(
linkFlags, this->GeneratorTarget, linkLanguage, Config, arch);
this->UseLWYU = this->GetLocalGenerator()->AppendLWYUFlags(
@@ -336,10 +337,11 @@ bool cmFastbuildNormalTargetGenerator::DetectBaseLinkerCommand(
std::string const stdLibString = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", linkLanguage, "_STANDARD_LIBRARIES"));
LogMessage(cmStrCat("Target type: ", this->GeneratorTarget->GetType()));
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
LogMessage(cmStrCat("Target type: ",
static_cast<int>(this->GeneratorTarget->GetType())));
if (this->GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE ||
this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::MODULE_LIBRARY) {
vars.Objects = FASTBUILD_1_0_INPUT_PLACEHOLDER;
vars.LinkLibraries = stdLibString.c_str();
} else {
@@ -804,7 +806,7 @@ std::string cmFastbuildNormalTargetGenerator::GetLinkCommand() const
GeneratorTarget->GetCreateRuleVariable(linkLanguage, Config);
std::string res = this->Makefile->GetSafeDefinition(linkCmdVar);
if (res.empty() &&
this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY) {
linkCmdVar = linkCmdVar =
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_CREATE");
res = this->Makefile->GetSafeDefinition(linkCmdVar);
@@ -874,7 +876,7 @@ void cmFastbuildNormalTargetGenerator::ComputePaths(
target.Variables["TargetOutDir"] =
cmSystemTools::ConvertToOutputPath(this->ConvertToFastbuildPath(objPath));
if (GeneratorTarget->GetType() <= cmStateEnums::MODULE_LIBRARY) {
if (GeneratorTarget->GetType() <= cm::TargetType::MODULE_LIBRARY) {
std::string const pdbDir = GeneratorTarget->GetPDBDirectory(Config);
LogMessage("GetPDBDirectory: " + pdbDir);
EnsureDirectoryExists(pdbDir);
@@ -945,7 +947,7 @@ void cmFastbuildNormalTargetGenerator::Generate()
auto const tname = dep->GetName();
LogMessage(tname);
FastbuildTargetDep targetDep{ tname };
if (dep->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (dep->GetType() == cm::TargetType::OBJECT_LIBRARY) {
targetDep.Type = FastbuildTargetDepType::ORDER_ONLY;
}
fastbuildTarget.PreBuildDependencies.emplace(std::move(targetDep));
@@ -1014,7 +1016,7 @@ void cmFastbuildNormalTargetGenerator::Generate()
AddPrebuildDeps(fastbuildTarget);
fastbuildTarget.IsGlobal =
GeneratorTarget->GetType() == cmStateEnums::GLOBAL_TARGET;
GeneratorTarget->GetType() == cm::TargetType::GLOBAL_TARGET;
fastbuildTarget.ExcludeFromAll =
this->GetGlobalGenerator()->IsExcluded(GeneratorTarget);
if (GeneratorTarget->GetPropertyAsBool("DONT_DISTRIBUTE")) {
@@ -1846,12 +1848,12 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
cmComputeLinkInformation::Item const& item) const
{
LogMessage("AppendTargetDep(...)");
cmStateEnums::TargetType const depType = item.Target->GetType();
LogMessage("Link dep type: " + std::to_string(depType));
cm::TargetType const depType = item.Target->GetType();
LogMessage("Link dep type: " + std::to_string(static_cast<int>(depType)));
LogMessage("Target name: " + item.Target->GetName());
auto const resolvedTargetName = ResolveIfAlias(item.Target->GetName());
LogMessage("Resolved: " + resolvedTargetName);
if (depType == cmStateEnums::INTERFACE_LIBRARY) {
if (depType == cm::TargetType::INTERFACE_LIBRARY) {
return;
}
std::string const feature = item.GetFeatureName();
@@ -1870,7 +1872,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
linkerNode.LinkerOptions += (" " + decorated);
return;
}
if (depType == cmStateEnums::UNKNOWN_LIBRARY) {
if (depType == cm::TargetType::UNKNOWN_LIBRARY) {
LogMessage("Unknown library -- adding to LibrarianAdditionalInputs or "
"Libraries2");
if (UsingCommandLine) {
@@ -1881,13 +1883,13 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
return;
}
// Tested in "ExportImport" test.
if (depType == cmStateEnums::EXECUTABLE) {
if (depType == cm::TargetType::EXECUTABLE) {
AppendExeToLink(linkerNode, item);
return;
}
// Skip exported objects.
// Tested in "ExportImport" test.
if (depType == cmStateEnums::OBJECT_LIBRARY) {
if (depType == cm::TargetType::OBJECT_LIBRARY) {
LogMessage("target : " + item.Target->GetName() +
" already linked... Skipping");
return;
@@ -1898,7 +1900,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
AppendLinkDep(linkerNode, linkDep);
}
} else {
if (depType == cmStateEnums::SHARED_LIBRARY &&
if (depType == cm::TargetType::SHARED_LIBRARY &&
this->GeneratorTarget->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED")) {
// It moves the dep outside of FASTBuild control, so the binary won't
// be re-built if the shared lib has changed.
@@ -1912,7 +1914,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
}
// Just add path to binary artifact to command line (except for OBJECT
// libraries which we will link directly).
if (UsingCommandLine && depType != cmStateEnums::OBJECT_LIBRARY) {
if (UsingCommandLine && depType != cm::TargetType::OBJECT_LIBRARY) {
// Take transitively linked objects into account,
// so we don't link them again.
AppendTransitivelyLinkedObjects(*item.Target, linkedObjects);
@@ -1931,7 +1933,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
}
std::string dep = resolvedTargetName +
(depType == cmStateEnums::OBJECT_LIBRARY
(depType == cm::TargetType::OBJECT_LIBRARY
? FASTBUILD_OBJECTS_ALIAS_POSTFIX
: FASTBUILD_LINK_ARTIFACTS_ALIAS_POSTFIX);
if (!linkerNode.Arch.empty()) {
@@ -1948,7 +1950,7 @@ void cmFastbuildNormalTargetGenerator::AppendTargetDep(
return;
}
if (depType != cmStateEnums::OBJECT_LIBRARY ||
if (depType != cm::TargetType::OBJECT_LIBRARY ||
linkedObjects.emplace(dep).second) {
AppendLinkDep(linkerNode, dep);
}
@@ -1965,7 +1967,7 @@ void cmFastbuildNormalTargetGenerator::AppendPrebuildDeps(
}
// In "RunCMake.FileAPI" imported object library "imported_object_lib" is
// added w/o import location...
if (item.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (item.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
return;
}
cmList const list{ GetImportedLoc(item) };
@@ -2203,7 +2205,7 @@ void cmFastbuildNormalTargetGenerator::AppendLinkDeps(
AppendTargetDep(linkerNode, linkedObjects, item);
AppendPrebuildDeps(linkerNode, item);
if (!item.Target->IsImported() &&
item.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
item.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
++numberOfDirectlyLinkedObjects;
cudaDeviceLinkLinkerNode.LibrarianAdditionalInputs.emplace_back(
cmStrCat(item.Target->GetName(), FASTBUILD_OBJECTS_ALIAS_POSTFIX));
@@ -2274,27 +2276,27 @@ void cmFastbuildNormalTargetGenerator::GenerateLink(
// Detection of the link command as follows:
auto const type = this->GeneratorTarget->GetType();
switch (type) {
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
LogMessage("Generating EXECUTABLE");
linkerNode.Type = FastbuildLinkerNode::EXECUTABLE;
break;
}
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::MODULE_LIBRARY: {
LogMessage("Generating MODULE_LIBRARY");
linkerNode.Type = FastbuildLinkerNode::SHARED_LIBRARY;
break;
}
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
LogMessage("Generating SHARED_LIBRARY");
linkerNode.Type = FastbuildLinkerNode::SHARED_LIBRARY;
break;
}
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
LogMessage("Generating STATIC_LIBRARY");
linkerNode.Type = FastbuildLinkerNode::STATIC_LIBRARY;
break;
}
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
LogMessage("Generating OBJECT_LIBRARY");
return;
}
@@ -2319,8 +2321,8 @@ void cmFastbuildNormalTargetGenerator::GenerateLink(
// Generate "Copy" nodes for copying Framework / Bundle resources.
AppendExtraResources(linkerNode.PreBuildDependencies);
if (type == cmStateEnums::EXECUTABLE ||
type == cmStateEnums::SHARED_LIBRARY) {
if (type == cm::TargetType::EXECUTABLE ||
type == cm::TargetType::SHARED_LIBRARY) {
// Tested in "RunCMake.BuildDepends" test (we need to rebuild when
// manifest changes).
std::copy(objectDepends.begin(), objectDepends.end(),
+11 -10
View File
@@ -35,6 +35,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#define FASTBUILD_DOLLAR_TAG "FASTBUILD_DOLLAR_TAG"
@@ -48,16 +49,16 @@ cmFastbuildTargetGenerator* cmFastbuildTargetGenerator::New(
cmGeneratorTarget* target, std::string config)
{
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return new cmFastbuildNormalTargetGenerator(target, std::move(config));
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
return new cmFastbuildUtilityTargetGenerator(target, std::move(config));
default:
@@ -735,7 +736,7 @@ std::string cmFastbuildTargetGenerator::MakeCustomLauncher(
std::string cmFastbuildTargetGenerator::GetTargetName() const
{
if (this->GeneratorTarget->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (this->GeneratorTarget->GetType() == cm::TargetType::GLOBAL_TARGET) {
return this->GetGlobalGenerator()->GetTargetName(GeneratorTarget);
}
return this->GeneratorTarget->GetName();
@@ -743,7 +744,7 @@ std::string cmFastbuildTargetGenerator::GetTargetName() const
cmGeneratorTarget::Names cmFastbuildTargetGenerator::DetectOutput() const
{
if (GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE) {
return GeneratorTarget->GetExecutableNames(Config);
}
return GeneratorTarget->GetLibraryNames(Config);
+4 -4
View File
@@ -16,10 +16,10 @@
#include "cmListFileCache.h"
#include "cmMakefile.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
cmFastbuildUtilityTargetGenerator::cmFastbuildUtilityTargetGenerator(
cmGeneratorTarget* gt, std::string configParam)
@@ -34,7 +34,7 @@ void cmFastbuildUtilityTargetGenerator::Generate()
}
std::string targetName = GeneratorTarget->GetName();
if (this->GeneratorTarget->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (this->GeneratorTarget->GetType() == cm::TargetType::GLOBAL_TARGET) {
targetName = GetGlobalGenerator()->GetTargetName(GeneratorTarget);
}
@@ -72,7 +72,7 @@ void cmFastbuildUtilityTargetGenerator::Generate()
// Since interface target don't appear in the generated build files,
// transitively propagate their deps (if any).
// Tested in "ExternalProjectSubdir" test.
if (target && target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (target && target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
for (auto const& dep : target->GetUtilities()) {
auto const& depName = this->ConvertToFastbuildPath(dep.Value.first);
LogMessage("Transitively propagating iface dep: " + depName +
@@ -150,7 +150,7 @@ void cmFastbuildUtilityTargetGenerator::Generate()
this->AdditionalCleanFiles();
fastbuildTarget.BasePath = this->GetMakefile()->GetCurrentSourceDirectory();
if (this->GetGeneratorTarget()->GetType() != cmStateEnums::GLOBAL_TARGET) {
if (this->GetGeneratorTarget()->GetType() != cm::TargetType::GLOBAL_TARGET) {
this->GetGlobalGenerator()->AddIDEProject(fastbuildTarget, Config);
}
this->GetGlobalGenerator()->AddTarget(std::move(fastbuildTarget));
+10 -9
View File
@@ -60,6 +60,7 @@
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -727,7 +728,7 @@ CodemodelConfig::DumpedTargets CodemodelConfig::DumpTargets()
});
for (cmGeneratorTarget* gt : targetList) {
if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (gt->GetType() == cm::TargetType::GLOBAL_TARGET) {
continue;
}
@@ -1265,7 +1266,7 @@ Json::Value Target::Dump()
{
Json::Value target = Json::objectValue;
cmStateEnums::TargetType const type = this->GT->GetType();
cm::TargetType const type = this->GT->GetType();
target["codemodelVersion"] =
cmFileAPI::BuildVersion(this->VersionMajor, this->VersionMinor);
@@ -1302,21 +1303,21 @@ Json::Value Target::Dump()
}
}
if (type == cmStateEnums::EXECUTABLE ||
type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) {
if (type == cm::TargetType::EXECUTABLE ||
type == cm::TargetType::SHARED_LIBRARY ||
type == cm::TargetType::MODULE_LIBRARY) {
target["nameOnDisk"] = this->GT->GetFullName(this->Config);
if (!this->GT->IsImported()) {
target["link"] = this->DumpLink();
}
} else if (type == cmStateEnums::STATIC_LIBRARY) {
} else if (type == cm::TargetType::STATIC_LIBRARY) {
target["nameOnDisk"] = this->GT->GetFullName(this->Config);
if (!this->GT->IsImported()) {
target["archive"] = this->DumpArchive();
}
}
if (type == cmStateEnums::EXECUTABLE) {
if (type == cm::TargetType::EXECUTABLE) {
Json::Value launchers = this->DumpLaunchers();
if (!launchers.empty()) {
target["launchers"] = std::move(launchers);
@@ -2208,7 +2209,7 @@ Json::Value Target::DumpArtifacts()
Json::Value artifacts = Json::arrayValue;
// Object libraries have only object files as artifacts.
if (this->GT->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (this->GT->GetType() == cm::TargetType::OBJECT_LIBRARY) {
if (!this->GT->Target->HasKnownObjectFileLocation(nullptr)) {
return artifacts;
}
@@ -2265,7 +2266,7 @@ Json::Value Target::DumpArtifacts()
}
}
if (this->GT->IsDLLPlatform() &&
this->GT->GetType() != cmStateEnums::STATIC_LIBRARY) {
this->GT->GetType() != cm::TargetType::STATIC_LIBRARY) {
cmGeneratorTarget::OutputInfo const* output =
this->GT->GetOutputInfo(this->Config);
if (output && !output->PdbDir.empty()) {
+1
View File
@@ -42,6 +42,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmVersionMacros.h"
#include "cmWindowsRegistry.h"
+31 -30
View File
@@ -54,6 +54,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -4841,12 +4842,12 @@ static const struct TargetObjectsNode : public cmGeneratorExpressionNode
reportError(eval, content->GetOriginalExpression(), e.str());
return std::string();
}
cmStateEnums::TargetType type = gt->GetType();
if (type != cmStateEnums::EXECUTABLE &&
type != cmStateEnums::STATIC_LIBRARY &&
type != cmStateEnums::SHARED_LIBRARY &&
type != cmStateEnums::MODULE_LIBRARY &&
type != cmStateEnums::OBJECT_LIBRARY) {
cm::TargetType type = gt->GetType();
if (type != cm::TargetType::EXECUTABLE &&
type != cm::TargetType::STATIC_LIBRARY &&
type != cm::TargetType::SHARED_LIBRARY &&
type != cm::TargetType::MODULE_LIBRARY &&
type != cm::TargetType::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not one of the allowed target types "
@@ -4970,10 +4971,10 @@ struct TargetRuntimeDllsBaseNode : public cmGeneratorExpressionNode
reportError(eval, content->GetOriginalExpression(), e.str());
return std::vector<std::string>();
}
cmStateEnums::TargetType type = gt->GetType();
if (type != cmStateEnums::EXECUTABLE &&
type != cmStateEnums::SHARED_LIBRARY &&
type != cmStateEnums::MODULE_LIBRARY) {
cm::TargetType type = gt->GetType();
if (type != cm::TargetType::EXECUTABLE &&
type != cm::TargetType::SHARED_LIBRARY &&
type != cm::TargetType::MODULE_LIBRARY) {
std::ostringstream e;
e << "Objects of target \"" << tgtName
<< "\" referenced but is not one of the allowed target types "
@@ -5337,7 +5338,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
"for DLL target platforms.");
return std::string();
}
if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
if (target->GetType() != cm::TargetType::SHARED_LIBRARY) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_SONAME_FILE is allowed only for "
"SHARED libraries.");
@@ -5370,7 +5371,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameImportTag>
"for DLL target platforms.");
return std::string();
}
if (target->GetType() != cmStateEnums::SHARED_LIBRARY) {
if (target->GetType() != cm::TargetType::SHARED_LIBRARY) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_SONAME_IMPORT_FILE is allowed only for "
"SHARED libraries.");
@@ -5419,11 +5420,11 @@ struct TargetFilesystemArtifactResultCreator<ArtifactPdbTag>
return std::string();
}
cmStateEnums::TargetType targetType = target->GetType();
cm::TargetType targetType = target->GetType();
if (targetType != cmStateEnums::SHARED_LIBRARY &&
targetType != cmStateEnums::MODULE_LIBRARY &&
targetType != cmStateEnums::EXECUTABLE) {
if (targetType != cm::TargetType::SHARED_LIBRARY &&
targetType != cm::TargetType::MODULE_LIBRARY &&
targetType != cm::TargetType::EXECUTABLE) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_PDB_FILE is allowed only for "
"targets with linker created artifacts.");
@@ -5469,7 +5470,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerLibraryTag>
{
// The file used to link to the target (.dylib, .so, .a).
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::EXECUTABLE) {
target->GetType() == cm::TargetType::EXECUTABLE) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_LINKER_LIBRARY_FILE is allowed only for libraries "
"with ENABLE_EXPORTS.");
@@ -5477,7 +5478,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactLinkerLibraryTag>
}
if (!target->IsDLLPlatform() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
target->GetType() == cm::TargetType::STATIC_LIBRARY) {
return target->GetFullPath(eval->Context.Config,
cmStateEnums::RuntimeBinaryArtifact);
}
@@ -5676,8 +5677,8 @@ protected:
cmStrCat("No target \"", name, '"'));
return nullptr;
}
if (target->GetType() >= cmStateEnums::OBJECT_LIBRARY &&
target->GetType() != cmStateEnums::UNKNOWN_LIBRARY) {
if (target->GetType() >= cm::TargetType::OBJECT_LIBRARY &&
target->GetType() != cm::TargetType::UNKNOWN_LIBRARY) {
::reportError(
eval, content->GetOriginalExpression(),
cmStrCat("Target \"", name, "\" is not an executable or library."));
@@ -5867,7 +5868,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerLibraryTag>
{
// The library file used to link to the target (.so, .lib, .a).
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::EXECUTABLE) {
target->GetType() == cm::TargetType::EXECUTABLE) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_LINKER_LIBRARY_FILE_BASE_NAME is allowed only for "
"libraries with ENABLE_EXPORTS.");
@@ -5875,7 +5876,7 @@ struct TargetOutputNameArtifactResultGetter<ArtifactLinkerLibraryTag>
}
if (!target->IsDLLPlatform() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
target->GetType() == cm::TargetType::STATIC_LIBRARY) {
auto output = target->GetOutputName(eval->Context.Config,
cmStateEnums::ImportLibraryArtifact);
return postfix != Postfix::Exclude
@@ -5942,11 +5943,11 @@ struct TargetOutputNameArtifactResultGetter<ArtifactPdbTag>
return std::string();
}
cmStateEnums::TargetType targetType = target->GetType();
cm::TargetType targetType = target->GetType();
if (targetType != cmStateEnums::SHARED_LIBRARY &&
targetType != cmStateEnums::MODULE_LIBRARY &&
targetType != cmStateEnums::EXECUTABLE) {
if (targetType != cm::TargetType::SHARED_LIBRARY &&
targetType != cm::TargetType::MODULE_LIBRARY &&
targetType != cm::TargetType::EXECUTABLE) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_PDB_FILE_BASE_NAME is allowed only for "
"targets with linker created artifacts.");
@@ -6107,7 +6108,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFilePrefixTag>
GeneratorExpressionContent const* content)
{
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::EXECUTABLE) {
target->GetType() == cm::TargetType::EXECUTABLE) {
::reportError(
eval, content->GetOriginalExpression(),
"TARGET_LINKER_LIBRARY_FILE_PREFIX is allowed only for libraries "
@@ -6116,7 +6117,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFilePrefixTag>
}
if (!target->IsDLLPlatform() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
target->GetType() == cm::TargetType::STATIC_LIBRARY) {
return target->GetFilePrefix(eval->Context.Config,
cmStateEnums::RuntimeBinaryArtifact);
}
@@ -6200,7 +6201,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFileSuffixTag>
GeneratorExpressionContent const* content)
{
if (!target->IsLinkable() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
target->GetType() == cm::TargetType::STATIC_LIBRARY) {
::reportError(eval, content->GetOriginalExpression(),
"TARGET_LINKER_LIBRARY_FILE_SUFFIX is allowed only for "
"libraries with ENABLE_EXPORTS.");
@@ -6208,7 +6209,7 @@ struct TargetFileArtifactResultGetter<ArtifactLinkerLibraryFileSuffixTag>
}
if (!target->IsDLLPlatform() ||
target->GetType() == cmStateEnums::STATIC_LIBRARY) {
target->GetType() == cm::TargetType::STATIC_LIBRARY) {
return target->GetFileSuffix(eval->Context.Config,
cmStateEnums::RuntimeBinaryArtifact);
}
+118 -117
View File
@@ -176,7 +176,7 @@ cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
return this->LocalGenerator;
}
cmStateEnums::TargetType cmGeneratorTarget::GetType() const
cm::TargetType cmGeneratorTarget::GetType() const
{
return this->Target->GetType();
}
@@ -254,7 +254,7 @@ char const* cmGeneratorTarget::GetOutputTargetType(
}
switch (this->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
if (this->IsDLLPlatform()) {
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
@@ -276,10 +276,10 @@ char const* cmGeneratorTarget::GetOutputTargetType(
}
}
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
// Static libraries are always treated as archive targets.
return "ARCHIVE";
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
// Module libraries are always treated as library targets.
@@ -289,10 +289,10 @@ char const* cmGeneratorTarget::GetOutputTargetType(
return "ARCHIVE";
}
break;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
// Object libraries are always treated as object targets.
return "OBJECT";
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
// Executables are always treated as runtime targets.
@@ -435,10 +435,10 @@ cmValue cmGeneratorTarget::GetFilePrefixInternal(
std::string const& language) const
{
// no prefix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
return nullptr;
}
@@ -453,9 +453,9 @@ cmValue cmGeneratorTarget::GetFilePrefixInternal(
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
artifact = cmStateEnums::RuntimeBinaryArtifact;
}
@@ -486,10 +486,10 @@ cmValue cmGeneratorTarget::GetFileSuffixInternal(
std::string const& language) const
{
// no suffix for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
return nullptr;
}
@@ -504,9 +504,9 @@ cmValue cmGeneratorTarget::GetFileSuffixInternal(
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
artifact = cmStateEnums::RuntimeBinaryArtifact;
}
@@ -1129,15 +1129,15 @@ bool cmGeneratorTarget::IsInBuildSystem() const
return false;
}
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
return true;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
// An INTERFACE library is in the build system if it has SOURCES
// or C++ module filesets.
if (!this->SourceEntries.empty() ||
@@ -1146,7 +1146,7 @@ bool cmGeneratorTarget::IsInBuildSystem() const
return true;
}
break;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
return false;
@@ -1368,7 +1368,7 @@ bool cmGeneratorTarget::HasSOName(std::string const& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
return ((this->GetType() == cmStateEnums::SHARED_LIBRARY) &&
return ((this->GetType() == cm::TargetType::SHARED_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
(this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)) ||
this->IsArchivedAIXSharedLibrary()));
@@ -1379,9 +1379,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
if (this->GetType() != cmStateEnums::EXECUTABLE &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY) {
if (this->GetType() != cm::TargetType::EXECUTABLE &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY) {
return false;
}
@@ -1451,9 +1451,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
bool cmGeneratorTarget::IsChrpathUsed(std::string const& config) const
{
// Only certain target types have an rpath.
if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->GetType() == cmStateEnums::EXECUTABLE)) {
if (!(this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->GetType() == cm::TargetType::EXECUTABLE)) {
return false;
}
@@ -1511,7 +1511,8 @@ bool cmGeneratorTarget::IsChrpathUsed(std::string const& config) const
bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
std::string const& config) const
{
if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (this->IsImported() &&
this->GetType() == cm::TargetType::SHARED_LIBRARY) {
if (cmGeneratorTarget::ImportInfo const* info =
this->GetImportInfo(config)) {
return info->NoSOName;
@@ -1542,7 +1543,7 @@ bool cmGeneratorTarget::DetermineHasMacOSXRpathInstallNameDir(
bool macosx_rpath = false;
if (!this->IsImported()) {
if (this->GetType() != cmStateEnums::SHARED_LIBRARY) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY) {
return false;
}
cmValue install_name = this->GetProperty("INSTALL_NAME_DIR");
@@ -1851,18 +1852,18 @@ cmGeneratorTarget::GetUtilities() const
bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
{
return this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::EXECUTABLE;
return this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::EXECUTABLE;
}
std::string const* cmGeneratorTarget::GetExportMacro() const
{
// Define the symbol for targets that export symbols.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY ||
if (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->IsExecutableWithExports()) {
if (cmValue custom_export_name = this->GetProperty("DEFINE_SYMBOL")) {
this->ExportMacro = *custom_export_name;
@@ -1888,8 +1889,8 @@ cmList const& cmGeneratorTarget::GetSharedLibraryCompileDefs(
auto emplaceResult =
this->SharedLibraryCompileDefs.emplace(config, cmList{});
auto& defs = emplaceResult.first->second;
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY) {
return defs;
}
@@ -1968,7 +1969,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
return nullptr;
}
if (this->GetType() > cmStateEnums::OBJECT_LIBRARY) {
if (this->GetType() > cm::TargetType::OBJECT_LIBRARY) {
std::string msg = cmStrCat("cmTarget::GetCompileInfo called for ",
this->GetName(), " which has type ",
cmState::GetTargetTypeName(this->GetType()));
@@ -1995,8 +1996,8 @@ cmGeneratorTarget::ModuleDefinitionInfo const*
cmGeneratorTarget::GetModuleDefinitionInfo(std::string const& config) const
{
// A module definition file only makes sense on certain target types.
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
!this->IsExecutableWithExports()) {
return nullptr;
}
@@ -2077,7 +2078,7 @@ void cmGeneratorTarget::TraceDependencies()
// would find nothing anyway, but when building CMake itself the "install"
// target command ends up referencing the "cmake" target but we do not
// really want the dependency because "install" depend on "all" anyway.
if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (this->GetType() == cm::TargetType::GLOBAL_TARGET) {
return;
}
@@ -2571,7 +2572,7 @@ cmGeneratorTarget::SourceVariables cmGeneratorTarget::GetSourceVariables(
mf->GetDefinition("MSVC_CUDA_ARCHITECTURE_ID")) {
std::string pdbPath;
std::string compilePdbPath;
if (targetType <= cmStateEnums::OBJECT_LIBRARY) {
if (targetType <= cm::TargetType::OBJECT_LIBRARY) {
compilePdbPath = this->GetCompilePDBPath(config);
if (compilePdbPath.empty()) {
// Match VS default: `$(IntDir)vc$(PlatformToolsetVersion).pdb`.
@@ -2581,17 +2582,17 @@ cmGeneratorTarget::SourceVariables cmGeneratorTarget::GetSourceVariables(
compilePdbPath = cmStrCat(compilePdbPath, '/', config);
}
compilePdbPath += '/';
if (targetType == cmStateEnums::STATIC_LIBRARY) {
if (targetType == cm::TargetType::STATIC_LIBRARY) {
// Match VS default for static libs: `$(IntDir)$(ProjectName).pdb`.
compilePdbPath = cmStrCat(compilePdbPath, this->GetName(), ".pdb");
}
}
}
if (targetType == cmStateEnums::EXECUTABLE ||
targetType == cmStateEnums::STATIC_LIBRARY ||
targetType == cmStateEnums::SHARED_LIBRARY ||
targetType == cmStateEnums::MODULE_LIBRARY) {
if (targetType == cm::TargetType::EXECUTABLE ||
targetType == cm::TargetType::STATIC_LIBRARY ||
targetType == cm::TargetType::SHARED_LIBRARY ||
targetType == cm::TargetType::MODULE_LIBRARY) {
pdbPath = cmStrCat(this->GetPDBDirectory(config), '/',
this->GetPDBName(config));
}
@@ -2988,18 +2989,18 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
std::string const& lang, std::string const& config) const
{
switch (this->GetType()) {
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
std::string var = cmStrCat("CMAKE_", lang, "_CREATE_STATIC_LIBRARY");
return this->GetFeatureSpecificLinkRuleVariable(var, lang, config);
}
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
if (this->IsArchivedAIXSharedLibrary()) {
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_LIBRARY_ARCHIVE");
}
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_LIBRARY");
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return cmStrCat("CMAKE_", lang, "_CREATE_SHARED_MODULE");
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if (this->IsExecutableWithExports()) {
std::string linkExeWithExports =
cmStrCat("CMAKE_", lang, "_LINK_EXECUTABLE_WITH_EXPORTS");
@@ -3530,11 +3531,11 @@ void cmGeneratorTarget::ComputeTargetManifest(std::string const& config) const
// Get the names.
cmGeneratorTarget::Names targetNames;
if (this->GetType() == cmStateEnums::EXECUTABLE) {
if (this->GetType() == cm::TargetType::EXECUTABLE) {
targetNames = this->GetExecutableNames(config);
} else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY) {
} else if (this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY) {
targetNames = this->GetLibraryNames(config);
} else {
return;
@@ -3755,7 +3756,7 @@ std::string cmGeneratorTarget::NormalGetRealName(
this->LocalGenerator->IssueMessage(MessageType::INTERNAL_ERROR, msg);
}
Names names = this->GetType() == cmStateEnums::EXECUTABLE
Names names = this->GetType() == cm::TargetType::EXECUTABLE
? this->GetExecutableNames(config)
: this->GetLibraryNames(config);
@@ -3837,8 +3838,8 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetLibraryNames(
}
// The import library names.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY) {
NameComponents const& importComponents =
this->GetFullNameInternalComponents(config,
cmStateEnums::ImportLibraryArtifact);
@@ -3894,7 +3895,7 @@ cmGeneratorTarget::Names cmGeneratorTarget::GetExecutableNames(
#else
// Check for executable version properties.
cmValue version = this->GetProperty("VERSION");
if (this->GetType() != cmStateEnums::EXECUTABLE ||
if (this->GetType() != cm::TargetType::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
version = nullptr;
}
@@ -3977,10 +3978,10 @@ cmGeneratorTarget::GetFullNameInternalComponents(
return search->second;
}
// Use just the target name for non-main target types.
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
NameComponents components;
components.base = this->GetName();
return cache.emplace(config, std::move(components)).first->second;
@@ -4007,9 +4008,9 @@ cmGeneratorTarget::GetFullNameInternalComponents(
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
artifact = cmStateEnums::RuntimeBinaryArtifact;
}
@@ -4057,7 +4058,7 @@ cmGeneratorTarget::GetFullNameInternalComponents(
if (this->IsDLLPlatform()) {
dllProp = this->GetProperty("DLL_NAME_WITH_SOVERSION");
}
if (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
if (this->GetType() == cm::TargetType::SHARED_LIBRARY &&
!isImportedLibraryArtifact &&
(dllProp.IsOn() ||
(!dllProp.IsSet() &&
@@ -4433,7 +4434,7 @@ void cmGeneratorTarget::GetTargetVersion(std::string const& property,
minor = 0;
patch = 0;
assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
assert(this->GetType() != cm::TargetType::INTERFACE_LIBRARY);
if (cmValue version = this->GetProperty(property)) {
// Try to parse the version number and store the results that were
@@ -4599,7 +4600,7 @@ cmGeneratorTarget::GetGeneratedISPCObjects(std::string const& config) const
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
assert(this->GetType() != cm::TargetType::INTERFACE_LIBRARY);
if (cmValue fversion = this->GetProperty("FRAMEWORK_VERSION")) {
return *fversion;
@@ -4783,12 +4784,12 @@ bool cmGeneratorTarget::ComputeOutputDir(std::string const& config,
if (out != *outdir) {
conf.clear();
}
} else if (this->GetType() == cmStateEnums::EXECUTABLE) {
} else if (this->GetType() == cm::TargetType::EXECUTABLE) {
// Lookup the output path for executables.
out = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
} else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY) {
} else if (this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY) {
// Lookup the output path for libraries.
out = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
}
@@ -4940,7 +4941,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
i = this->ImportInfoMap.insert(entry).first;
}
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return &i->second;
}
// If the location is empty then the target is not available for
@@ -4980,7 +4981,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
for (BT<std::string> const& entry : entries) {
info.Libraries.emplace_back(entry);
}
} else if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
} else if (this->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
std::string linkProp =
cmStrCat("IMPORTED_LINK_INTERFACE_LIBRARIES", suffix);
cmValue propertyLibs = this->GetProperty(linkProp);
@@ -5002,7 +5003,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
this->Target->GetLinkInterfaceDirectExcludeEntries()) {
info.LibrariesHeadExclude.emplace_back(entry);
}
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
if (loc) {
info.LibName = *loc;
}
@@ -5025,7 +5026,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the soname.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (this->GetType() == cm::TargetType::SHARED_LIBRARY) {
std::string soProp = cmStrCat("IMPORTED_SONAME", suffix);
if (cmValue config_soname = this->GetProperty(soProp)) {
info.SOName = *config_soname;
@@ -5035,7 +5036,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the "no-soname" mark.
if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (this->GetType() == cm::TargetType::SHARED_LIBRARY) {
std::string soProp = cmStrCat("IMPORTED_NO_SONAME", suffix);
if (cmValue config_no_soname = this->GetProperty(soProp)) {
info.NoSOName = config_no_soname.IsOn();
@@ -5047,7 +5048,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
// Get the import library.
if (imp) {
info.ImportLibrary = *imp;
} else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
} else if (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
std::string impProp = cmStrCat("IMPORTED_IMPLIB", suffix);
if (cmValue config_implib = this->GetProperty(impProp)) {
@@ -5092,7 +5093,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the cyclic repetition count.
if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GetType() == cm::TargetType::STATIC_LIBRARY) {
std::string linkProp =
cmStrCat("IMPORTED_LINK_INTERFACE_MULTIPLICITY", suffix);
if (cmValue config_reps = this->GetProperty(linkProp)) {
@@ -5273,9 +5274,9 @@ bool cmGeneratorTarget::IsLanguageUsed(std::string const& language,
bool cmGeneratorTarget::IsCSharpOnly() const
{
// Only certain target types may compile CSharp.
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
return false;
}
std::set<std::string> languages = this->GetAllConfigCompileLanguages();
@@ -5376,7 +5377,7 @@ bool CreateCxxStdlibTarget(cmMakefile* makefile, cmLocalGenerator* lg,
}
auto* stdlibTgt = makefile->AddLibrary(
"@cmake_cxx_std", cmStateEnums::STATIC_LIBRARY, {}, true);
"@cmake_cxx_std", cm::TargetType::STATIC_LIBRARY, {}, true);
cmCxxModuleMetadata::PopulateTarget(*stdlibTgt, *metadata, configs);
cmStandardLevelResolver standardResolver(makefile);
standardResolver.AddRequiredTargetFeature(stdlibTgt, "cxx_std_20");
@@ -5538,7 +5539,7 @@ cmGeneratorTarget const* cmGeneratorTarget::GetCxxSyntheticTarget(
auto* mf = this->Makefile;
auto* lg = this->GetLocalGenerator();
auto* tgt =
mf->AddSynthesizedTarget(cmStateEnums::INTERFACE_LIBRARY, targetName);
mf->AddSynthesizedTarget(cm::TargetType::INTERFACE_LIBRARY, targetName);
// Copy relevant information from the existing target.
@@ -5721,7 +5722,7 @@ bool cmGeneratorTarget::HasImportLibrary(std::string const& config) const
}
return (this->IsDLLPlatform() &&
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
(this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports()) &&
// Assemblies which have only managed code do not have
// import libraries.
@@ -5737,8 +5738,8 @@ bool cmGeneratorTarget::NeedImportLibraryName(std::string const& config) const
// On DLL platforms we always generate the import library name
// just in case the sources have export markup.
(this->IsDLLPlatform() &&
(this->GetType() == cmStateEnums::EXECUTABLE ||
this->GetType() == cmStateEnums::MODULE_LIBRARY));
(this->GetType() == cm::TargetType::EXECUTABLE ||
this->GetType() == cm::TargetType::MODULE_LIBRARY));
}
bool cmGeneratorTarget::GetUseShortObjectNames(
@@ -5807,20 +5808,20 @@ std::string cmGeneratorTarget::GetCMFSupportDirectory(
bool cmGeneratorTarget::IsLinkable() const
{
return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->GetType() == cmStateEnums::UNKNOWN_LIBRARY ||
this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
return (this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->GetType() == cm::TargetType::UNKNOWN_LIBRARY ||
this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
bool cmGeneratorTarget::HasLinkDependencyFile(std::string const& config) const
{
if (this->GetType() != cmStateEnums::EXECUTABLE &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY) {
if (this->GetType() != cm::TargetType::EXECUTABLE &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY) {
return false;
}
@@ -5854,9 +5855,9 @@ bool cmGeneratorTarget::IsImportedFrameworkFolderOnApple(
std::string const& config) const
{
if (this->IsApple() && this->IsImported() &&
(this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::UNKNOWN_LIBRARY)) {
(this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::UNKNOWN_LIBRARY)) {
std::string cfg = config;
if (cfg.empty() && this->GetGlobalGenerator()->IsXcode()) {
// FIXME(#25515): Remove the need for this workaround.
@@ -5884,8 +5885,8 @@ bool cmGeneratorTarget::IsXCTestOnApple() const
bool cmGeneratorTarget::IsCFBundleOnApple() const
{
return (this->GetType() == cmStateEnums::MODULE_LIBRARY && this->IsApple() &&
this->GetPropertyAsBool("BUNDLE"));
return (this->GetType() == cm::TargetType::MODULE_LIBRARY &&
this->IsApple() && this->GetPropertyAsBool("BUNDLE"));
}
cmGeneratorTarget::ManagedType cmGeneratorTarget::CheckManagedType(
@@ -5914,11 +5915,11 @@ cmGeneratorTarget::ManagedType cmGeneratorTarget::GetManagedType(
std::string const& config) const
{
// Only libraries and executables can be managed targets.
if (this->GetType() > cmStateEnums::SHARED_LIBRARY) {
if (this->GetType() > cm::TargetType::SHARED_LIBRARY) {
return ManagedType::Undefined;
}
if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GetType() == cm::TargetType::STATIC_LIBRARY) {
return ManagedType::Native;
}
@@ -5946,9 +5947,9 @@ std::string cmGeneratorTarget::GetImportedXcFrameworkPath(
std::string const& config) const
{
if (!(this->IsApple() && this->IsImported() &&
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::UNKNOWN_LIBRARY))) {
(this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::UNKNOWN_LIBRARY))) {
return {};
}
+3 -2
View File
@@ -29,6 +29,7 @@
#include "cmStandardLevel.h"
#include "cmStateTypes.h"
#include "cmTargetPropertyEntry.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
namespace cm {
@@ -119,7 +120,7 @@ public:
~CheckLinkLibrariesSuppressionRAII();
};
cmStateEnums::TargetType GetType() const;
cm::TargetType GetType() const;
std::string const& GetName() const;
std::string GetFamilyName() const;
std::string GetExportName() const;
@@ -392,7 +393,7 @@ public:
bool LinkLanguagePropagatesToDependents() const
{
return this->GetType() == cmStateEnums::STATIC_LIBRARY;
return this->GetType() == cm::TargetType::STATIC_LIBRARY;
}
/** Get the macro to define when building sources in this target.
@@ -27,9 +27,9 @@
#include "cmLocalGenerator.h"
#include "cmMessageType.h"
#include "cmRange.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
namespace {
@@ -66,8 +66,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0;
@@ -76,8 +76,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0;
@@ -86,8 +86,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0;
@@ -96,8 +96,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
std::string const& p, std::string const& config) const
{
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
@@ -258,7 +258,8 @@ void cmGeneratorTarget::CheckPropertyCompatibility(
static std::string const strNumMax = "COMPATIBLE_INTERFACE_NUMBER_MAX";
for (auto const& dep : deps) {
if (!dep.Target || dep.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (!dep.Target ||
dep.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
continue;
}
@@ -32,11 +32,11 @@
#include "cmPolicies.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
bool cmGeneratorTarget::AddHeaderSetVerification()
@@ -47,13 +47,13 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
continue;
}
if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::SHARED_LIBRARY &&
(this->GetType() != cmStateEnums::MODULE_LIBRARY || isInterface) &&
this->GetType() != cmStateEnums::UNKNOWN_LIBRARY &&
this->GetType() != cmStateEnums::OBJECT_LIBRARY &&
this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
this->GetType() != cmStateEnums::EXECUTABLE) {
if (this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::SHARED_LIBRARY &&
(this->GetType() != cm::TargetType::MODULE_LIBRARY || isInterface) &&
this->GetType() != cm::TargetType::UNKNOWN_LIBRARY &&
this->GetType() != cm::TargetType::OBJECT_LIBRARY &&
this->GetType() != cm::TargetType::INTERFACE_LIBRARY &&
this->GetType() != cm::TargetType::EXECUTABLE) {
continue;
}
@@ -80,7 +80,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
: "all_verify_private_header_sets";
cmTarget* allVerifyTarget =
this->GlobalGenerator->GetMakefiles().front()->FindTargetToUse(
allVerifyTargetName, { cmStateEnums::TargetDomain::NATIVE });
allVerifyTargetName, { cm::TargetDomain::NATIVE });
auto fileSetEntries = isInterface
? this->GetInterfaceFileSets(cm::FileSetMetadata::HEADERS)
@@ -100,7 +100,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
if (isInterface) {
cmPolicies::PolicyStatus const cmp0209 = this->GetPolicyStatusCMP0209();
if (cmp0209 != cmPolicies::NEW &&
this->GetType() == cmStateEnums::EXECUTABLE &&
this->GetType() == cm::TargetType::EXECUTABLE &&
!this->GetPropertyAsBool("ENABLE_EXPORTS")) {
if (cmp0209 == cmPolicies::WARN && !fileSets.empty()) {
this->Makefile->IssuePolicyWarning(
@@ -202,7 +202,7 @@ bool cmGeneratorTarget::AddHeaderSetVerification()
cmMakefile::PolicyPushPop polScope(this->Makefile);
this->Makefile->SetPolicy(cmPolicies::CMP0119, cmPolicies::NEW);
verifyTarget = this->Makefile->AddLibrary(
verifyTargetName, cmStateEnums::OBJECT_LIBRARY, {}, true);
verifyTargetName, cm::TargetType::OBJECT_LIBRARY, {}, true);
}
if (isInterface) {
+14 -14
View File
@@ -39,11 +39,11 @@
#include "cmRange.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocationKind.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -637,7 +637,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
// Link interfaces are not supported for executables that do not
// export symbols.
if (this->GetType() == cmStateEnums::EXECUTABLE &&
if (this->GetType() == cm::TargetType::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return nullptr;
}
@@ -675,23 +675,23 @@ void cmGeneratorTarget::ComputeLinkInterface(std::string const& config,
cmOptionalLinkInterface& iface,
bool secondPass) const
{
if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
std::set<cmLinkItem> emitted;
for (cmLinkItem const& lib : iface.Libraries) {
emitted.insert(lib);
}
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl =
this->GetLinkImplementation(config, UseTo::Link, secondPass);
for (cmLinkItem const& lib : impl->Libraries) {
if (emitted.insert(lib).second) {
if (lib.Target) {
// This is a runtime dependency on another shared library.
if (lib.Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (lib.Target->GetType() == cm::TargetType::SHARED_LIBRARY) {
iface.SharedDeps.push_back(lib);
}
} else {
@@ -713,7 +713,7 @@ void cmGeneratorTarget::ComputeLinkInterface(std::string const& config,
}
}
if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GetType() == cm::TargetType::STATIC_LIBRARY) {
// Construct the property name suffix for this configuration.
std::string suffix = "_";
if (!config.empty()) {
@@ -744,7 +744,7 @@ cmLinkInterfaceLibraries const* cmGeneratorTarget::GetLinkInterfaceLibraries(
// Link interfaces are not supported for executables that do not
// export symbols.
if (this->GetType() == cmStateEnums::EXECUTABLE &&
if (this->GetType() == cm::TargetType::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return nullptr;
}
@@ -793,8 +793,8 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// There is no implicit link interface for executables or modules
// so if none was explicitly set then there is no link interface.
if (!haveExplicitLibraries &&
(this->GetType() == cmStateEnums::EXECUTABLE ||
(this->GetType() == cmStateEnums::MODULE_LIBRARY))) {
(this->GetType() == cm::TargetType::EXECUTABLE ||
(this->GetType() == cm::TargetType::MODULE_LIBRARY))) {
return;
}
iface.Exists = true;
@@ -1172,8 +1172,8 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
std::string name = this->CheckCMP0004(lib);
if (this->GetPolicyStatusCMP0108() == cmPolicies::NEW) {
// resolve alias name
auto* target = this->Makefile->FindTargetToUse(
name, cmStateEnums::AllTargetDomains);
auto* target =
this->Makefile->FindTargetToUse(name, cm::AllTargetDomains);
if (target) {
name = target->GetName();
}
@@ -1306,7 +1306,7 @@ cmLinkItem cmGeneratorTarget::ResolveLinkItem(
// Skip targets that will not really be linked. This is probably a
// name conflict between an external library and an executable
// within the project.
if (resolved.Target->GetType() == cmStateEnums::EXECUTABLE &&
if (resolved.Target->GetType() == cm::TargetType::EXECUTABLE &&
!resolved.Target->IsExecutableWithExports()) {
return cmLinkItem(resolved.Target->GetName(), false, bt, linkFeature);
}
+8 -8
View File
@@ -41,10 +41,10 @@
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
#include "cmSourceGroup.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -62,7 +62,7 @@ void AddObjectEntries(cmGeneratorTarget const* headTarget,
entries.HadContextSensitiveCondition = impl->HadContextSensitiveCondition;
for (cmLinkItem const& lib : impl->Libraries) {
if (lib.Target &&
lib.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
lib.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
std::string uniqueName =
headTarget->GetGlobalGenerator()->IndexGeneratorTargetUniquely(
lib.Target);
@@ -246,7 +246,7 @@ std::vector<BT<std::string>> cmGeneratorTarget::GetSourceFilePaths(
// Collect TARGET_OBJECTS of direct object link-dependencies.
bool contextDependentObjects = false;
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (this->GetType() != cm::TargetType::OBJECT_LIBRARY) {
cm::EvaluatedTargetPropertyEntries linkObjectsEntries;
AddObjectEntries(this, context, &dagChecker, linkObjectsEntries);
contextDependentObjects = processSources(this, config, linkObjectsEntries,
@@ -425,8 +425,8 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
} else if (!this->Target->IsNormal() && !this->Target->IsImported() &&
fs && (fs->GetType() == cm::FileSetMetadata::CXX_MODULES)) {
kind = SourceKindCxxModuleSource;
} else if (this->Target->GetType() == cmStateEnums::UTILITY ||
this->Target->GetType() == cmStateEnums::INTERFACE_LIBRARY
} else if (this->Target->GetType() == cm::TargetType::UTILITY ||
this->Target->GetType() == cm::TargetType::INTERFACE_LIBRARY
// XXX(clang-tidy): https://bugs.llvm.org/show_bug.cgi?id=44165
// NOLINTNEXTLINE(bugprone-branch-clone)
) {
@@ -442,7 +442,7 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
} else if (!sf->GetOrDetermineLanguage().empty()) {
if (sf->GetOrDetermineLanguage() == "Rust") {
// NOLINTNEXTLINE(bugprone-branch-clone)
if (this->Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (this->Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
// There is no main crate root for object libraries.
kind = SourceKindObjectSource;
} else if (!rustMainCrateRootSf) {
@@ -464,12 +464,12 @@ void cmGeneratorTarget::ComputeKindedSources(KindedSources& files,
}
} else if (ext == "def") {
kind = SourceKindModuleDefinition;
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY) {
badObjLib.push_back(sf);
}
} else if (ext == "idl") {
kind = SourceKindIDL;
if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (this->GetType() == cm::TargetType::OBJECT_LIBRARY) {
badObjLib.push_back(sf);
}
} else if (ext == "resx") {
+9 -9
View File
@@ -32,10 +32,10 @@
#include "cmSourceGroup.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmGhsMultiTargetGenerator::cmGhsMultiTargetGenerator(cmGeneratorTarget* target)
@@ -61,7 +61,7 @@ void cmGhsMultiTargetGenerator::Generate()
{
// Determine type of target for this project
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
// Get the name of the executable to generate.
this->TargetNameReal =
this->GeneratorTarget->GetExecutableNames(this->ConfigName).Real;
@@ -72,36 +72,36 @@ void cmGhsMultiTargetGenerator::Generate()
}
break;
}
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
this->TargetNameReal =
this->GeneratorTarget->GetLibraryNames(this->ConfigName).Real;
this->TagType = GhsMultiGpj::LIBRARY;
break;
}
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
std::string msg =
cmStrCat("add_library(<name> SHARED ...) not supported: ", this->Name);
cmSystemTools::Message(msg);
return;
}
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
this->TargetNameReal =
this->GeneratorTarget->GetLibraryNames(this->ConfigName).Real;
this->TagType = GhsMultiGpj::SUBPROJECT;
break;
}
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::MODULE_LIBRARY: {
std::string msg =
cmStrCat("add_library(<name> MODULE ...) not supported: ", this->Name);
cmSystemTools::Message(msg);
return;
}
case cmStateEnums::UTILITY: {
case cm::TargetType::UTILITY: {
this->TargetNameReal = this->GeneratorTarget->GetName();
this->TagType = GhsMultiGpj::CUSTOM_TARGET;
break;
}
case cmStateEnums::GLOBAL_TARGET: {
case cm::TargetType::GLOBAL_TARGET: {
this->TargetNameReal = this->GeneratorTarget->GetName();
if (this->TargetNameReal ==
this->GetGlobalGenerator()->GetInstallTargetName()) {
@@ -120,7 +120,7 @@ void cmGhsMultiTargetGenerator::Generate()
void cmGhsMultiTargetGenerator::GenerateTarget()
{
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE &&
if (this->GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE &&
!this->GeneratorTarget
->GetLinkerTypeProperty(
this->GeneratorTarget->GetLinkerLanguage(this->ConfigName),
+3 -2
View File
@@ -19,6 +19,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -44,8 +45,8 @@ cmGlobalCommonGenerator::ComputeDirectoryTargets() const
// The directory-level rule should depend on the target-level rules
// for all targets in the directory.
for (auto const& gt : lg->GetGeneratorTargets()) {
cmStateEnums::TargetType const type = gt->GetType();
if (type == cmStateEnums::GLOBAL_TARGET || !gt->IsInBuildSystem()) {
cm::TargetType const type = gt->GetType();
if (type == cm::TargetType::GLOBAL_TARGET || !gt->IsInBuildSystem()) {
continue;
}
DirectoryTarget::Target t;
+19 -21
View File
@@ -456,7 +456,7 @@ bool cmGlobalGenerator::CheckTargetsForType() const
continue;
}
if (target->GetType() == cmStateEnums::EXECUTABLE) {
if (target->GetType() == cm::TargetType::EXECUTABLE) {
std::vector<std::string> const& configs =
target->Makefile->GetGeneratorConfigs(
cmMakefile::IncludeEmptyConfig);
@@ -2084,15 +2084,14 @@ bool cmGlobalGenerator::AddHeaderSetVerification()
cmTarget* allVerifyInterfaceTarget =
this->Makefiles.front()->FindTargetToUse(
"all_verify_interface_header_sets",
{ cmStateEnums::TargetDomain::NATIVE });
"all_verify_interface_header_sets", { cm::TargetDomain::NATIVE });
if (allVerifyInterfaceTarget) {
this->LocalGenerators.front()->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(allVerifyInterfaceTarget,
this->LocalGenerators.front().get()));
}
cmTarget* allVerifyPrivateTarget = this->Makefiles.front()->FindTargetToUse(
"all_verify_private_header_sets", { cmStateEnums::TargetDomain::NATIVE });
"all_verify_private_header_sets", { cm::TargetDomain::NATIVE });
if (allVerifyPrivateTarget) {
this->LocalGenerators.front()->AddGeneratorTarget(
cm::make_unique<cmGeneratorTarget>(allVerifyPrivateTarget,
@@ -2362,7 +2361,7 @@ cmGlobalGenerator::TargetDirectoryRegistration&
cmGlobalGenerator::RegisterTargetDirectory(cmGeneratorTarget const* tgt,
std::string const& targetDir) const
{
if (!tgt->IsNormal() || tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
if (!tgt->IsNormal() || tgt->GetType() == cm::TargetType::GLOBAL_TARGET ||
tgt->Target->IsForTryCompile()) {
static TargetDirectoryRegistration utilityRegistration(nullptr, true);
return utilityRegistration;
@@ -2401,7 +2400,7 @@ void cmGlobalGenerator::CheckTargetProperties()
for (unsigned int i = 0; i < this->Makefiles.size(); ++i) {
this->Makefiles[i]->Generate(*this->LocalGenerators[i]);
for (auto const& target : this->Makefiles[i]->GetTargets()) {
if (target.second.GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (target.second.GetType() == cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
for (auto const& lib : target.second.GetOriginalLinkLibraries()) {
@@ -2961,12 +2960,11 @@ void cmGlobalGenerator::IndexLocalGenerator(cmLocalGenerator* lg)
this->LocalGeneratorSearchIndex[id.String] = lg;
}
cmTarget* cmGlobalGenerator::FindTargetImpl(
std::string const& name, cmStateEnums::TargetDomainSet domains) const
cmTarget* cmGlobalGenerator::FindTargetImpl(std::string const& name,
cm::TargetDomainSet domains) const
{
bool const useForeign =
domains.contains(cmStateEnums::TargetDomain::FOREIGN);
bool const useNative = domains.contains(cmStateEnums::TargetDomain::NATIVE);
bool const useForeign = domains.contains(cm::TargetDomain::FOREIGN);
bool const useNative = domains.contains(cm::TargetDomain::NATIVE);
auto const it = this->TargetSearchIndex.find(name);
if (it != this->TargetSearchIndex.end()) {
@@ -2987,10 +2985,10 @@ cmGeneratorTarget* cmGlobalGenerator::FindGeneratorTargetImpl(
return nullptr;
}
cmTarget* cmGlobalGenerator::FindTarget(
std::string const& name, cmStateEnums::TargetDomainSet domains) const
cmTarget* cmGlobalGenerator::FindTarget(std::string const& name,
cm::TargetDomainSet domains) const
{
if (domains.contains(cmStateEnums::TargetDomain::ALIAS)) {
if (domains.contains(cm::TargetDomain::ALIAS)) {
auto const ai = this->AliasTargets.find(name);
if (ai != this->AliasTargets.end()) {
return this->FindTargetImpl(ai->second, domains);
@@ -3034,12 +3032,12 @@ std::vector<std::string> cmGlobalGenerator::GetTestBuildDependencyPaths(
uniqueDeps.insert(file.Path);
}
for (cmGeneratorTarget* target : deps.Targets) {
if (target->GetType() == cmStateEnums::TargetType::UTILITY ||
target->GetType() == cmStateEnums::TargetType::GLOBAL_TARGET ||
target->GetType() == cmStateEnums::TargetType::INTERFACE_LIBRARY) {
if (target->GetType() == cm::TargetType::UTILITY ||
target->GetType() == cm::TargetType::GLOBAL_TARGET ||
target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
if (target->GetType() == cmStateEnums::TargetType::OBJECT_LIBRARY) {
if (target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
std::vector<std::string> objects;
target->GetTargetObjectNames(config, objects);
for (auto const& object : objects) {
@@ -3748,8 +3746,8 @@ void cmGlobalGenerator::CreateGlobalTarget(GlobalTargetInfo const& gti,
cmMakefile* mf)
{
// Package
auto tb =
mf->CreateNewTarget(gti.Name, cmStateEnums::GLOBAL_TARGET, gti.PerConfig);
auto tb = mf->CreateNewTarget(gti.Name, cm::TargetType::GLOBAL_TARGET,
gti.PerConfig);
// Do nothing if gti.Name is already used
if (!tb.second) {
@@ -3898,7 +3896,7 @@ cmGlobalGenerator::TargetDependSet cmGlobalGenerator::GetTargetsForProject(
bool cmGlobalGenerator::IsRootOnlyTarget(cmGeneratorTarget* target) const
{
return (target->GetType() == cmStateEnums::GLOBAL_TARGET ||
return (target->GetType() == cm::TargetType::GLOBAL_TARGET ||
target->GetName() == this->GetAllTargetName());
}
+5 -4
View File
@@ -34,6 +34,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmTestGenerator.h"
#include "cmValue.h"
#include "cmXcFramework.h"
@@ -403,9 +404,9 @@ public:
//! Find a target by name by searching the local generators.
cmTarget* FindTarget(std::string const& name,
cmStateEnums::TargetDomainSet domains = {
cmStateEnums::TargetDomain::NATIVE,
cmStateEnums::TargetDomain::ALIAS }) const;
cm::TargetDomainSet domains = {
cm::TargetDomain::NATIVE,
cm::TargetDomain::ALIAS }) const;
cmGeneratorTarget* FindGeneratorTarget(std::string const& name) const;
@@ -885,7 +886,7 @@ protected:
std::map<std::string, std::string> AliasTargets;
cmTarget* FindTargetImpl(std::string const& name,
cmStateEnums::TargetDomainSet domains) const;
cm::TargetDomainSet domains) const;
cmGeneratorTarget* FindGeneratorTargetImpl(std::string const& name) const;
+10 -9
View File
@@ -31,6 +31,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -330,10 +331,10 @@ void cmGlobalGhsMultiGenerator::WriteSubProjects(std::ostream& fout,
// All known targets
for (cmGeneratorTarget const* target : this->ProjectTargets) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY ||
(target->GetType() == cmStateEnums::GLOBAL_TARGET &&
if (target->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
target->GetType() == cm::TargetType::MODULE_LIBRARY ||
target->GetType() == cm::TargetType::SHARED_LIBRARY ||
(target->GetType() == cm::TargetType::GLOBAL_TARGET &&
target->GetName() != this->GetInstallTargetName())) {
continue;
}
@@ -370,10 +371,10 @@ void cmGlobalGhsMultiGenerator::WriteTargets(cmLocalGenerator* root)
// All known targets
for (cmGeneratorTarget const* target : this->ProjectTargets) {
if (target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
target->GetType() == cmStateEnums::MODULE_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY ||
(target->GetType() == cmStateEnums::GLOBAL_TARGET &&
if (target->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
target->GetType() == cm::TargetType::MODULE_LIBRARY ||
target->GetType() == cm::TargetType::SHARED_LIBRARY ||
(target->GetType() == cm::TargetType::GLOBAL_TARGET &&
target->GetName() != this->GetInstallTargetName())) {
continue;
}
@@ -765,7 +766,7 @@ void cmGlobalGhsMultiGenerator::AddAllTarget()
for (cmLocalGenerator const* i : gen) {
for (auto const& tgt : i->GetGeneratorTargets()) {
// Skip global or imported targets
if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
if (tgt->GetType() == cm::TargetType::GLOBAL_TARGET ||
tgt->IsImported()) {
continue;
}
+12 -11
View File
@@ -55,6 +55,7 @@
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmTest.h"
#include "cmTestGenerator.h"
#include "cmValue.h"
@@ -1397,16 +1398,16 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
bool realname = target->IsFrameworkOnApple();
switch (target->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
if (depends == DependOnTargetOrdering) {
outputs.push_back(this->OrderDependsTargetForTarget(target, config));
break;
}
}
CM_FALLTHROUGH;
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
if (target->IsApple() && target->HasImportLibrary(config)) {
outputs.push_back(this->ConvertToNinjaPath(target->GetFullPath(
config, cmStateEnums::ImportLibraryArtifact, realname)));
@@ -1415,16 +1416,16 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
config, cmStateEnums::RuntimeBinaryArtifact, realname)));
break;
}
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
if (depends == DependOnTargetOrdering) {
outputs.push_back(this->OrderDependsTargetForTarget(target, config));
break;
}
}
CM_FALLTHROUGH;
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UTILITY: {
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY: {
std::string path =
cmStrCat(target->GetLocalGenerator()->GetCurrentBinaryDirectory(), '/',
target->GetName());
@@ -1436,7 +1437,7 @@ void cmGlobalNinjaGenerator::AppendTargetOutputs(
break;
}
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
}
@@ -1446,7 +1447,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends(
std::string const& config, std::string const& fileConfig,
cmNinjaTargetDepends depends)
{
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (target->GetType() == cm::TargetType::GLOBAL_TARGET) {
// These depend only on other CMake-provided targets, e.g. "all".
for (BT<std::pair<std::string, bool>> const& util :
target->GetUtilities()) {
@@ -3231,7 +3232,7 @@ std::set<std::string> cmGlobalNinjaGenerator::GetCrossConfigs(
bool cmGlobalNinjaGenerator::IsSingleConfigUtility(
cmGeneratorTarget const* target) const
{
return target->GetType() == cmStateEnums::UTILITY &&
return target->GetType() == cm::TargetType::UTILITY &&
!this->PerConfigUtilityTargets.count(target->GetName());
}
+13 -13
View File
@@ -21,11 +21,11 @@
#include "cmMessageType.h"
#include "cmOutputConverter.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmTest.h"
#include "cmTestGenerator.h"
#include "cmValue.h"
@@ -366,7 +366,7 @@ void cmGlobalUnixMakefileGenerator3::WriteMainCMakefileLanguageRules(
// for all of out targets
for (auto const& tgt : lg.GetGeneratorTargets()) {
if (tgt->IsInBuildSystem() &&
tgt->GetType() != cmStateEnums::GLOBAL_TARGET) {
tgt->GetType() != cm::TargetType::GLOBAL_TARGET) {
std::string tname = cmStrCat(lg.GetRelativeTargetDirectory(tgt.get()),
"/DependInfo.cmake");
cmSystemTools::ConvertToUnixSlashes(tname);
@@ -611,7 +611,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules(
// Handle user targets here. Global targets are handled in
// the local generator on a per-directory basis.
(gtarget->IsInBuildSystem() &&
gtarget->GetType() != cmStateEnums::GLOBAL_TARGET)) {
gtarget->GetType() != cm::TargetType::GLOBAL_TARGET)) {
// Add a rule to build the target by name.
lg.WriteDivider(ruleFileStream);
ruleFileStream << "# Target rules for targets named " << name
@@ -682,7 +682,7 @@ void cmGlobalUnixMakefileGenerator3::WriteConvenienceRules2(
std::string name = gtarget->GetName();
if (!name.empty() &&
(gtarget->IsInBuildSystem() &&
gtarget->GetType() != cmStateEnums::GLOBAL_TARGET)) {
gtarget->GetType() != cm::TargetType::GLOBAL_TARGET)) {
std::string makefileName;
// Add a rule to build the target by name.
localName = lg.GetRelativeTargetDirectory(gtarget.get());
@@ -1132,18 +1132,18 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule(
if (&lg2 == lg || lg->IsRootMakefile()) {
// for each target Generate the rule files for each target.
for (auto const& target : lg2.GetGeneratorTargets()) {
cmStateEnums::TargetType type = target->GetType();
if ((type == cmStateEnums::EXECUTABLE) ||
(type == cmStateEnums::STATIC_LIBRARY) ||
(type == cmStateEnums::SHARED_LIBRARY) ||
(type == cmStateEnums::MODULE_LIBRARY) ||
(type == cmStateEnums::OBJECT_LIBRARY) ||
(type == cmStateEnums::INTERFACE_LIBRARY &&
cm::TargetType type = target->GetType();
if ((type == cm::TargetType::EXECUTABLE) ||
(type == cm::TargetType::STATIC_LIBRARY) ||
(type == cm::TargetType::SHARED_LIBRARY) ||
(type == cm::TargetType::MODULE_LIBRARY) ||
(type == cm::TargetType::OBJECT_LIBRARY) ||
(type == cm::TargetType::INTERFACE_LIBRARY &&
target->IsInBuildSystem())) {
project_targets.insert(target->GetName());
} else if (type == cmStateEnums::GLOBAL_TARGET) {
} else if (type == cm::TargetType::GLOBAL_TARGET) {
globals_targets.insert(target->GetName());
} else if (type == cmStateEnums::UTILITY) {
} else if (type == cm::TargetType::UTILITY) {
utility_targets.insert(target->GetName());
}
}
+4 -3
View File
@@ -358,9 +358,10 @@ void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
bool cmGlobalVisualStudio8Generator::NeedsDeploy(
cmGeneratorTarget const& target, char const* config) const
{
cmStateEnums::TargetType const type = target.GetType();
if (type != cmStateEnums::EXECUTABLE &&
type != cmStateEnums::SHARED_LIBRARY && type != cmStateEnums::UTILITY) {
cm::TargetType const type = target.GetType();
if (type != cm::TargetType::EXECUTABLE &&
type != cm::TargetType::SHARED_LIBRARY &&
type != cm::TargetType::UTILITY) {
// deployment only valid on executables, shared libraries, and utilities.
return false;
}
+4 -4
View File
@@ -165,7 +165,7 @@ void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
// Now make all targets depend on the ALL_BUILD target
for (cmLocalGenerator const* i : gen) {
for (auto const& tgt : i->GetGeneratorTargets()) {
if (tgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
if (tgt->GetType() == cm::TargetType::GLOBAL_TARGET ||
tgt->IsImported()) {
continue;
}
@@ -832,8 +832,8 @@ std::set<std::string> cmGlobalVisualStudioGenerator::IsPartOfDefaultBuild(
std::set<std::string> activeConfigs;
// if it is a utility target then only make it part of the
// default build if another target depends on it
int type = target->GetType();
if (type == cmStateEnums::GLOBAL_TARGET) {
cm::TargetType type = target->GetType();
if (type == cm::TargetType::GLOBAL_TARGET) {
std::vector<std::string> targetNames;
targetNames.push_back("INSTALL");
targetNames.push_back("PACKAGE");
@@ -856,7 +856,7 @@ std::set<std::string> cmGlobalVisualStudioGenerator::IsPartOfDefaultBuild(
}
return activeConfigs;
}
if (type == cmStateEnums::UTILITY &&
if (type == cm::TargetType::UTILITY &&
!this->IsDependedOn(projectTargets, target)) {
return activeConfigs;
}
+65 -65
View File
@@ -809,7 +809,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// in the project
for (auto& gen : gens) {
for (auto const& target : gen->GetGeneratorTargets()) {
if (target->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (target->GetType() == cm::TargetType::GLOBAL_TARGET) {
continue;
}
@@ -823,7 +823,7 @@ void cmGlobalXCodeGenerator::AddExtraTargets(
// this will make sure that when the next target is built
// things are up-to-date
if (this->XcodeBuildSystem == BuildSystem::One && isGenerateProject &&
target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
legacyDependHelperCommandLines.front().back() = // fill placeholder
this->PostBuildMakeTarget(target->GetName(), "$(CONFIGURATION)");
cc = cm::make_unique<cmCustomCommand>();
@@ -1579,9 +1579,9 @@ bool cmGlobalXCodeGenerator::CreateXCodeTarget(
gtgt_visited.insert(dep_visited.begin(), dep_visited.end());
}
if (gtgt->GetType() == cmStateEnums::UTILITY ||
gtgt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
gtgt->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (gtgt->GetType() == cm::TargetType::UTILITY ||
gtgt->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
gtgt->GetType() == cm::TargetType::GLOBAL_TARGET) {
cmXCodeObject* t = this->CreateUtilityTarget(gtgt);
if (!t) {
return false;
@@ -1839,9 +1839,9 @@ void cmGlobalXCodeGenerator::ForceLinkerLanguages()
void cmGlobalXCodeGenerator::ForceLinkerLanguage(cmGeneratorTarget* gtgt)
{
// This matters only for targets that link.
if (gtgt->GetType() != cmStateEnums::EXECUTABLE &&
gtgt->GetType() != cmStateEnums::SHARED_LIBRARY &&
gtgt->GetType() != cmStateEnums::MODULE_LIBRARY) {
if (gtgt->GetType() != cm::TargetType::EXECUTABLE &&
gtgt->GetType() != cm::TargetType::SHARED_LIBRARY &&
gtgt->GetType() != cm::TargetType::MODULE_LIBRARY) {
return;
}
@@ -1923,7 +1923,7 @@ void cmGlobalXCodeGenerator::CreateCustomCommands(
std::vector<cmCustomCommand> const& prelink = gtgt->GetPreLinkCommands();
std::vector<cmCustomCommand> postbuild = gtgt->GetPostBuildCommands();
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY &&
if (gtgt->GetType() == cm::TargetType::SHARED_LIBRARY &&
!gtgt->IsFrameworkOnApple()) {
std::string str_file = cmStrCat("$<TARGET_FILE:", gtgt->GetName(), '>');
std::string str_so_file =
@@ -2572,7 +2572,7 @@ void cmGlobalXCodeGenerator::AddPositionIndependentLinkAttribute(
std::string const& configName)
{
// For now, only EXECUTABLE is concerned
if (target->GetType() != cmStateEnums::EXECUTABLE) {
if (target->GetType() != cm::TargetType::EXECUTABLE) {
return;
}
@@ -2595,11 +2595,11 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
std::string defFlags;
bool shared = ((gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) ||
(gtgt->GetType() == cmStateEnums::MODULE_LIBRARY));
bool binary = ((gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
(gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) ||
(gtgt->GetType() == cmStateEnums::EXECUTABLE) || shared);
bool shared = ((gtgt->GetType() == cm::TargetType::SHARED_LIBRARY) ||
(gtgt->GetType() == cm::TargetType::MODULE_LIBRARY));
bool binary = ((gtgt->GetType() == cm::TargetType::OBJECT_LIBRARY) ||
(gtgt->GetType() == cm::TargetType::STATIC_LIBRARY) ||
(gtgt->GetType() == cm::TargetType::EXECUTABLE) || shared);
// Compute the compilation flags for each language.
std::set<std::string> languages;
@@ -2736,8 +2736,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
std::string extraLinkOptions;
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gtgt->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (gtgt->GetType() == cm::TargetType::OBJECT_LIBRARY ||
gtgt->GetType() == cm::TargetType::STATIC_LIBRARY) {
this->CurrentLocalGenerator->GetStaticLibraryFlags(
extraLinkOptions, configName, llang, gtgt);
} else {
@@ -2812,7 +2812,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("TARGET_TEMP_DIR", this->CreateString(tmpDir));
std::string outDir;
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (gtgt->GetType() == cm::TargetType::OBJECT_LIBRARY) {
// We cannot suppress the archive, so hide it with intermediate files.
outDir = tmpDir;
} else {
@@ -2824,10 +2824,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Set attributes to specify the proper name for the target.
std::string pndir = this->CurrentLocalGenerator->GetCurrentBinaryDirectory();
if (gtgt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gtgt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gtgt->GetType() == cmStateEnums::MODULE_LIBRARY ||
gtgt->GetType() == cmStateEnums::EXECUTABLE) {
if (gtgt->GetType() == cm::TargetType::STATIC_LIBRARY ||
gtgt->GetType() == cm::TargetType::SHARED_LIBRARY ||
gtgt->GetType() == cm::TargetType::MODULE_LIBRARY ||
gtgt->GetType() == cm::TargetType::EXECUTABLE) {
std::string prefix = components.prefix;
if (gtgt->IsFrameworkOnApple() || gtgt->IsCFBundleOnApple()) {
prefix = "";
@@ -2844,7 +2844,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Handle settings for each target type.
switch (gtgt->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
if (gtgt->GetPropertyAsBool("FRAMEWORK")) {
std::string fw_version = gtgt->GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION",
@@ -2871,13 +2871,13 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
break;
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("STATIC"));
break;
}
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::MODULE_LIBRARY: {
buildSettings->AddAttribute("LIBRARY_STYLE",
this->CreateString("BUNDLE"));
// Add the flags to create a module library (bundle).
@@ -2917,7 +2917,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
break;
}
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
if (gtgt->GetPropertyAsBool("FRAMEWORK")) {
std::string fw_version = gtgt->GetFrameworkVersion();
buildSettings->AddAttribute("FRAMEWORK_VERSION",
@@ -2960,7 +2960,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
}
break;
}
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
// Add the flags to create an executable.
std::string createFlags;
this->CurrentLocalGenerator->AppendTargetCreationLinkFlags(createFlags,
@@ -3193,7 +3193,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
// Create the INSTALL_PATH attribute.
std::string install_name_dir;
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (gtgt->GetType() == cm::TargetType::SHARED_LIBRARY) {
// Get the install_name directory for the build tree.
install_name_dir = gtgt->GetInstallNameDirForBuildTree(configName);
// Xcode doesn't create the correct install_name in some cases.
@@ -3257,7 +3257,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmGeneratorTarget* gtgt,
buildSettings->AddAttribute("WARNING_CFLAGS", group);
// Runtime version information.
if (gtgt->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (gtgt->GetType() == cm::TargetType::SHARED_LIBRARY) {
int major;
int minor;
int patch;
@@ -3357,7 +3357,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateUtilityTarget(
this->XCodeObjectMap[gtgt] = target;
// Add source files without build rules for editing convenience.
if (gtgt->GetType() != cmStateEnums::GLOBAL_TARGET &&
if (gtgt->GetType() != cm::TargetType::GLOBAL_TARGET &&
gtgt->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
std::vector<cmSourceFile*> sources;
if (!gtgt->GetConfigCommonSourceFilesForXcode(sources)) {
@@ -3483,8 +3483,8 @@ char const* cmGlobalXCodeGenerator::GetTargetLinkFlagsVar(
cmGeneratorTarget const* target) const
{
if (this->XcodeVersion >= 60 &&
(target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
(target->GetType() == cm::TargetType::STATIC_LIBRARY ||
target->GetType() == cm::TargetType::OBJECT_LIBRARY)) {
return "OTHER_LIBTOOLFLAGS";
}
return "OTHER_LDFLAGS";
@@ -3498,12 +3498,12 @@ char const* cmGlobalXCodeGenerator::GetTargetFileType(
}
switch (target->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return "archive.ar";
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK") ? "wrapper.framework"
: "archive.ar");
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
if (target->IsXCTestOnApple()) {
return "wrapper.cfbundle";
}
@@ -3511,11 +3511,11 @@ char const* cmGlobalXCodeGenerator::GetTargetFileType(
return "wrapper.plug-in";
}
return "compiled.mach-o.executable";
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return (target->GetPropertyAsBool("FRAMEWORK")
? "wrapper.framework"
: "compiled.mach-o.dylib");
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return "compiled.mach-o.executable";
default:
break;
@@ -3531,13 +3531,13 @@ cm::string_view cmGlobalXCodeGenerator::GetTargetProductType(
}
switch (target->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return "com.apple.product-type.library.static"_s;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework"_s
: "com.apple.product-type.library.static"_s;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
if (target->IsXCTestOnApple()) {
return "com.apple.product-type.bundle.unit-test"_s;
} else if (target->IsCFBundleOnApple()) {
@@ -3545,11 +3545,11 @@ cm::string_view cmGlobalXCodeGenerator::GetTargetProductType(
} else {
return "com.apple.product-type.tool"_s;
}
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return target->GetPropertyAsBool("FRAMEWORK")
? "com.apple.product-type.framework"_s
: "com.apple.product-type.library.dynamic"_s;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return target->GetPropertyAsBool("MACOSX_BUNDLE")
? "com.apple.product-type.application"_s
: "com.apple.product-type.tool"_s;
@@ -3591,7 +3591,7 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeTarget(
fileRef->AddAttribute("explicitFileType", this->CreateString(fileType));
}
std::string fullName;
if (gtgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (gtgt->GetType() == cm::TargetType::OBJECT_LIBRARY) {
fullName = cmStrCat("lib", gtgt->GetName(), ".a");
} else {
fullName = gtgt->GetFullName(defConfig);
@@ -3856,7 +3856,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// libraries without an artifact. Avoid exposing this to the rest of
// CMake's compilation model.
if (libItem.Target &&
libItem.Target->GetType() == cmStateEnums::OBJECT_LIBRARY) {
libItem.Target->GetType() == cm::TargetType::OBJECT_LIBRARY) {
continue;
}
// We want to put only static libraries, dynamic libraries, frameworks
@@ -3865,15 +3865,15 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
// XCODE_LINK_BUILD_PHASE_MODE is KNOWN_LOCATION then all imported and
// non-target libraries will be added as well.
if (useLinkPhase &&
(gt->GetType() == cmStateEnums::EXECUTABLE ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) &&
(gt->GetType() == cm::TargetType::EXECUTABLE ||
gt->GetType() == cm::TargetType::SHARED_LIBRARY ||
gt->GetType() == cm::TargetType::MODULE_LIBRARY) &&
((libItem.Target &&
(!libItem.Target->IsImported() || forceLinkPhase) &&
(libItem.Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
libItem.Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY)) ||
(libItem.Target->GetType() == cm::TargetType::STATIC_LIBRARY ||
libItem.Target->GetType() == cm::TargetType::SHARED_LIBRARY ||
libItem.Target->GetType() == cm::TargetType::MODULE_LIBRARY ||
libItem.Target->GetType() == cm::TargetType::UNKNOWN_LIBRARY)) ||
(!libItem.Target &&
libItem.IsPath == cmComputeLinkInformation::ItemIsPath::Yes &&
forceLinkPhase))) {
@@ -3887,7 +3887,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
libItem.GetFeatureName() == "WEAK_LIBRARY"_s;
if (canUseLinkPhase) {
if (libItem.Target) {
if (libItem.Target->GetType() == cmStateEnums::UNKNOWN_LIBRARY) {
if (libItem.Target->GetType() == cm::TargetType::UNKNOWN_LIBRARY) {
canUseLinkPhase = canUseLinkPhase && forceLinkPhase;
} else {
// If a library target uses custom build output directory Xcode
@@ -4191,8 +4191,8 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
// Skip link information for object libraries.
if (gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gt->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (gt->GetType() == cm::TargetType::OBJECT_LIBRARY ||
gt->GetType() == cm::TargetType::STATIC_LIBRARY) {
continue;
}
@@ -4343,7 +4343,7 @@ void cmGlobalXCodeGenerator::AddDependAndLinkInformation(cmXCodeObject* target)
}
} else if (!libName.Target ||
libName.Target->GetType() !=
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
libPaths.Add(libName.Value.Value);
}
if (libName.Target && !libName.Target->IsImported()) {
@@ -4559,7 +4559,7 @@ bool cmGlobalXCodeGenerator::CreateGroups(
// groups:
//
if (!gtgt->IsInBuildSystem() ||
gtgt->GetType() == cmStateEnums::GLOBAL_TARGET ||
gtgt->GetType() == cm::TargetType::GLOBAL_TARGET ||
gtgt->GetName() == CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
continue;
}
@@ -5104,20 +5104,20 @@ void cmGlobalXCodeGenerator::CreateXCodeDependHackMakefile(
for (auto* target : targets) {
cmGeneratorTarget* gt = target->GetTarget();
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
gt->GetType() == cmStateEnums::OBJECT_LIBRARY ||
gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (gt->GetType() == cm::TargetType::EXECUTABLE ||
gt->GetType() == cm::TargetType::OBJECT_LIBRARY ||
gt->GetType() == cm::TargetType::STATIC_LIBRARY ||
gt->GetType() == cm::TargetType::SHARED_LIBRARY ||
gt->GetType() == cm::TargetType::MODULE_LIBRARY) {
// Declare an entry point for the target post-build phase.
makefileStream << this->PostBuildMakeTarget(gt->GetName(), configName)
<< ":\n";
}
if (gt->GetType() == cmStateEnums::EXECUTABLE ||
gt->GetType() == cmStateEnums::STATIC_LIBRARY ||
gt->GetType() == cmStateEnums::SHARED_LIBRARY ||
gt->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (gt->GetType() == cm::TargetType::EXECUTABLE ||
gt->GetType() == cm::TargetType::STATIC_LIBRARY ||
gt->GetType() == cm::TargetType::SHARED_LIBRARY ||
gt->GetType() == cm::TargetType::MODULE_LIBRARY) {
std::string tfull = gt->GetFullPath(configName);
std::string trel = ConvertToMakefilePath(tfull);
+20 -19
View File
@@ -25,6 +25,7 @@
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -54,21 +55,21 @@ char const* getShapeForTarget(cmLinkItem const& item)
}
switch (item.Target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return GRAPHVIZ_NODE_SHAPE_EXECUTABLE;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_STATIC;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_SHARED;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_MODULE;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_OBJECT;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
return GRAPHVIZ_NODE_SHAPE_UTILITY;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_INTERFACE;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
default:
return GRAPHVIZ_NODE_SHAPE_LIBRARY_UNKNOWN;
}
@@ -482,7 +483,7 @@ bool cmGraphVizWriter::ItemExcluded(cmLinkItem const& item)
return !this->GenerateForExternals;
}
if (item.Target->GetType() == cmStateEnums::UTILITY) {
if (item.Target->GetType() == cm::TargetType::UTILITY) {
if (cmHasLiteralPrefix(itemName, "Nightly") ||
cmHasLiteralPrefix(itemName, "Continuous") ||
cmHasLiteralPrefix(itemName, "Experimental")) {
@@ -520,26 +521,26 @@ bool cmGraphVizWriter::ItemNameFilteredOut(std::string const& itemName)
}
bool cmGraphVizWriter::TargetTypeEnabled(
cmStateEnums::TargetType targetType) const
cm::TargetType targetType) const
{
switch (targetType) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return this->GenerateForExecutables;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return this->GenerateForStaticLibs;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return this->GenerateForSharedLibs;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return this->GenerateForModuleLibs;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
return this->GenerateForInterfaceLibs;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return this->GenerateForObjectLibs;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
return this->GenerateForUnknownLibs;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
return this->GenerateForCustomTargets;
case cmStateEnums::GLOBAL_TARGET:
case cm::TargetType::GLOBAL_TARGET:
// Built-in targets like edit_cache, etc.
// We don't need/want those in the dot file.
return false;
+5 -2
View File
@@ -14,7 +14,6 @@
#include "cmGeneratedFileStream.h"
#include "cmLinkItem.h"
#include "cmLinkItemGraphVisitor.h"
#include "cmStateTypes.h"
namespace cmsys {
class RegularExpression;
@@ -22,6 +21,10 @@ class RegularExpression;
class cmGlobalGenerator;
namespace cm {
enum class TargetType;
} // namespace cm
/** This class implements writing files for graphviz (dot) for graphs
* representing the dependencies between the targets in the project. */
class cmGraphVizWriter : public cmLinkItemGraphVisitor
@@ -97,7 +100,7 @@ private:
bool ItemExcluded(cmLinkItem const& item);
bool ItemNameFilteredOut(std::string const& itemName);
bool TargetTypeEnabled(cmStateEnums::TargetType targetType) const;
bool TargetTypeEnabled(cm::TargetType targetType) const;
std::string ItemNameWithAliases(std::string const& itemName) const;
+1 -1
View File
@@ -82,7 +82,7 @@ bool cmIncludeExternalMSProjectCommand(std::vector<std::string> const& args,
}
// Create a target instance for this utility.
cmTarget* target = mf.AddNewTarget(cmStateEnums::UTILITY, utility_name);
cmTarget* target = mf.AddNewTarget(cm::TargetType::UTILITY, utility_name);
if (mf.GetPropertyAsBool("EXCLUDE_FROM_ALL")) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
+21 -21
View File
@@ -52,12 +52,12 @@
#include "cmRange.h"
#include "cmRuntimeDependencyArchive.h"
#include "cmSbomArguments.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSubcommandTable.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
namespace {
@@ -715,19 +715,19 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// If no local target has been found, find it in the global scope.
cmTarget* const globalTarget =
helper.Makefile->GetGlobalGenerator()->FindTarget(
tgt, { cmStateEnums::TargetDomain::NATIVE });
tgt, { cm::TargetDomain::NATIVE });
if (globalTarget && !globalTarget->IsImported()) {
target = globalTarget;
}
}
if (target) {
// Found the target. Check its type.
if (target->GetType() != cmStateEnums::EXECUTABLE &&
target->GetType() != cmStateEnums::STATIC_LIBRARY &&
target->GetType() != cmStateEnums::SHARED_LIBRARY &&
target->GetType() != cmStateEnums::MODULE_LIBRARY &&
target->GetType() != cmStateEnums::OBJECT_LIBRARY &&
target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (target->GetType() != cm::TargetType::EXECUTABLE &&
target->GetType() != cm::TargetType::STATIC_LIBRARY &&
target->GetType() != cm::TargetType::SHARED_LIBRARY &&
target->GetType() != cm::TargetType::MODULE_LIBRARY &&
target->GetType() != cm::TargetType::OBJECT_LIBRARY &&
target->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
status.SetError(
cmStrCat("TARGETS given target \"", tgt,
"\" which is not an executable, library, or module."));
@@ -826,7 +826,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
};
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
// Shared libraries are handled differently on DLL and non-DLL
// platforms. All windows platforms are DLL platforms including
// cygwin. Currently no other platform is a DLL platform.
@@ -942,7 +942,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
}
} break;
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
// If it is marked with FRAMEWORK property use the FRAMEWORK set of
// INSTALL properties. Otherwise, use the LIBRARY properties.
if (target.IsFrameworkOnApple()) {
@@ -976,7 +976,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
helper.GetArchiveDestination(&archiveArgs));
}
} break;
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::MODULE_LIBRARY: {
// Modules use LIBRARY properties.
if (!libraryArgs.GetDestination().empty()) {
libraryGenerator = CreateInstallTargetGenerator(
@@ -995,7 +995,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
return false;
}
} break;
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
// Objects use OBJECT properties.
if (!objectArgs.GetDestination().empty()) {
// Verify that we know where the objects are to install them.
@@ -1015,7 +1015,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
// exported.
}
} break;
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
if (target.IsAppBundleOnApple()) {
// Application bundles use the BUNDLE properties.
if (!bundleArgs.GetDestination().empty()) {
@@ -1059,7 +1059,7 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
target, archiveArgs, true, helper.CaptureContext(), true);
}
} break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
// Nothing to do. An INTERFACE_LIBRARY can be installed, but the
// only effect of that is to make it exportable. It installs no
// other files itself.
@@ -1380,16 +1380,16 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
// If no local target has been found, find it in the global scope.
cmTarget* const globalTarget =
helper.Makefile->GetGlobalGenerator()->FindTarget(
tgt, { cmStateEnums::TargetDomain::NATIVE });
tgt, { cm::TargetDomain::NATIVE });
if (globalTarget && globalTarget->IsImported()) {
target = globalTarget;
}
}
if (target) {
// Found the target. Check its type.
if (target->GetType() != cmStateEnums::EXECUTABLE &&
target->GetType() != cmStateEnums::SHARED_LIBRARY &&
target->GetType() != cmStateEnums::MODULE_LIBRARY) {
if (target->GetType() != cm::TargetType::EXECUTABLE &&
target->GetType() != cm::TargetType::SHARED_LIBRARY &&
target->GetType() != cm::TargetType::MODULE_LIBRARY) {
status.SetError(
cmStrCat("IMPORTED_RUNTIME_ARTIFACTS given target \"", tgt,
"\" which is not an executable, library, or module."));
@@ -1438,7 +1438,7 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
bundleGenerator;
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
if (target.IsDLLPlatform()) {
runtimeGenerator = createInstallGenerator(
target, runtimeArgs, helper.GetRuntimeDestination(&runtimeArgs));
@@ -1466,14 +1466,14 @@ bool HandleImportedRuntimeArtifactsMode(std::vector<std::string> const& args,
}
}
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
libraryGenerator = createInstallGenerator(
target, libraryArgs, helper.GetLibraryDestination(&libraryArgs));
if (runtimeDependencySet) {
runtimeDependencySet->AddModule(libraryGenerator.get());
}
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if (target.IsAppBundleOnApple()) {
if (bundleArgs.GetDestination().empty()) {
status.SetError(
@@ -14,8 +14,8 @@
#include "cmGlobalGenerator.h"
#include "cmInstallType.h"
#include "cmLocalGenerator.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTargetTypes.h"
namespace {
cmsys::RegularExpression const FrameworkRegularExpression(
@@ -72,7 +72,7 @@ void cmInstallImportedRuntimeArtifactsGenerator::GenerateScriptForConfig(
auto location = this->Target->GetFullPath(config);
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if (this->Target->IsBundleOnApple()) {
cmsys::RegularExpressionMatch match;
if (BundleRegularExpression.find(location.c_str(), match)) {
@@ -92,7 +92,7 @@ void cmInstallImportedRuntimeArtifactsGenerator::GenerateScriptForConfig(
nullptr, nullptr, nullptr, indent);
}
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
if (this->Target->IsFrameworkOnApple()) {
cmsys::RegularExpressionMatch match;
if (FrameworkRegularExpression.find(location.c_str(), match)) {
@@ -122,7 +122,7 @@ void cmInstallImportedRuntimeArtifactsGenerator::GenerateScriptForConfig(
nullptr, nullptr, nullptr, indent);
}
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
if (this->Target->IsCFBundleOnApple()) {
cmsys::RegularExpressionMatch match;
if (CFBundleRegularExpression.find(location.c_str(), match)) {
+4 -4
View File
@@ -10,8 +10,8 @@
#include "cmGlobalGenerator.h"
#include "cmInstallImportedRuntimeArtifactsGenerator.h"
#include "cmInstallTargetGenerator.h"
#include "cmStateTypes.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
cmInstallRuntimeDependencySet::cmInstallRuntimeDependencySet(std::string name)
: Name(std::move(name))
@@ -64,9 +64,9 @@ std::set<cmGeneratorTarget const*> const& GetTargetDependsClosure(
for (auto const& dep : deps) {
if (!dep.IsCross() && dep.IsLink()) {
auto type = dep->GetType();
if (type == cmStateEnums::EXECUTABLE ||
type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY) {
if (type == cm::TargetType::EXECUTABLE ||
type == cm::TargetType::SHARED_LIBRARY ||
type == cm::TargetType::MODULE_LIBRARY) {
retval.insert(dep);
}
auto const& depDeps = GetTargetDependsClosure(targetDepends, dep);
+26 -25
View File
@@ -32,6 +32,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -228,28 +229,28 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles(
{
Files files;
cmStateEnums::TargetType targetType = this->Target->GetType();
cm::TargetType targetType = this->Target->GetType();
switch (targetType) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
files.Type = cmInstallType_EXECUTABLE;
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
files.Type = cmInstallType_STATIC_LIBRARY;
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
files.Type = cmInstallType_SHARED_LIBRARY;
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
files.Type = cmInstallType_MODULE_LIBRARY;
break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
// Not reachable. We never create a cmInstallTargetGenerator for
// an INTERFACE_LIBRARY.
assert(false &&
"INTERFACE_LIBRARY targets have no installable outputs.");
break;
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
// Compute all the object files inside this target
std::vector<std::pair<cmObjectLocation, cmObjectLocation>> objects;
auto storeObjectLocations = [&objects](cmObjectLocation const& build,
@@ -273,9 +274,9 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles(
return files;
}
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::UNKNOWN_LIBRARY:
this->Target->GetLocalGenerator()->IssueMessage(
MessageType::INTERNAL_ERROR,
"cmInstallTargetGenerator created with non-installable target.");
@@ -296,7 +297,7 @@ cmInstallTargetGenerator::Files cmInstallTargetGenerator::GetFiles(
cmStrCat(this->Target->GetDirectory(config, artifact), '/');
}
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);
@@ -502,7 +503,7 @@ std::string cmInstallTargetGenerator::GetInstallFilename(
{
std::string fname;
// Compute the name of the library.
if (target->GetType() == cmStateEnums::EXECUTABLE) {
if (target->GetType() == cm::TargetType::EXECUTABLE) {
cmGeneratorTarget::Names targetNames = target->GetExecutableNames(config);
if (nameType == NameImplib) {
// Use the import library name.
@@ -587,9 +588,9 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
std::string const& toDestDirPath)
{
if (this->ImportLibrary || this->NamelinkMode == NamelinkModeOnly ||
!(this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->Target->GetType() == cmStateEnums::EXECUTABLE)) {
!(this->Target->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->Target->GetType() == cm::TargetType::MODULE_LIBRARY ||
this->Target->GetType() == cm::TargetType::EXECUTABLE)) {
return;
}
@@ -640,7 +641,7 @@ void cmInstallTargetGenerator::AddInstallNamePatchRule(
// Edit the install_name of the target itself if necessary.
std::string new_id;
if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (this->Target->GetType() == cm::TargetType::SHARED_LIBRARY) {
std::string for_build =
this->Target->GetInstallNameDirForBuildTree(config);
std::string for_install = this->Target->GetInstallNameDirForInstallTree(
@@ -871,7 +872,7 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
// don't strip static and import libraries, because it removes the only
// symbol table they have so you can't link to them anymore
if (this->Target->GetType() == cmStateEnums::STATIC_LIBRARY ||
if (this->Target->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->ImportLibrary || this->NamelinkMode == NamelinkModeOnly) {
return;
}
@@ -890,11 +891,11 @@ void cmInstallTargetGenerator::AddStripRule(std::ostream& os, Indent indent,
std::string stripArgs;
if (this->Target->IsApple()) {
if (this->Target->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->Target->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->Target->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->Target->GetType() == cm::TargetType::MODULE_LIBRARY) {
// Strip tools need '-x' to strip Apple dylibs correctly.
stripArgs = "-x ";
} else if (this->Target->GetType() == cmStateEnums::EXECUTABLE &&
} else if (this->Target->GetType() == cm::TargetType::EXECUTABLE &&
this->Target->GetGlobalGenerator()->GetStripCommandStyle(
strip) == cmGlobalGenerator::StripCommandStyle::Apple) {
// Apple's strip tool needs '-u -r' to strip executables correctly.
@@ -912,7 +913,7 @@ void cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, Indent indent,
std::string const& toDestDirPath)
{
// Static libraries need ranlib on this platform.
if (this->Target->GetType() != cmStateEnums::STATIC_LIBRARY) {
if (this->Target->GetType() != cm::TargetType::STATIC_LIBRARY) {
return;
}
@@ -948,10 +949,10 @@ void cmInstallTargetGenerator::AddUniversalInstallRule(
}
switch (this->Target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
break;
default:
+7 -7
View File
@@ -40,6 +40,7 @@
#include "cmState.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmTimestamp.h"
#include "cmUVProcessChain.h"
#include "cmValue.h"
@@ -897,14 +898,13 @@ std::string cmInstrumentation::ComputeSuffixTime(
return ss.str();
}
bool cmInstrumentation::IsInstrumentableTargetType(
cmStateEnums::TargetType type)
bool cmInstrumentation::IsInstrumentableTargetType(cm::TargetType type)
{
return type == cmStateEnums::TargetType::EXECUTABLE ||
type == cmStateEnums::TargetType::SHARED_LIBRARY ||
type == cmStateEnums::TargetType::STATIC_LIBRARY ||
type == cmStateEnums::TargetType::MODULE_LIBRARY ||
type == cmStateEnums::TargetType::OBJECT_LIBRARY;
return type == cm::TargetType::EXECUTABLE ||
type == cm::TargetType::SHARED_LIBRARY ||
type == cm::TargetType::STATIC_LIBRARY ||
type == cm::TargetType::MODULE_LIBRARY ||
type == cm::TargetType::OBJECT_LIBRARY;
}
/*
+5 -2
View File
@@ -24,10 +24,13 @@
#include "cmFileLock.h"
#include "cmInstrumentationQuery.h"
#include "cmStateTypes.h"
class cmGlobalGenerator;
namespace cm {
enum class TargetType;
} // namespace cm
class cmInstrumentation
{
public:
@@ -123,7 +126,7 @@ private:
static std::string ComputeSuffixHash(std::string const& command_str);
static std::string ComputeSuffixTime(
cm::optional<std::chrono::system_clock::time_point> time = cm::nullopt);
static bool IsInstrumentableTargetType(cmStateEnums::TargetType type);
static bool IsInstrumentableTargetType(cm::TargetType type);
void PrepareDataForCDash(std::string const& data_dir,
std::string const& index_path);
static std::string GetCompileTraceFile(
+5 -4
View File
@@ -14,6 +14,7 @@
#include "cmOutputConverter.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTargetTypes.h"
cmLinkLineComputer::cmLinkLineComputer(cmOutputConverter* outputConverter,
cmStateDirectory const& stateDir)
@@ -66,8 +67,8 @@ void cmLinkLineComputer::ComputeLinkLibs(
ItemVector const& items = cli.GetItems();
for (auto const& item : items) {
if (item.Target &&
(item.Target->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
item.Target->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
(item.Target->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
item.Target->GetType() == cm::TargetType::OBJECT_LIBRARY)) {
continue;
}
@@ -137,8 +138,8 @@ void cmLinkLineComputer::ComputeLinkPath(
continue;
}
if (target->GetType() == cmStateEnums::STATIC_LIBRARY ||
target->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (target->GetType() == cm::TargetType::STATIC_LIBRARY ||
target->GetType() == cm::TargetType::SHARED_LIBRARY) {
cmStateEnums::ArtifactType type = cmStateEnums::RuntimeBinaryArtifact;
if (target->HasImportLibrary(cli.GetConfig())) {
type = cmStateEnums::ImportLibraryArtifact;
+13 -13
View File
@@ -19,8 +19,8 @@
#include "cmMakefile.h"
#include "cmStateDirectory.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
class cmOutputConverter;
@@ -62,7 +62,7 @@ bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinking(
items.begin(), items.end(),
[](cmComputeLinkInformation::Item const& item) -> bool {
return item.Target &&
item.Target->GetType() == cmStateEnums::STATIC_LIBRARY &&
item.Target->GetType() == cm::TargetType::STATIC_LIBRARY &&
// this dependency requires us to device link it
!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS") &&
item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION");
@@ -81,7 +81,7 @@ bool cmLinkLineDeviceComputer::ComputeRequiresDeviceLinkingIPOFlag(
items.begin(), items.end(),
[config](cmComputeLinkInformation::Item const& item) -> bool {
return item.Target &&
item.Target->GetType() == cmStateEnums::STATIC_LIBRARY &&
item.Target->GetType() == cm::TargetType::STATIC_LIBRARY &&
// this dependency requires us to device link it
!item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS") &&
item.Target->GetPropertyAsBool("CUDA_SEPARABLE_COMPILATION") &&
@@ -112,13 +112,13 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
if (item.Target) {
bool skip = false;
switch (item.Target->GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
skip = true;
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
skip = item.Target->GetPropertyAsBool("CUDA_RESOLVE_DEVICE_SYMBOLS");
break;
default:
@@ -162,7 +162,7 @@ void cmLinkLineDeviceComputer::ComputeLinkLibraries(
for (cmLinkItem const& iter : linkImpl->Libraries) {
if (iter.Target &&
iter.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
iter.Target->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
std::string libPath = iter.Target->GetLocation(cli.GetConfig());
if (item.Value == libPath) {
linkLib.Backtrace = iter.Backtrace;
@@ -193,7 +193,7 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
return false;
}
if (target.GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (target.GetType() == cm::TargetType::OBJECT_LIBRARY) {
return false;
}
@@ -217,9 +217,9 @@ bool requireDeviceLinking(cmGeneratorTarget& target, cmLocalGenerator& lg,
if (target.GetProperty("CUDA_SEPARABLE_COMPILATION").IsOn()) {
bool doDeviceLinking = false;
switch (target.GetType()) {
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
doDeviceLinking = true;
break;
default:
+54 -53
View File
@@ -61,6 +61,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmTestGenerator.h"
#include "cmValue.h"
#include "cmake.h"
@@ -1528,12 +1529,12 @@ void cmLocalGenerator::GetTargetFlags(
}
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
linkFlags = this->GetStaticLibraryFlags(config, linkLanguage, target);
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
CM_FALLTHROUGH;
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
if (this->IsSplitSwiftBuild() || linkLanguage != "Swift") {
std::string libFlags;
this->AddTargetTypeLinkerFlags(libFlags, target, linkLanguage, config);
@@ -1568,7 +1569,7 @@ void cmLocalGenerator::GetTargetFlags(
frameworkPath, linkPath);
}
} break;
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
if (linkLanguage != "Swift" ||
(this->IsSplitSwiftBuild() &&
target->GetPolicyStatusCMP0214() == cmPolicies::NEW)) {
@@ -1945,7 +1946,7 @@ std::string cmLocalGenerator::GetExeExportFlags(
std::string linkFlags;
// Flags to export symbols from an executable.
if (tgt.GetType() == cmStateEnums::EXECUTABLE &&
if (tgt.GetType() == cm::TargetType::EXECUTABLE &&
this->StateSnapshot.GetState()->GetGlobalPropertyAsBool(
"TARGET_SUPPORTS_SHARED_LIBS")) {
// Only add the flags if ENABLE_EXPORTS is on,
@@ -2355,8 +2356,8 @@ bool cmLocalGenerator::GetRealDependency(std::string const& inName,
// found is part of the inName
if (cmSystemTools::FileIsFullPath(inName)) {
std::string tLocation;
if (target->GetType() >= cmStateEnums::EXECUTABLE &&
target->GetType() <= cmStateEnums::MODULE_LIBRARY) {
if (target->GetType() >= cm::TargetType::EXECUTABLE &&
target->GetType() <= cm::TargetType::MODULE_LIBRARY) {
tLocation = target->GetLocation(config);
tLocation = cmSystemTools::GetFilenamePath(tLocation);
tLocation = cmSystemTools::CollapseFullPath(tLocation);
@@ -2373,22 +2374,22 @@ bool cmLocalGenerator::GetRealDependency(std::string const& inName,
}
}
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
dep = target->GetFullPath(config, cmStateEnums::RuntimeBinaryArtifact,
/*realname=*/true);
return true;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
// An object library has no single file on which to depend.
// This was listed to get the target-level dependency.
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
// An interface library has no file on which to depend.
// This was listed to get the target-level dependency.
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
// A utility target has no file on which to depend. This was listed
// only to get the target-level dependency.
return false;
@@ -2492,10 +2493,10 @@ void cmLocalGenerator::AddFeatureFlags(std::string& flags,
std::string const& lang,
std::string const& config)
{
int targetType = target->GetType();
cm::TargetType const targetType = target->GetType();
bool shared = ((targetType == cmStateEnums::SHARED_LIBRARY) ||
(targetType == cmStateEnums::MODULE_LIBRARY));
bool shared = ((targetType == cm::TargetType::SHARED_LIBRARY) ||
(targetType == cm::TargetType::MODULE_LIBRARY));
if (target->GetLinkInterfaceDependentBoolProperty(
"POSITION_INDEPENDENT_CODE", config)) {
@@ -2508,11 +2509,11 @@ void cmLocalGenerator::AddFeatureFlags(std::string& flags,
void cmLocalGenerator::AddPositionIndependentFlags(std::string& flags,
std::string const& lang,
int targetType)
cm::TargetType targetType)
{
std::string picFlags;
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
picFlags = this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_PIE"));
}
@@ -2876,9 +2877,9 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
reuseTarget->GetPchFileObject(config, lang, arch);
}
if (target->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() != cm::TargetType::OBJECT_LIBRARY) {
std::string linkerProperty = "LINK_FLAGS_";
if (target->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (target->GetType() == cm::TargetType::STATIC_LIBRARY) {
linkerProperty = "STATIC_LIBRARY_FLAGS_";
}
target->Target->AppendProperty(
@@ -2887,7 +2888,7 @@ void cmLocalGenerator::AddPchDependencies(cmGeneratorTarget* target)
this->ConvertToOutputFormat(pchSourceObj, SHELL)),
cm::nullopt, true);
} else if (reuseTarget->GetType() ==
cmStateEnums::OBJECT_LIBRARY) {
cm::TargetType::OBJECT_LIBRARY) {
target->Target->AppendProperty(
"INTERFACE_LINK_LIBRARIES",
cmStrCat("$<$<CONFIG:", config,
@@ -3418,9 +3419,9 @@ void cmLocalGenerator::AddPerLanguageLinkFlags(std::string& flags,
std::string const& config)
{
switch (target->GetType()) {
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::EXECUTABLE:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::EXECUTABLE:
break;
default:
return;
@@ -3441,7 +3442,7 @@ void cmLocalGenerator::AddPerLanguageLinkFlags(std::string& flags,
// Additionally, WARN at most once per language, instead of on every
// target.
if (!langLinkFlags.empty() &&
target->GetType() != cmStateEnums::EXECUTABLE &&
target->GetType() != cm::TargetType::EXECUTABLE &&
langLinkFlags !=
this->Makefile->GetSafeDefinition(
cmStrCat("CMAKE_EXECUTABLE_CREATE_", lang, "_FLAGS")) &&
@@ -3480,22 +3481,22 @@ void cmLocalGenerator::AppendTargetCreationLinkFlags(
std::string createFlagsVar;
cmValue createFlagsVal;
switch (target->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
createFlagsVar =
cmStrCat("CMAKE_SHARED_MODULE_CREATE_", linkLanguage, "_FLAGS");
createFlagsVal = this->Makefile->GetDefinition(createFlagsVar);
// On some platforms we use shared library creation flags for modules.
CM_FALLTHROUGH;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
if (!createFlagsVal) {
createFlagsVar =
cmStrCat("CMAKE_SHARED_LIBRARY_CREATE_", linkLanguage, "_FLAGS");
createFlagsVal = this->Makefile->GetDefinition(createFlagsVar);
}
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
createFlagsVar = target->GetPolicyStatusCMP0210() == cmPolicies::NEW
? cmStrCat("CMAKE_EXECUTABLE_CREATE_", linkLanguage, "_FLAGS")
: cmStrCat("CMAKE_", linkLanguage, "_LINK_FLAGS");
@@ -3516,9 +3517,9 @@ void cmLocalGenerator::AppendLinkerTypeFlags(std::string& flags,
std::string const& linkLanguage)
{
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
break;
default:
return;
@@ -3571,13 +3572,13 @@ void cmLocalGenerator::AddTargetTypeLinkerFlags(
{
std::string linkerFlagsVar;
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
linkerFlagsVar = "CMAKE_EXE_LINKER_FLAGS";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
linkerFlagsVar = "CMAKE_SHARED_LINKER_FLAGS";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
linkerFlagsVar = "CMAKE_MODULE_LINKER_FLAGS";
break;
default:
@@ -3614,9 +3615,9 @@ void cmLocalGenerator::AppendIPOLinkerFlags(std::string& flags,
}
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
break;
default:
return;
@@ -3639,7 +3640,7 @@ void cmLocalGenerator::AppendPositionIndependentLinkerFlags(
std::string const& lang)
{
// For now, only EXECUTABLE is concerned
if (target->GetType() != cmStateEnums::EXECUTABLE) {
if (target->GetType() != cm::TargetType::EXECUTABLE) {
return;
}
@@ -3681,9 +3682,9 @@ void cmLocalGenerator::AppendWarningAsErrorLinkerFlags(
}
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
break;
default:
return;
@@ -3811,9 +3812,9 @@ bool cmLocalGenerator::AppendLWYUFlags(std::string& flags,
std::string const& lang)
{
auto useLWYU = target->GetPropertyAsBool("LINK_WHAT_YOU_USE") &&
(target->GetType() == cmStateEnums::TargetType::EXECUTABLE ||
target->GetType() == cmStateEnums::TargetType::SHARED_LIBRARY ||
target->GetType() == cmStateEnums::TargetType::MODULE_LIBRARY);
(target->GetType() == cm::TargetType::EXECUTABLE ||
target->GetType() == cm::TargetType::SHARED_LIBRARY ||
target->GetType() == cm::TargetType::MODULE_LIBRARY);
if (useLWYU) {
auto const& lwyuFlag = this->GetMakefile()->GetSafeDefinition(
@@ -4120,7 +4121,7 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// an install generator and run it.
auto const& tgts = this->GetGeneratorTargets();
for (auto const& l : tgts) {
if (l->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (l->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
continue;
}
@@ -4143,15 +4144,15 @@ void cmLocalGenerator::GenerateTargetInstallRules(
// Generate the proper install generator for this target type.
switch (l->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
// Use a target install generator.
cmInstallTargetGeneratorLocal g(this, l->GetName(), destination,
false);
g.Generate(os, config, configurationTypes);
} break;
case cmStateEnums::SHARED_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY: {
#if defined(_WIN32) || defined(__CYGWIN__)
// Special code to handle DLL. Install the import library
// to the normal destination and the DLL to the runtime
+5 -1
View File
@@ -52,6 +52,10 @@ class cmake;
template <typename Iter>
class cmRange;
namespace cm {
enum class TargetType;
} // namespace cm
/** Target and source file which have a specific output. */
struct cmSourcesWithOutput
{
@@ -726,7 +730,7 @@ private:
cmCommandOrigin origin);
void AddPositionIndependentFlags(std::string& flags, std::string const& l,
int targetType);
cm::TargetType targetType);
void ComputeObjectMaxPath();
bool AllAppleArchSysrootsAreTheSame(std::vector<std::string> const& archs,
+3 -3
View File
@@ -35,10 +35,10 @@
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -111,7 +111,7 @@ void cmLocalNinjaGenerator::Generate()
if (target->Target->IsPerConfig()) {
for (auto const& config : this->GetConfigNames()) {
tg->Generate(config);
if (target->GetType() == cmStateEnums::GLOBAL_TARGET &&
if (target->GetType() == cm::TargetType::GLOBAL_TARGET &&
this->GetGlobalGenerator()->IsMultiConfig()) {
cmNinjaBuild phonyAlias("phony");
this->GetGlobalNinjaGenerator()->AppendTargetOutputs(
@@ -124,7 +124,7 @@ void cmLocalNinjaGenerator::Generate()
phonyAlias);
}
}
if (target->GetType() == cmStateEnums::GLOBAL_TARGET &&
if (target->GetType() == cm::TargetType::GLOBAL_TARGET &&
this->GetGlobalGenerator()->IsMultiConfig()) {
if (!this->GetGlobalNinjaGenerator()->GetDefaultConfigs().empty()) {
cmNinjaBuild phonyAlias("phony");
+8 -8
View File
@@ -41,12 +41,12 @@
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmStdIoStream.h"
#include "cmStdIoTerminal.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmVersion.h"
#include "cmake.h"
@@ -431,12 +431,12 @@ void cmLocalUnixMakefileGenerator3::WriteLocalMakefileTargets(
// on the target
std::string localName;
for (auto const& target : this->GetGeneratorTargets()) {
if ((target->GetType() == cmStateEnums::EXECUTABLE) ||
(target->GetType() == cmStateEnums::STATIC_LIBRARY) ||
(target->GetType() == cmStateEnums::SHARED_LIBRARY) ||
(target->GetType() == cmStateEnums::MODULE_LIBRARY) ||
(target->GetType() == cmStateEnums::OBJECT_LIBRARY) ||
(target->GetType() == cmStateEnums::UTILITY)) {
if ((target->GetType() == cm::TargetType::EXECUTABLE) ||
(target->GetType() == cm::TargetType::STATIC_LIBRARY) ||
(target->GetType() == cm::TargetType::SHARED_LIBRARY) ||
(target->GetType() == cm::TargetType::MODULE_LIBRARY) ||
(target->GetType() == cm::TargetType::OBJECT_LIBRARY) ||
(target->GetType() == cm::TargetType::UTILITY)) {
emitted.insert(target->GetName());
// for subdirs add a rule to build this specific target by name.
@@ -1719,7 +1719,7 @@ void cmLocalUnixMakefileGenerator3::WriteLocalAllRules(
"\n";
auto const& targets = this->GetGeneratorTargets();
for (auto const& gt : targets) {
if (gt->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (gt->GetType() == cm::TargetType::GLOBAL_TARGET) {
std::string targetString =
"Special rule for the target " + gt->GetName();
std::vector<std::string> commands;
+40 -40
View File
@@ -132,7 +132,7 @@ void cmLocalVisualStudio7Generator::FixGlobalTargets()
// rules to force these targets to build.
auto const& tgts = this->GetGeneratorTargets();
for (auto const& l : tgts) {
if (l->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (l->GetType() == cm::TargetType::GLOBAL_TARGET) {
cmCustomCommandLines force_commands =
cmMakeSingleCommandLine({ "cd", "." });
std::string force = cmStrCat(this->GetCurrentBinaryDirectory(),
@@ -642,27 +642,27 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
bool targetBuilds = true;
switch (target->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
targetBuilds = false; // no manifest tool for object library
CM_FALLTHROUGH;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
projectType = "typeStaticLibrary";
configType = "4";
break;
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
projectType = "typeDynamicLibrary";
configType = "2";
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
configType = "1";
break;
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
configType = "10";
CM_FALLTHROUGH;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
targetBuilds = false;
break;
}
@@ -680,7 +680,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
target->GetName()));
return;
}
if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() <= cm::TargetType::OBJECT_LIBRARY) {
langForClCompile = linkLanguage;
if (langForClCompile == "C" || langForClCompile == "CXX" ||
langForClCompile == "Fortran") {
@@ -777,9 +777,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
std::string intermediateDir = this->MaybeRelativeToCurBinDir(
cmStrCat(target->GetSupportDirectory(), '/', configName));
if (target->GetType() < cmStateEnums::UTILITY) {
if (target->GetType() < cm::TargetType::UTILITY) {
std::string const& outDir =
target->GetType() == cmStateEnums::OBJECT_LIBRARY
target->GetType() == cm::TargetType::OBJECT_LIBRARY
? intermediateDir
: target->GetDirectory(configName);
fout << "\t\t\tOutputDirectory=\""
@@ -803,7 +803,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
std::string const targetName =
cmSystemTools::GetFilenameWithoutLastExtension(targetNameFull);
std::string const targetExt =
target->GetType() == cmStateEnums::OBJECT_LIBRARY
target->GetType() == cm::TargetType::OBJECT_LIBRARY
? ".lib"
: cmSystemTools::GetFilenameLastExtension(targetNameFull);
if (cm::optional<std::string> fortran = gg->GetPlatformToolsetFortran()) {
@@ -852,7 +852,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
targetOptions.OutputFlagMap(fout, 4);
targetOptions.OutputPreprocessorDefinitions(fout, 4, langForClCompile);
fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n";
if (target->GetType() <= cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() <= cm::TargetType::OBJECT_LIBRARY) {
// Specify the compiler program database file if configured.
std::string pdb = target->GetCompilePDBPath(configName);
if (!pdb.empty()) {
@@ -1000,9 +1000,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
switch (target->GetType()) {
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
case cmStateEnums::OBJECT_LIBRARY: {
case cm::TargetType::OBJECT_LIBRARY: {
std::string libpath = this->MaybeRelativeToCurBinDir(
cmStrCat(target->GetSupportDirectory(), '/', configName, '/',
target->GetName(), ".lib"));
@@ -1016,7 +1016,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n";
break;
}
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
std::string targetNameFull = target->GetFullName(configName);
std::string libpath =
cmStrCat(target->GetDirectory(configName), '/', targetNameFull);
@@ -1047,8 +1047,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(libpath) << "\"/>\n";
break;
}
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
cmGeneratorTarget::Names targetNames =
target->GetLibraryNames(configName);
@@ -1132,7 +1132,7 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
}
fout << "/>\n";
} break;
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
cmGeneratorTarget::Names targetNames =
target->GetExecutableNames(configName);
@@ -1228,9 +1228,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(
<< this->ConvertToXMLOutputPathSingle(temp) << "\"/>\n";
break;
}
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
break;
}
}
@@ -1310,8 +1310,8 @@ void cmLocalVisualStudio7GeneratorInternals::OutputLibraries(
fout << (lib.HasFeature() ? lib.GetFormattedItem(rel).Value : rel)
<< " ";
} else if (!lib.Target ||
(lib.Target->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
lib.Target->GetType() != cmStateEnums::OBJECT_LIBRARY)) {
(lib.Target->GetType() != cm::TargetType::INTERFACE_LIBRARY &&
lib.Target->GetType() != cm::TargetType::OBJECT_LIBRARY)) {
fout << lib.Value.Value << " ";
}
}
@@ -1391,7 +1391,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout,
cmSourceGroupFiles sourceGroupFiles;
// Add CMakeLists.txt file with rule to re-run CMake for user convenience.
if (target->GetType() != cmStateEnums::GLOBAL_TARGET &&
if (target->GetType() != cm::TargetType::GLOBAL_TARGET &&
target->GetName() != CMAKE_CHECK_BUILD_SYSTEM_TARGET) {
if (cmSourceFile* sf = this->CreateVCProjBuildRule()) {
cmGeneratorTarget::AllConfigSource acs;
@@ -1740,9 +1740,9 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
std::string source = sf->GetFullPath();
if (source != libName || target->GetType() == cmStateEnums::UTILITY ||
target->GetType() == cmStateEnums::GLOBAL_TARGET ||
target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (source != libName || target->GetType() == cm::TargetType::UTILITY ||
target->GetType() == cm::TargetType::GLOBAL_TARGET ||
target->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
cmGeneratorTarget::AllConfigSource const& acs =
sources.Sources[si->second];
@@ -1964,7 +1964,7 @@ void cmLocalVisualStudio7Generator::OutputTargetRules(
std::ostream& fout, std::string const& configName, cmGeneratorTarget* target,
std::string const& /*libName*/)
{
if (target->GetType() > cmStateEnums::GLOBAL_TARGET) {
if (target->GetType() > cm::TargetType::GLOBAL_TARGET) {
return;
}
EventWriter event(this, configName, fout);
@@ -2047,30 +2047,30 @@ void cmLocalVisualStudio7Generator::WriteProjectStartFortran(
char const* keyword = p ? p->c_str() : "Console Application";
char const* projectType = nullptr;
switch (target->GetType()) {
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
projectType = "typeStaticLibrary";
if (keyword) {
keyword = "Static Library";
}
break;
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
projectType = "typeDynamicLibrary";
if (!keyword) {
keyword = "Dll";
}
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
if (!keyword) {
keyword = "Console Application";
}
projectType = nullptr;
break;
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
if (projectType) {
+2 -2
View File
@@ -135,8 +135,8 @@ cmLocalVisualStudioGenerator::MaybeCreateImplibDir(cmGeneratorTarget* target,
// If an executable exports symbols then VS wants to create an
// import library but forgets to create the output directory.
// The Intel Fortran plugin always forgets to the directory.
if (target->GetType() != cmStateEnums::EXECUTABLE &&
!(isFortran && target->GetType() == cmStateEnums::SHARED_LIBRARY)) {
if (target->GetType() != cm::TargetType::EXECUTABLE &&
!(isFortran && target->GetType() == cm::TargetType::SHARED_LIBRARY)) {
return pcc;
}
std::string outDir =
+31 -37
View File
@@ -1186,7 +1186,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
cmTarget* t = &ti->second;
if (objLibCommands == cmObjectLibraryCommands::Reject &&
t->GetType() == cmStateEnums::OBJECT_LIBRARY) {
t->GetType() == cm::TargetType::OBJECT_LIBRARY) {
auto e = cmStrCat(
"Target \"", target,
"\" is an OBJECT library "
@@ -1194,7 +1194,7 @@ cmTarget* cmMakefile::GetCustomCommandTarget(
this->GetCMakeInstance()->IssueMessage(MessageType::FATAL_ERROR, e, lfbt);
return nullptr;
}
if (t->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (t->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
auto e = cmStrCat(
"Target \"", target,
"\" is an INTERFACE library "
@@ -2030,9 +2030,9 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
{
// for these targets do not add anything
switch (target.GetType()) {
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::INTERFACE_LIBRARY:
return;
default:;
}
@@ -2070,16 +2070,15 @@ void cmMakefile::AddAlias(std::string const& lname, std::string const& tgtName,
}
}
cmTarget* cmMakefile::AddLibrary(std::string const& lname,
cmStateEnums::TargetType type,
cmTarget* cmMakefile::AddLibrary(std::string const& lname, cm::TargetType type,
std::vector<std::string> const& srcs,
bool excludeFromAll)
{
assert(type == cmStateEnums::STATIC_LIBRARY ||
type == cmStateEnums::SHARED_LIBRARY ||
type == cmStateEnums::MODULE_LIBRARY ||
type == cmStateEnums::OBJECT_LIBRARY ||
type == cmStateEnums::INTERFACE_LIBRARY);
assert(type == cm::TargetType::STATIC_LIBRARY ||
type == cm::TargetType::SHARED_LIBRARY ||
type == cm::TargetType::MODULE_LIBRARY ||
type == cm::TargetType::OBJECT_LIBRARY ||
type == cm::TargetType::INTERFACE_LIBRARY);
cmTarget* target = this->AddNewTarget(type, lname);
// Clear its dependencies. Otherwise, dependencies might persist
@@ -2098,7 +2097,7 @@ cmTarget* cmMakefile::AddExecutable(std::string const& exeName,
std::vector<std::string> const& srcs,
bool excludeFromAll)
{
cmTarget* target = this->AddNewTarget(cmStateEnums::EXECUTABLE, exeName);
cmTarget* target = this->AddNewTarget(cm::TargetType::EXECUTABLE, exeName);
if (excludeFromAll) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
@@ -2107,13 +2106,13 @@ cmTarget* cmMakefile::AddExecutable(std::string const& exeName,
return target;
}
cmTarget* cmMakefile::AddNewTarget(cmStateEnums::TargetType type,
cmTarget* cmMakefile::AddNewTarget(cm::TargetType type,
std::string const& name)
{
return &this->CreateNewTarget(name, type).first;
}
cmTarget* cmMakefile::AddSynthesizedTarget(cmStateEnums::TargetType type,
cmTarget* cmMakefile::AddSynthesizedTarget(cm::TargetType type,
std::string const& name)
{
return &this
@@ -2123,8 +2122,8 @@ cmTarget* cmMakefile::AddSynthesizedTarget(cmStateEnums::TargetType type,
}
std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
std::string const& name, cmStateEnums::TargetType type,
cmTarget::PerConfig perConfig, cmTarget::Visibility vis)
std::string const& name, cm::TargetType type, cmTarget::PerConfig perConfig,
cmTarget::Visibility vis)
{
auto ib =
this->Targets.emplace(name, cmTarget(name, type, vis, this, perConfig));
@@ -2141,16 +2140,13 @@ std::pair<cmTarget&, bool> cmMakefile::CreateNewTarget(
cmTarget* cmMakefile::AddNewUtilityTarget(std::string const& utilityName,
bool excludeFromAll)
{
cmTarget* target = this->AddNewTarget(cmStateEnums::UTILITY, utilityName);
cmTarget* target = this->AddNewTarget(cm::TargetType::UTILITY, utilityName);
if (excludeFromAll) {
target->SetProperty("EXCLUDE_FROM_ALL", "TRUE");
}
return target;
}
namespace {
}
#if !defined(CMAKE_BOOTSTRAP)
void cmMakefile::ResolveSourceGroupGenex(cmLocalGenerator* lg)
@@ -3990,8 +3986,7 @@ void cmMakefile::RaiseScope(std::vector<std::string> const& variables)
}
cmTarget* cmMakefile::AddImportedTarget(std::string const& name,
cmStateEnums::TargetType type,
bool global)
cm::TargetType type, bool global)
{
// Create the target.
auto target =
@@ -4015,7 +4010,7 @@ cmTarget* cmMakefile::AddForeignTarget(std::string const& origin,
{
auto foreign_name = cmStrCat("@foreign_", origin, "::", name);
auto target = cm::make_unique<cmTarget>(
foreign_name, cmStateEnums::TargetType::INTERFACE_LIBRARY,
foreign_name, cm::TargetType::INTERFACE_LIBRARY,
cmTarget::Visibility::Foreign, this, cmTarget::PerConfig::Yes);
this->ImportedTargets[foreign_name] = target.get();
@@ -4026,13 +4021,13 @@ cmTarget* cmMakefile::AddForeignTarget(std::string const& origin,
return this->ImportedTargetsOwned.back().get();
}
cmTarget* cmMakefile::FindTargetToUse(
std::string const& name, cmStateEnums::TargetDomainSet domains) const
cmTarget* cmMakefile::FindTargetToUse(std::string const& name,
cm::TargetDomainSet domains) const
{
// Look for an imported target. These take priority because they
// are more local in scope and do not have to be globally unique.
auto targetName = name;
if (domains.contains(cmStateEnums::TargetDomain::ALIAS)) {
if (domains.contains(cm::TargetDomain::ALIAS)) {
// Look for local alias targets.
auto alias = this->AliasTargets.find(name);
if (alias != this->AliasTargets.end()) {
@@ -4041,9 +4036,8 @@ cmTarget* cmMakefile::FindTargetToUse(
}
auto const imported = this->ImportedTargets.find(targetName);
bool const useForeign =
domains.contains(cmStateEnums::TargetDomain::FOREIGN);
bool const useNative = domains.contains(cmStateEnums::TargetDomain::NATIVE);
bool const useForeign = domains.contains(cm::TargetDomain::FOREIGN);
bool const useNative = domains.contains(cm::TargetDomain::NATIVE);
if (imported != this->ImportedTargets.end()) {
if (imported->second->IsForeign() ? useForeign : useNative) {
@@ -4093,7 +4087,7 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
// The conflict is with a non-imported target.
// Allow this if the user has requested support.
cmake* cm = this->GetCMakeInstance();
if (isCustom && existing->GetType() == cmStateEnums::UTILITY &&
if (isCustom && existing->GetType() == cm::TargetType::UTILITY &&
this != existing->GetMakefile() &&
cm->GetState()->GetGlobalPropertyAsBool(
"ALLOW_DUPLICATE_CUSTOM_TARGETS")) {
@@ -4107,22 +4101,22 @@ bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
<< "\" because another target with the same name already exists. "
"The existing target is ";
switch (existing->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
e << "an executable ";
break;
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
e << "a static library ";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
e << "a shared library ";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
e << "a module library ";
break;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
e << "a custom target ";
break;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
e << "an interface library ";
break;
default:
+10 -12
View File
@@ -36,6 +36,7 @@
#include "cmSourceFileLocationKind.h"
#include "cmStateSnapshot.h"
#include "cmStateTypes.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
// IWYU does not see that 'std::unordered_map<std::string, cmTarget>'
@@ -270,21 +271,19 @@ public:
void AddLinkDirectory(std::string const& directory, bool before = false);
/** Create a new imported target with the name and type given. */
cmTarget* AddImportedTarget(std::string const& name,
cmStateEnums::TargetType type, bool global);
cmTarget* AddImportedTarget(std::string const& name, cm::TargetType type,
bool global);
cmTarget* AddForeignTarget(std::string const& origin,
std::string const& name);
std::pair<cmTarget&, bool> CreateNewTarget(
std::string const& name, cmStateEnums::TargetType type,
std::string const& name, cm::TargetType type,
cmTarget::PerConfig perConfig = cmTarget::PerConfig::Yes,
cmTarget::Visibility vis = cmTarget::Visibility::Normal);
cmTarget* AddNewTarget(cmStateEnums::TargetType type,
std::string const& name);
cmTarget* AddSynthesizedTarget(cmStateEnums::TargetType type,
std::string const& name);
cmTarget* AddNewTarget(cm::TargetType type, std::string const& name);
cmTarget* AddSynthesizedTarget(cm::TargetType type, std::string const& name);
/** Create a target instance for the utility. */
cmTarget* AddNewUtilityTarget(std::string const& utilityName,
@@ -390,8 +389,7 @@ public:
/**
* Set the name of the library.
*/
cmTarget* AddLibrary(std::string const& libname,
cmStateEnums::TargetType type,
cmTarget* AddLibrary(std::string const& libname, cm::TargetType type,
std::vector<std::string> const& srcs,
bool excludeFromAll = false);
void AddAlias(std::string const& libname, std::string const& tgt,
@@ -535,9 +533,9 @@ public:
/** Find a target to use in place of the given name. The target
returned may be imported or built within the project. */
cmTarget* FindTargetToUse(std::string const& name,
cmStateEnums::TargetDomainSet domains = {
cmStateEnums::TargetDomain::NATIVE,
cmStateEnums::TargetDomain::ALIAS }) const;
cm::TargetDomainSet domains = {
cm::TargetDomain::NATIVE,
cm::TargetDomain::ALIAS }) const;
bool IsAlias(std::string const& name) const;
std::map<std::string, std::string> GetAliasTargets() const
+17 -16
View File
@@ -30,6 +30,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
@@ -37,7 +38,7 @@ cmMakefileLibraryTargetGenerator::cmMakefileLibraryTargetGenerator(
: cmMakefileTargetGenerator(target)
{
this->CustomCommandDriver = OnDepends;
if (this->GeneratorTarget->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (this->GeneratorTarget->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
this->TargetNames =
this->GeneratorTarget->GetLibraryNames(this->GetConfigName());
}
@@ -69,10 +70,10 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
// write the link rules
// Write the rule for this target type.
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
this->WriteStaticLibraryRules();
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
this->WriteSharedLibraryRules(false);
if (this->GeneratorTarget->NeedRelinkBeforeInstall(
this->GetConfigName())) {
@@ -80,7 +81,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
this->WriteSharedLibraryRules(true);
}
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
this->WriteModuleLibraryRules(false);
if (this->GeneratorTarget->NeedRelinkBeforeInstall(
this->GetConfigName())) {
@@ -88,7 +89,7 @@ void cmMakefileLibraryTargetGenerator::WriteRuleFiles()
this->WriteModuleLibraryRules(true);
}
break;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
this->WriteObjectLibraryRules();
break;
default:
@@ -486,8 +487,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
linkFlags, this->GeneratorTarget, this->GetConfigName(), linkLanguage);
// Add OSX version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::MODULE_LIBRARY) {
this->AppendOSXVerFlag(linkFlags, linkLanguage, "COMPATIBILITY", true);
this->AppendOSXVerFlag(linkFlags, linkLanguage, "CURRENT", false);
}
@@ -581,13 +582,13 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Add the link message.
std::string buildEcho = cmStrCat("Linking ", linkLanguage);
switch (this->GeneratorTarget->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
buildEcho += " static library ";
break;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
buildEcho += " shared library ";
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
if (this->GeneratorTarget->IsCFBundleOnApple()) {
buildEcho += " CFBundle";
}
@@ -610,7 +611,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
std::vector<std::string> commands1;
// Add a command to remove any existing files for this library.
// for static libs only
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY) {
this->LocalGenerator->AppendCleanCommand(commands1, libCleanFiles,
this->GeneratorTarget, "target");
this->LocalGenerator->CreateCDCommand(
@@ -649,7 +650,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
#ifdef _WIN32
// There may be a manifest file for this target. Add it to the
// clean set just in case.
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
if (this->GeneratorTarget->GetType() != cm::TargetType::STATIC_LIBRARY) {
libCleanFiles.insert(this->LocalGenerator->MaybeRelativeToCurBinDir(
targetFullPath + ".manifest"));
}
@@ -679,7 +680,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
cmList archiveAppendCommands;
cmList archiveFinishCommands;
std::string::size_type archiveCommandLimit = std::string::npos;
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY) {
haveStaticLibraryRule = this->Makefile->IsDefinitionSet(linkRuleVar);
std::string arCreateVar =
cmStrCat("CMAKE_", linkLanguage, "_ARCHIVE_CREATE");
@@ -738,7 +739,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Collect up flags to link in needed libraries.
std::string linkLibs;
if (this->GeneratorTarget->GetType() != cmStateEnums::STATIC_LIBRARY) {
if (this->GeneratorTarget->GetType() != cm::TargetType::STATIC_LIBRARY) {
std::unique_ptr<cmLinkLineComputer> linkLineComputer =
this->CreateLinkLineComputer(
@@ -756,7 +757,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// rule.
std::string buildObjs;
cmMakefileTargetGenerator::ResponseFlagFor responseMode =
this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY
this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY
? cmMakefileTargetGenerator::ResponseFlagFor::Archive
: cmMakefileTargetGenerator::ResponseFlagFor::Link;
this->CreateObjectLists(useLinkScript, useArchiveRules,
@@ -849,7 +850,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules(
// Compute the directory portion of the install_name setting.
std::string install_name_dir;
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY) {
// Get the install_name directory for the build tree.
install_name_dir = this->GeneratorTarget->GetInstallNameDirForBuildTree(
this->GetConfigName());
+13 -12
View File
@@ -56,6 +56,7 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -95,17 +96,17 @@ std::unique_ptr<cmMakefileTargetGenerator> cmMakefileTargetGenerator::New(
std::unique_ptr<cmMakefileTargetGenerator> result;
switch (tgt->GetType()) {
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
result = cm::make_unique<cmMakefileExecutableTargetGenerator>(tgt);
break;
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
result = cm::make_unique<cmMakefileLibraryTargetGenerator>(tgt);
break;
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::UTILITY:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::UTILITY:
result = cm::make_unique<cmMakefileUtilityTargetGenerator>(tgt);
break;
default:
@@ -915,10 +916,10 @@ void cmMakefileTargetGenerator::WriteObjectRuleFiles(
std::string targetFullPathPDB;
std::string targetFullPathCompilePDB =
this->ComputeTargetCompilePDB(this->GetConfigName());
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE ||
this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::MODULE_LIBRARY) {
targetFullPathReal = this->GeneratorTarget->GetFullPath(
this->GetConfigName(), cmStateEnums::RuntimeBinaryArtifact, true);
targetFullPathPDB = cmStrCat(
@@ -2023,7 +2024,7 @@ void cmMakefileTargetGenerator::AppendTargetDepends(
std::vector<std::string>& depends, bool ignoreType)
{
// Static libraries never depend on anything for linking.
if (this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY &&
if (this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY &&
!ignoreType) {
return;
}
+33 -31
View File
@@ -42,13 +42,14 @@
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmNinjaNormalTargetGenerator::cmNinjaNormalTargetGenerator(
cmGeneratorTarget* target)
: cmNinjaTargetGenerator(target)
{
if (target->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (target->GetType() != cm::TargetType::OBJECT_LIBRARY) {
// on Windows the output dir is already needed at compile time
// ensure the directory exists (OutDir test)
for (auto const& config : this->GetConfigNames()) {
@@ -65,7 +66,7 @@ cmNinjaNormalTargetGenerator::~cmNinjaNormalTargetGenerator() = default;
void cmNinjaNormalTargetGenerator::Generate(std::string const& config)
{
if (this->GetGeneratorTarget()->GetType() !=
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
std::string lang = this->GeneratorTarget->GetLinkerLanguage(config);
if (this->TargetLinkLanguage(config).empty()) {
cmSystemTools::Error(
@@ -90,10 +91,11 @@ void cmNinjaNormalTargetGenerator::Generate(std::string const& config)
firstForConfig = false;
}
if (this->GetGeneratorTarget()->GetType() == cmStateEnums::OBJECT_LIBRARY) {
if (this->GetGeneratorTarget()->GetType() ==
cm::TargetType::OBJECT_LIBRARY) {
this->WriteObjectLibStatement(config);
} else if (this->GetGeneratorTarget()->GetType() ==
cmStateEnums::INTERFACE_LIBRARY) {
cm::TargetType::INTERFACE_LIBRARY) {
bool haveCxxModuleSources = false;
if (this->GetGeneratorTarget()->HaveCxx20ModuleSources()) {
haveCxxModuleSources = true;
@@ -183,17 +185,17 @@ void cmNinjaNormalTargetGenerator::WriteLanguagesRules(
char const* cmNinjaNormalTargetGenerator::GetVisibleTypeName() const
{
switch (this->GetGeneratorTarget()->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return "static library";
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return "shared library";
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
if (this->GetGeneratorTarget()->IsCFBundleOnApple()) {
return "CFBundle shared module";
} else {
return "shared module";
}
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return "executable";
default:
return nullptr;
@@ -452,7 +454,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(
std::vector<std::string> const& preLinkComments,
std::vector<std::string> const& postBuildComments)
{
cmStateEnums::TargetType targetType = this->GetGeneratorTarget()->GetType();
cm::TargetType targetType = this->GetGeneratorTarget()->GetType();
std::string linkRuleName = this->LanguageLinkerRule(config);
if (!this->GetGlobalGenerator()->HasRule(linkRuleName)) {
@@ -498,7 +500,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(
// build response file name
cmValue flag;
if (targetType == cmStateEnums::STATIC_LIBRARY) {
if (targetType == cm::TargetType::STATIC_LIBRARY) {
std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_ARCHIVE_FLAG";
flag = this->GetMakefile()->GetDefinition(cmakeLinkVar);
}
@@ -576,7 +578,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(
vars.Config = "$CONFIG";
std::string langFlags;
if (targetType != cmStateEnums::EXECUTABLE) {
if (targetType != cm::TargetType::EXECUTABLE) {
langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str();
}
@@ -642,7 +644,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkRule(
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
cmSystemTools::GetCMakeCommand(), cmOutputConverter::SHELL);
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
cmNinjaRule rule("CMAKE_SYMLINK_EXECUTABLE");
{
std::vector<std::string> cmd;
@@ -718,13 +720,13 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeDeviceLinkCmd()
// now build the correct command depending on if the target is
// an executable or a dynamic library.
switch (this->GetGeneratorTarget()->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY: {
linkCmds.assign(
this->GetMakefile()->GetDefinition("CMAKE_CUDA_DEVICE_LINK_LIBRARY"));
} break;
case cmStateEnums::EXECUTABLE: {
case cm::TargetType::EXECUTABLE: {
linkCmds.assign(this->GetMakefile()->GetDefinition(
"CMAKE_CUDA_DEVICE_LINK_EXECUTABLE"));
} break;
@@ -779,7 +781,7 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
}
}
switch (this->GetGeneratorTarget()->GetType()) {
case cmStateEnums::STATIC_LIBRARY: {
case cm::TargetType::STATIC_LIBRARY: {
// We have archive link commands set. First, delete the existing archive.
{
std::string cmakeCommand =
@@ -823,9 +825,9 @@ std::vector<std::string> cmNinjaNormalTargetGenerator::ComputeLinkCmd(
}
#endif
} break;
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
break;
default:
assert(false && "Unexpected target type");
@@ -1066,7 +1068,7 @@ void cmNinjaNormalTargetGenerator::WriteNvidiaDeviceLinkStatement(
this->GetMakefile()->GetSONameFlag(this->TargetLinkLanguage(config));
vars["SONAME"] = localGen.ConvertToOutputFormat(tgtNames.SharedObject,
cmOutputConverter::SHELL);
if (genTarget->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (genTarget->GetType() == cm::TargetType::SHARED_LIBRARY) {
std::string install_dir =
this->GetGeneratorTarget()->GetInstallNameDirForBuildTree(config);
if (!install_dir.empty()) {
@@ -1207,7 +1209,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetImplFileStream(fileConfig));
cmStateEnums::TargetType const targetType = gt->GetType();
cm::TargetType const targetType = gt->GetType();
this->GetImplFileStream(fileConfig)
<< "# Link build statements for " << cmState::GetTargetTypeName(targetType)
<< " target " << this->GetTargetName() << "\n\n";
@@ -1286,7 +1288,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
this->GetObjectFilePath(source, config));
}
}
if (targetType != cmStateEnums::EXECUTABLE ||
if (targetType != cm::TargetType::EXECUTABLE ||
gt->IsExecutableWithExports()) {
linkBuild.Outputs.push_back(vars["SWIFT_MODULE"]);
}
@@ -1363,8 +1365,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
this->TargetLinkLanguage(config));
// Add OS X version flags, if any.
if (this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::MODULE_LIBRARY) {
this->AppendOSXVerFlag(vars["LINK_FLAGS"],
this->TargetLinkLanguage(config), "COMPATIBILITY",
true);
@@ -1387,7 +1389,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
// code between the Makefile executable and library generators.
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
std::string t = vars["FLAGS"];
localGen.AddArchitectureFlags(t, gt, this->TargetLinkLanguage(config),
config);
@@ -1406,7 +1408,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage(config));
vars["SONAME"] = localGen.ConvertToOutputFormat(tgtNames.SharedObject,
cmOutputConverter::SHELL);
if (targetType == cmStateEnums::SHARED_LIBRARY) {
if (targetType == cm::TargetType::SHARED_LIBRARY) {
std::string install_dir = gt->GetInstallNameDirForBuildTree(config);
if (!install_dir.empty()) {
vars["INSTALLNAME_DIR"] = localGen.ConvertToOutputFormat(
@@ -1578,7 +1580,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
// build response file name
cmValue flag;
if (targetType == cmStateEnums::STATIC_LIBRARY) {
if (targetType == cm::TargetType::STATIC_LIBRARY) {
std::string cmakeLinkVar = cmakeVarLang + "_RESPONSE_FILE_ARCHIVE_FLAG";
flag = this->GetMakefile()->GetDefinition(cmakeLinkVar);
}
@@ -1613,7 +1615,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
if (cmComputeLinkInformation* cli = gt->GetLinkInformation(config)) {
for (auto const& item : cli->GetItems()) {
if (item.Target &&
item.Target->GetType() == cmStateEnums::SHARED_LIBRARY &&
item.Target->GetType() == cm::TargetType::SHARED_LIBRARY &&
!item.Target->IsFrameworkOnApple()) {
std::string const& lib =
this->ConvertToNinjaPath(item.Target->GetFullPath(config));
@@ -1671,7 +1673,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement(
postBuildComments);
if (symlinkNeeded) {
if (targetType == cmStateEnums::EXECUTABLE) {
if (targetType == cm::TargetType::EXECUTABLE) {
cmNinjaBuild build("CMAKE_SYMLINK_EXECUTABLE");
build.Comment = "Create executable symlink " + targetOutput;
build.Outputs.push_back(targetOutput);
@@ -1816,7 +1818,7 @@ void cmNinjaNormalTargetGenerator::WriteCxxModuleLibraryStatement(
cmGeneratorTarget::Names cmNinjaNormalTargetGenerator::TargetNames(
std::string const& config) const
{
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE) {
if (this->GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE) {
return this->GeneratorTarget->GetExecutableNames(config);
}
return this->GeneratorTarget->GetLibraryNames(config);
+19 -19
View File
@@ -51,11 +51,11 @@
#include "cmRulePlaceholderExpander.h"
#include "cmSourceFile.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetDepend.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -63,21 +63,21 @@ std::unique_ptr<cmNinjaTargetGenerator> cmNinjaTargetGenerator::New(
cmGeneratorTarget* target)
{
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return cm::make_unique<cmNinjaNormalTargetGenerator>(target);
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
if (target->HaveCxx20ModuleSources()) {
return cm::make_unique<cmNinjaNormalTargetGenerator>(target);
}
CM_FALLTHROUGH;
case cmStateEnums::UTILITY:
case cmStateEnums::GLOBAL_TARGET:
case cm::TargetType::UTILITY:
case cm::TargetType::GLOBAL_TARGET:
return cm::make_unique<cmNinjaUtilityTargetGenerator>(target);
default:
@@ -416,8 +416,8 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps(
{
// Static libraries never depend on other targets for linking.
if (!ignoreType &&
(this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::OBJECT_LIBRARY)) {
(this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::OBJECT_LIBRARY)) {
return cmNinjaDeps();
}
@@ -595,10 +595,10 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(
if (supportsPDB) {
std::string pdbPath;
std::string compilePdbPath = this->ComputeTargetCompilePDB(config);
if (this->GeneratorTarget->GetType() == cmStateEnums::EXECUTABLE ||
this->GeneratorTarget->GetType() == cmStateEnums::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cmStateEnums::MODULE_LIBRARY) {
if (this->GeneratorTarget->GetType() == cm::TargetType::EXECUTABLE ||
this->GeneratorTarget->GetType() == cm::TargetType::STATIC_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GeneratorTarget->GetType() == cm::TargetType::MODULE_LIBRARY) {
pdbPath = cmStrCat(this->GeneratorTarget->GetPDBDirectory(config), '/',
this->GeneratorTarget->GetPDBName(config));
}
@@ -2168,7 +2168,7 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
auto isImportableTarget = [](cmGeneratorTarget const& tgt) -> bool {
// Everything except for executables that don't export anything should emit
// some way to import them.
if (tgt.GetType() == cmStateEnums::EXECUTABLE) {
if (tgt.GetType() == cm::TargetType::EXECUTABLE) {
return tgt.IsExecutableWithExports();
}
return true;
@@ -2191,20 +2191,20 @@ void cmNinjaTargetGenerator::WriteSwiftObjectBuildStatement(
}();
// Build flags common to both compile and emit-module edges.
if (target.GetType() != cmStateEnums::EXECUTABLE) {
if (target.GetType() != cm::TargetType::EXECUTABLE) {
// Without `-emit-library` or `-emit-executable`, targets with a single
// source file parse as a Swift script instead of like normal source. For
// non-executable targets, append this to ensure that they are parsed like
// a normal source.
this->LocalGenerator->AppendFlags(vars["FLAGS"], "-parse-as-library");
}
if (target.GetType() == cmStateEnums::STATIC_LIBRARY) {
if (target.GetType() == cm::TargetType::STATIC_LIBRARY) {
this->LocalGenerator->AppendFlags(vars["FLAGS"], "-static");
}
this->LocalGenerator->AppendFlags(vars["FLAGS"],
cmStrCat("-module-name ", moduleName));
if (target.GetType() != cmStateEnums::EXECUTABLE) {
if (target.GetType() != cm::TargetType::EXECUTABLE) {
std::string const libraryLinkNameFlag = "-module-link-name";
std::string const libraryLinkName =
this->GetGeneratorTarget()->GetLibraryNames(config).Base;
+8 -7
View File
@@ -21,10 +21,10 @@
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
@@ -49,7 +49,8 @@ void cmNinjaUtilityTargetGenerator::Generate(std::string const& config)
continue;
}
if (fileConfig != config &&
this->GetGeneratorTarget()->GetType() == cmStateEnums::GLOBAL_TARGET) {
this->GetGeneratorTarget()->GetType() ==
cm::TargetType::GLOBAL_TARGET) {
continue;
}
this->WriteUtilBuildStatements(config, fileConfig);
@@ -130,7 +131,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
outputConfig = config;
}
lg->AppendTargetOutputs(genTarget, phonyBuild.Outputs, outputConfig);
if (genTarget->Target->GetType() != cmStateEnums::GLOBAL_TARGET) {
if (genTarget->Target->GetType() != cm::TargetType::GLOBAL_TARGET) {
lg->AppendTargetOutputs(genTarget, gg->GetByproductsForCleanTarget(),
config);
std::copy(util_outputs.ExplicitOuts.begin(),
@@ -143,7 +144,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
if (commands.empty()) {
phonyBuild.Comment = "Utility command for " + this->GetTargetName();
phonyBuild.ExplicitDeps = std::move(deps);
if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
if (genTarget->GetType() != cm::TargetType::GLOBAL_TARGET) {
gg->WriteBuild(this->GetImplFileStream(fileConfig), phonyBuild);
} else {
gg->WriteBuild(this->GetCommonFileStream(), phonyBuild);
@@ -176,7 +177,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
std::string ccConfig;
if (genTarget->Target->IsPerConfig() &&
genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
genTarget->GetType() != cm::TargetType::GLOBAL_TARGET) {
ccConfig = config;
}
if (config == fileConfig ||
@@ -188,7 +189,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
}
phonyBuild.ExplicitDeps.push_back(utilCommandName);
if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
if (genTarget->GetType() != cm::TargetType::GLOBAL_TARGET) {
gg->WriteBuild(this->GetImplFileStream(fileConfig), phonyBuild);
} else {
gg->WriteBuild(this->GetCommonFileStream(), phonyBuild);
@@ -201,7 +202,7 @@ void cmNinjaUtilityTargetGenerator::WriteUtilBuildStatements(
// Add an alias for the logical target name regardless of what directory
// contains it. Skip this for GLOBAL_TARGET because they are meant to
// be per-directory and have one at the top-level anyway.
if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
if (genTarget->GetType() != cm::TargetType::GLOBAL_TARGET) {
gg->AddTargetAlias(this->GetTargetName(), genTarget, config);
}
}
+9 -8
View File
@@ -27,6 +27,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
namespace {
@@ -853,7 +854,7 @@ void cmPackageInfoReader::ReadCxxModulesMetadata(
}
cmTarget* cmPackageInfoReader::AddLibraryComponent(
cmMakefile* makefile, cmStateEnums::TargetType type, std::string const& name,
cmMakefile* makefile, cm::TargetType type, std::string const& name,
Json::Value const& data, std::string const& package, bool global) const
{
// Create the imported target.
@@ -893,23 +894,23 @@ bool cmPackageInfoReader::ImportTargets(cmMakefile* makefile,
}
}
auto createTarget = [&](cmStateEnums::TargetType typeEnum) {
auto createTarget = [&](cm::TargetType typeEnum) {
return this->AddLibraryComponent(makefile, typeEnum, fullName, *ci,
package, global);
};
cmTarget* target = nullptr;
if (type == "symbolic"_s) {
target = createTarget(cmStateEnums::INTERFACE_LIBRARY);
target = createTarget(cm::TargetType::INTERFACE_LIBRARY);
target->SetSymbolic(true);
} else if (type == "dylib"_s) {
target = createTarget(cmStateEnums::SHARED_LIBRARY);
target = createTarget(cm::TargetType::SHARED_LIBRARY);
} else if (type == "module"_s) {
target = createTarget(cmStateEnums::MODULE_LIBRARY);
target = createTarget(cm::TargetType::MODULE_LIBRARY);
} else if (type == "archive"_s) {
target = createTarget(cmStateEnums::STATIC_LIBRARY);
target = createTarget(cm::TargetType::STATIC_LIBRARY);
} else if (type == "interface"_s) {
target = createTarget(cmStateEnums::INTERFACE_LIBRARY);
target = createTarget(cm::TargetType::INTERFACE_LIBRARY);
} else {
makefile->IssueMessage(MessageType::WARNING,
cmStrCat(R"(component ")"_s, fullName,
@@ -933,7 +934,7 @@ bool cmPackageInfoReader::ImportTargets(cmMakefile* makefile,
}
cmTarget* const target = makefile->AddImportedTarget(
package, cmStateEnums::INTERFACE_LIBRARY, global);
package, cm::TargetType::INTERFACE_LIBRARY, global);
for (std::string const& name : defaultComponents) {
std::string const& fullName = cmStrCat(package, "::"_s, name);
AppendProperty(makefile, target, "LINK_LIBRARIES"_s, {}, fullName);
+5 -4
View File
@@ -14,12 +14,14 @@
#include <cm3p/json/value.h>
#include "cmStateTypes.h"
class cmExecutionStatus;
class cmMakefile;
class cmTarget;
namespace cm {
enum class TargetType;
} // namespace cm
struct cmPackageRequirement
{
std::string Name;
@@ -87,8 +89,7 @@ public:
private:
cmPackageInfoReader() = default;
cmTarget* AddLibraryComponent(cmMakefile* makefile,
cmStateEnums::TargetType type,
cmTarget* AddLibraryComponent(cmMakefile* makefile, cm::TargetType type,
std::string const& name,
Json::Value const& data,
std::string const& package, bool global) const;
+6 -6
View File
@@ -17,10 +17,10 @@
#include "cmQtAutoGen.h"
#include "cmQtAutoGenInitializer.h"
#include "cmState.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmQtAutoGenGlobalInitializer::Keywords::Keywords()
@@ -79,11 +79,11 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
for (auto const& target : localGen->GetGeneratorTargets()) {
// Process only certain target types
switch (target->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
// Process target
break;
default:
+4 -3
View File
@@ -57,6 +57,7 @@
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
#include "cmake.h"
@@ -105,8 +106,8 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
std::string const& config)
{
bool cycle = false;
if ((targetOrigin->GetType() == cmStateEnums::STATIC_LIBRARY) &&
(targetDepend->GetType() == cmStateEnums::STATIC_LIBRARY)) {
if ((targetOrigin->GetType() == cm::TargetType::STATIC_LIBRARY) &&
(targetDepend->GetType() == cm::TargetType::STATIC_LIBRARY)) {
std::set<cmGeneratorTarget const*> knownLibs;
std::deque<cmGeneratorTarget const*> testLibs;
@@ -130,7 +131,7 @@ bool StaticLibraryCycle(cmGeneratorTarget const* targetOrigin,
for (cmLinkItem const& item : libs->Libraries) {
cmGeneratorTarget const* depTarget = item.Target;
if (depTarget &&
(depTarget->GetType() == cmStateEnums::STATIC_LIBRARY) &&
(depTarget->GetType() == cm::TargetType::STATIC_LIBRARY) &&
knownLibs.insert(depTarget).second) {
testLibs.push_back(depTarget);
}
+8 -7
View File
@@ -17,8 +17,8 @@
#include "cmExecutionStatus.h"
#include "cmList.h"
#include "cmMakefile.h"
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#if defined(_WIN32)
# include "cmGlobalGenerator.h"
@@ -180,19 +180,20 @@ bool cmRuntimeDependencyArchive::GetRuntimeDependencies(
std::vector<std::string> const& modules)
{
for (auto const& exe : executables) {
if (!this->Linker->ScanDependencies(exe, cmStateEnums::EXECUTABLE)) {
if (!this->Linker->ScanDependencies(exe, cm::TargetType::EXECUTABLE)) {
return false;
}
}
for (auto const& lib : libraries) {
if (!this->Linker->ScanDependencies(lib, cmStateEnums::SHARED_LIBRARY)) {
if (!this->Linker->ScanDependencies(lib, cm::TargetType::SHARED_LIBRARY)) {
return false;
}
}
return std::all_of(
modules.begin(), modules.end(), [this](std::string const& mod) -> bool {
return this->Linker->ScanDependencies(mod, cmStateEnums::MODULE_LIBRARY);
});
return std::all_of(modules.begin(), modules.end(),
[this](std::string const& mod) -> bool {
return this->Linker->ScanDependencies(
mod, cm::TargetType::MODULE_LIBRARY);
});
}
void cmRuntimeDependencyArchive::SetError(std::string const& e)
+11 -11
View File
@@ -32,28 +32,28 @@
#include "cmSbomObject.h"
#include "cmSpdx.h"
#include "cmSpdxSerializer.h"
#include "cmStateTypes.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetExport.h"
#include "cmTargetTypes.h"
#include "cmValue.h"
cmSpdxPackage::PurposeId GetPurpose(cmStateEnums::TargetType type)
cmSpdxPackage::PurposeId GetPurpose(cm::TargetType type)
{
switch (type) {
case cmStateEnums::TargetType::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return cmSpdxPackage::PurposeId::APPLICATION;
case cmStateEnums::TargetType::STATIC_LIBRARY:
case cmStateEnums::TargetType::SHARED_LIBRARY:
case cmStateEnums::TargetType::MODULE_LIBRARY:
case cmStateEnums::TargetType::OBJECT_LIBRARY:
case cmStateEnums::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
return cmSpdxPackage::PurposeId::LIBRARY;
case cmStateEnums::TargetType::UTILITY:
case cm::TargetType::UTILITY:
return cmSpdxPackage::PurposeId::SOURCE;
case cmStateEnums::TargetType::GLOBAL_TARGET:
case cmStateEnums::TargetType::UNKNOWN_LIBRARY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::UNKNOWN_LIBRARY:
default:
return cmSpdxPackage::PurposeId::ARCHIVE;
}
+11 -11
View File
@@ -26,6 +26,7 @@
#include "cmStateSnapshot.h"
#include "cmStringAlgorithms.h"
#include "cmSystemTools.h"
#include "cmTargetTypes.h"
#include "cmake.h"
namespace cmStateDetail {
@@ -42,8 +43,7 @@ cmState::cmState(Role role, TryCompile isTryCompile)
cmState::~cmState() = default;
std::string const& cmState::GetTargetTypeName(
cmStateEnums::TargetType targetType)
std::string const& cmState::GetTargetTypeName(cm::TargetType targetType)
{
#define MAKE_STATIC_PROP(PROP) static const std::string prop##PROP = #PROP
MAKE_STATIC_PROP(STATIC_LIBRARY);
@@ -59,23 +59,23 @@ std::string const& cmState::GetTargetTypeName(
#undef MAKE_STATIC_PROP
switch (targetType) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return propSTATIC_LIBRARY;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return propMODULE_LIBRARY;
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
return propSHARED_LIBRARY;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return propOBJECT_LIBRARY;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
return propEXECUTABLE;
case cmStateEnums::UTILITY:
case cm::TargetType::UTILITY:
return propUTILITY;
case cmStateEnums::GLOBAL_TARGET:
case cm::TargetType::GLOBAL_TARGET:
return propGLOBAL_TARGET;
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
return propINTERFACE_LIBRARY;
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UNKNOWN_LIBRARY:
return propUNKNOWN_LIBRARY;
}
assert(false && "Unexpected target type");
+5 -2
View File
@@ -39,6 +39,10 @@ struct cmListFileArgument;
template <typename T>
class BT;
namespace cm {
enum class TargetType;
} // namespace cm
class cmState
{
friend class cmStateSnapshot;
@@ -67,8 +71,7 @@ public:
cmState(cmState const&) = delete;
cmState& operator=(cmState const&) = delete;
static std::string const& GetTargetTypeName(
cmStateEnums::TargetType targetType);
static std::string const& GetTargetTypeName(cm::TargetType targetType);
cmStateSnapshot CreateBaseSnapshot();
cmStateSnapshot CreateBuildsystemDirectorySnapshot(
-32
View File
@@ -47,38 +47,6 @@ enum class CommandType
Function
};
// There are multiple overlapping ranges represented here. Be aware that adding
// a value to this enumeration may cause failures in numerous places which
// assume details about the ordering.
enum TargetType
{
EXECUTABLE,
STATIC_LIBRARY,
SHARED_LIBRARY,
MODULE_LIBRARY,
OBJECT_LIBRARY,
UTILITY,
GLOBAL_TARGET,
INTERFACE_LIBRARY,
UNKNOWN_LIBRARY
};
// Target search domains for FindTarget() style commands.
enum class TargetDomain : unsigned
{
// Native, unaliased CMake targets, generated via add_library or
// add_executable
NATIVE,
// Alias index, must include another domain
ALIAS,
// Foreign domain targets, generated directly inside CMake
FOREIGN
};
using TargetDomainSet = cm::enum_set<TargetDomain>;
static TargetDomainSet const AllTargetDomains{ TargetDomain::NATIVE,
TargetDomain::ALIAS,
TargetDomain::FOREIGN };
enum CacheEntryType
{
BOOL = 0,
+83 -84
View File
@@ -612,7 +612,7 @@ cmValue copyProperty(cmTarget const* src, cmTarget* dst,
class cmTargetInternals
{
public:
cmStateEnums::TargetType TargetType;
cm::TargetType TargetType;
cmTarget::Origin Origin = cmTarget::Origin::Unknown;
cmMakefile* Makefile;
cmPolicies::PolicyMap PolicyMap;
@@ -669,7 +669,7 @@ public:
std::unordered_map<cm::string_view, FileSetType> FileSetTypes;
cmTargetInternals(std::string name, cmStateEnums::TargetType type,
cmTargetInternals(std::string name, cm::TargetType type,
cmTarget::Visibility visibility, cmMakefile* mf,
cmTarget::PerConfig perConfig);
@@ -701,8 +701,7 @@ public:
}
};
cmTargetInternals::cmTargetInternals(std::string name,
cmStateEnums::TargetType type,
cmTargetInternals::cmTargetInternals(std::string name, cm::TargetType type,
cmTarget::Visibility visibility,
cmMakefile* mf,
cmTarget::PerConfig perConfig)
@@ -935,8 +934,8 @@ std::pair<bool, cmValue> UsageRequirementProperty::Read(
return { did_read, value };
}
cmTarget::cmTarget(std::string name, cmStateEnums::TargetType type,
Visibility vis, cmMakefile* mf, PerConfig perConfig)
cmTarget::cmTarget(std::string name, cm::TargetType type, Visibility vis,
cmMakefile* mf, PerConfig perConfig)
: impl(cm::make_unique<cmTargetInternals>(std::move(name), type, vis, mf,
perConfig))
{
@@ -978,38 +977,38 @@ cmTarget::cmTarget(std::string name, cmStateEnums::TargetType type,
if (!this->IsImported()) {
metConditions.insert(TargetProperty::InitCondition::NonImportedTarget);
}
if (this->impl->TargetType != cmStateEnums::UTILITY &&
this->impl->TargetType != cmStateEnums::GLOBAL_TARGET) {
if (this->impl->TargetType != cm::TargetType::UTILITY &&
this->impl->TargetType != cm::TargetType::GLOBAL_TARGET) {
metConditions.insert(TargetProperty::InitCondition::NormalTarget);
if (this->IsNormal()) {
metConditions.insert(
TargetProperty::InitCondition::NormalNonImportedTarget);
}
if (this->impl->TargetType != cmStateEnums::INTERFACE_LIBRARY) {
if (this->impl->TargetType != cm::TargetType::INTERFACE_LIBRARY) {
metConditions.insert(TargetProperty::InitCondition::TargetWithArtifact);
if (this->impl->TargetType != cmStateEnums::EXECUTABLE) {
if (this->impl->TargetType != cm::TargetType::EXECUTABLE) {
metConditions.insert(
TargetProperty::InitCondition::NonExecutableWithArtifact);
}
}
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::STATIC_LIBRARY) {
if (this->impl->TargetType == cm::TargetType::SHARED_LIBRARY ||
this->impl->TargetType == cm::TargetType::STATIC_LIBRARY) {
metConditions.insert(
TargetProperty::InitCondition::LinkableLibraryTarget);
}
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY) {
if (this->impl->TargetType == cm::TargetType::SHARED_LIBRARY) {
metConditions.insert(TargetProperty::InitCondition::SharedLibraryTarget);
}
}
if (this->impl->TargetType == cmStateEnums::EXECUTABLE) {
if (this->impl->TargetType == cm::TargetType::EXECUTABLE) {
metConditions.insert(TargetProperty::InitCondition::ExecutableTarget);
}
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::EXECUTABLE) {
if (this->impl->TargetType == cm::TargetType::SHARED_LIBRARY ||
this->impl->TargetType == cm::TargetType::EXECUTABLE) {
metConditions.insert(
TargetProperty::InitCondition::TargetWithSymbolExports);
}
if (this->impl->TargetType <= cmStateEnums::GLOBAL_TARGET) {
if (this->impl->TargetType <= cm::TargetType::GLOBAL_TARGET) {
metConditions.insert(TargetProperty::InitCondition::TargetWithCommands);
}
@@ -1033,7 +1032,7 @@ cmTarget::cmTarget(std::string name, cmStateEnums::TargetType type,
// Replace everything after "CMAKE_"
defKey.replace(
defKey.begin() + 6, defKey.end(),
cmStrCat(this->impl->TargetType == cmStateEnums::EXECUTABLE
cmStrCat(this->impl->TargetType == cm::TargetType::EXECUTABLE
? "EXECUTABLE"
: "SHARED_LIBRARY",
'_', property));
@@ -1041,7 +1040,7 @@ cmTarget::cmTarget(std::string name, cmStateEnums::TargetType type,
this->SetProperty(property, value);
return;
}
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY) {
if (this->impl->TargetType == cm::TargetType::SHARED_LIBRARY) {
if (default_value) {
this->SetProperty(property, default_value);
}
@@ -1092,8 +1091,8 @@ cmTarget::cmTarget(std::string name, cmStateEnums::TargetType type,
}
// Clean up some property defaults.
if (this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::MODULE_LIBRARY) {
if (this->impl->TargetType == cm::TargetType::SHARED_LIBRARY ||
this->impl->TargetType == cm::TargetType::MODULE_LIBRARY) {
this->SetProperty("POSITION_INDEPENDENT_CODE", "True");
}
@@ -1139,7 +1138,7 @@ cmTarget::~cmTarget() = default;
cmTarget& cmTarget::operator=(cmTarget&&) noexcept = default;
cmStateEnums::TargetType cmTarget::GetType() const
cm::TargetType cmTarget::GetType() const
{
return this->impl->TargetType;
}
@@ -1262,26 +1261,26 @@ cmFindPackageStack const& cmTarget::GetFindPackageStack() const
bool cmTarget::IsExecutableWithExports() const
{
return (this->GetType() == cmStateEnums::EXECUTABLE &&
return (this->GetType() == cm::TargetType::EXECUTABLE &&
this->GetPropertyAsBool("ENABLE_EXPORTS"));
}
bool cmTarget::IsSharedLibraryWithExports() const
{
return (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
return (this->GetType() == cm::TargetType::SHARED_LIBRARY &&
this->GetPropertyAsBool("ENABLE_EXPORTS"));
}
bool cmTarget::IsFrameworkOnApple() const
{
return ((this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->GetType() == cmStateEnums::STATIC_LIBRARY) &&
return ((this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->GetType() == cm::TargetType::STATIC_LIBRARY) &&
this->IsApple() && this->GetPropertyAsBool("FRAMEWORK"));
}
bool cmTarget::IsArchivedAIXSharedLibrary() const
{
if (this->GetType() == cmStateEnums::SHARED_LIBRARY && this->IsAIX()) {
if (this->GetType() == cm::TargetType::SHARED_LIBRARY && this->IsAIX()) {
cmValue value = this->GetProperty("AIX_SHARED_LIBRARY_ARCHIVE");
if (!value.IsEmpty()) {
return value.IsOn();
@@ -1304,13 +1303,13 @@ bool cmTarget::IsArchivedAIXSharedLibrary() const
bool cmTarget::IsAppBundleOnApple() const
{
return (this->GetType() == cmStateEnums::EXECUTABLE && this->IsApple() &&
return (this->GetType() == cm::TargetType::EXECUTABLE && this->IsApple() &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}
bool cmTarget::IsAndroidGuiExecutable() const
{
return (this->GetType() == cmStateEnums::EXECUTABLE &&
return (this->GetType() == cm::TargetType::EXECUTABLE &&
this->impl->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI"));
}
@@ -1601,8 +1600,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
if (cmGeneratorExpression::Find(lib) != std::string::npos ||
(tgt &&
(tgt->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
tgt->GetType() == cmStateEnums::OBJECT_LIBRARY)) ||
(tgt->GetType() == cm::TargetType::INTERFACE_LIBRARY ||
tgt->GetType() == cm::TargetType::OBJECT_LIBRARY)) ||
(this->impl->Name == lib)) {
return;
}
@@ -1617,8 +1616,8 @@ void cmTarget::AddLinkLibrary(cmMakefile& mf, std::string const& lib,
// may be purposefully duplicated to handle recursive dependencies,
// and we removing one instance will break the link line. Duplicates
// will be appropriately eliminated at emit time.
if (this->impl->TargetType >= cmStateEnums::STATIC_LIBRARY &&
this->impl->TargetType <= cmStateEnums::MODULE_LIBRARY &&
if (this->impl->TargetType >= cm::TargetType::STATIC_LIBRARY &&
this->impl->TargetType <= cm::TargetType::MODULE_LIBRARY &&
(this->GetPolicyStatusCMP0073() == cmPolicies::OLD ||
this->GetPolicyStatusCMP0073() == cmPolicies::WARN)) {
std::string targetEntry = cmStrCat(this->impl->Name, "_LIB_DEPENDS");
@@ -2222,7 +2221,7 @@ void cmTarget::SetProperty(std::string const& prop, cmValue value)
this->impl->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_ID");
auto const& compilerVersion =
this->impl->Makefile->GetSafeDefinition("CMAKE_CUDA_COMPILER_VERSION");
if (this->GetType() != cmStateEnums::OBJECT_LIBRARY) {
if (this->GetType() != cm::TargetType::OBJECT_LIBRARY) {
auto e =
cmStrCat(prop, " property can only be applied to OBJECT targets(",
this->impl->Name, ")\n");
@@ -2427,10 +2426,10 @@ cmValue cmTargetInternals::GetFileSetPaths(cmTarget const* self,
void cmTarget::AppendBuildInterfaceIncludes()
{
if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
this->GetType() != cmStateEnums::STATIC_LIBRARY &&
this->GetType() != cmStateEnums::MODULE_LIBRARY &&
this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
if (this->GetType() != cm::TargetType::SHARED_LIBRARY &&
this->GetType() != cm::TargetType::STATIC_LIBRARY &&
this->GetType() != cm::TargetType::MODULE_LIBRARY &&
this->GetType() != cm::TargetType::INTERFACE_LIBRARY &&
!this->IsExecutableWithExports()) {
return;
}
@@ -2487,7 +2486,7 @@ bool CheckLinkLibraryPattern(UsageRequirementProperty const& usage,
void cmTarget::FinalizeTargetConfiguration(cmBTStringRange compileDefinitions)
{
if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
if (this->GetType() == cm::TargetType::GLOBAL_TARGET) {
return;
}
@@ -2502,7 +2501,7 @@ void cmTarget::FinalizeTargetConfiguration(cmBTStringRange compileDefinitions)
this->AppendBuildInterfaceIncludes();
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
return;
}
@@ -2958,16 +2957,16 @@ bool cmTarget::IsPerConfig() const
bool cmTarget::IsRuntimeBinary() const
{
switch (this->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
return true;
case cmStateEnums::OBJECT_LIBRARY:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::UTILITY:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
return false;
@@ -2982,16 +2981,16 @@ bool cmTarget::CanCompileSources() const
return true;
}
switch (this->GetType()) {
case cmStateEnums::EXECUTABLE:
case cmStateEnums::STATIC_LIBRARY:
case cmStateEnums::SHARED_LIBRARY:
case cmStateEnums::MODULE_LIBRARY:
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::EXECUTABLE:
case cm::TargetType::STATIC_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
return true;
case cmStateEnums::UTILITY:
case cmStateEnums::INTERFACE_LIBRARY:
case cmStateEnums::GLOBAL_TARGET:
case cmStateEnums::UNKNOWN_LIBRARY:
case cm::TargetType::UTILITY:
case cm::TargetType::INTERFACE_LIBRARY:
case cm::TargetType::GLOBAL_TARGET:
case cm::TargetType::UNKNOWN_LIBRARY:
break;
}
return false;
@@ -3011,9 +3010,9 @@ char const* cmTarget::GetSuffixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{
switch (this->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return "CMAKE_STATIC_LIBRARY_SUFFIX";
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
return this->IsArchivedAIXSharedLibrary()
@@ -3024,7 +3023,7 @@ char const* cmTarget::GetSuffixVariableInternal(
: "CMAKE_IMPORT_LIBRARY_SUFFIX";
}
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
return "CMAKE_SHARED_MODULE_SUFFIX";
@@ -3032,7 +3031,7 @@ char const* cmTarget::GetSuffixVariableInternal(
return "CMAKE_IMPORT_LIBRARY_SUFFIX";
}
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
// Android GUI application packages store the native
@@ -3055,9 +3054,9 @@ char const* cmTarget::GetPrefixVariableInternal(
cmStateEnums::ArtifactType artifact) const
{
switch (this->GetType()) {
case cmStateEnums::STATIC_LIBRARY:
case cm::TargetType::STATIC_LIBRARY:
return "CMAKE_STATIC_LIBRARY_PREFIX";
case cmStateEnums::SHARED_LIBRARY:
case cm::TargetType::SHARED_LIBRARY:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
return "CMAKE_SHARED_LIBRARY_PREFIX";
@@ -3066,7 +3065,7 @@ char const* cmTarget::GetPrefixVariableInternal(
: "CMAKE_IMPORT_LIBRARY_PREFIX";
}
break;
case cmStateEnums::MODULE_LIBRARY:
case cm::TargetType::MODULE_LIBRARY:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
return "CMAKE_SHARED_MODULE_PREFIX";
@@ -3074,7 +3073,7 @@ char const* cmTarget::GetPrefixVariableInternal(
return "CMAKE_IMPORT_LIBRARY_PREFIX";
}
break;
case cmStateEnums::EXECUTABLE:
case cm::TargetType::EXECUTABLE:
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
// Android GUI application packages store the native
@@ -3112,7 +3111,7 @@ std::string cmTarget::ImportedGetFullPath(
cmValue imp = nullptr;
std::string suffix;
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY &&
if (this->GetType() != cm::TargetType::INTERFACE_LIBRARY &&
this->GetMappedConfig(desired_config, loc, imp, suffix)) {
switch (artifact) {
case cmStateEnums::RuntimeBinaryArtifact:
@@ -3129,7 +3128,7 @@ std::string cmTarget::ImportedGetFullPath(
result = *location;
}
if (result.empty() &&
(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
(this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports())) {
impProp = cmStrCat("IMPORTED_IMPLIB", suffix);
if (cmValue config_implib = this->GetProperty(impProp)) {
@@ -3140,9 +3139,9 @@ std::string cmTarget::ImportedGetFullPath(
}
}
if (this->IsApple() &&
(this->impl->TargetType == cmStateEnums::SHARED_LIBRARY ||
this->impl->TargetType == cmStateEnums::STATIC_LIBRARY ||
this->impl->TargetType == cmStateEnums::UNKNOWN_LIBRARY) &&
(this->impl->TargetType == cm::TargetType::SHARED_LIBRARY ||
this->impl->TargetType == cm::TargetType::STATIC_LIBRARY ||
this->impl->TargetType == cm::TargetType::UNKNOWN_LIBRARY) &&
cmSystemTools::IsPathToXcFramework(result)) {
auto plist = cmParseXcFrameworkPlist(result, *this->impl->Makefile,
this->impl->Backtrace);
@@ -3163,7 +3162,7 @@ std::string cmTarget::ImportedGetFullPath(
case cmStateEnums::ImportLibraryArtifact:
if (imp) {
result = *imp;
} else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
} else if (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
std::string impProp = cmStrCat("IMPORTED_IMPLIB", suffix);
if (cmValue config_implib = this->GetProperty(impProp)) {
@@ -3177,12 +3176,12 @@ std::string cmTarget::ImportedGetFullPath(
}
if (result.empty() && missingOk != ImportArtifactMissingOk::Yes) {
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() != cm::TargetType::INTERFACE_LIBRARY) {
auto message = [&]() -> std::string {
std::string unset;
std::string configuration;
if (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
if (this->GetType() == cm::TargetType::SHARED_LIBRARY &&
artifact == cmStateEnums::RuntimeBinaryArtifact) {
unset = "IMPORTED_LOCATION or IMPORTED_IMPLIB";
} else if (artifact == cmStateEnums::RuntimeBinaryArtifact) {
@@ -3327,7 +3326,7 @@ bool cmTarget::HasFileSets() const
bool cmTargetInternals::CheckImportedLibName(std::string const& prop,
std::string const& value) const
{
if (this->TargetType != cmStateEnums::INTERFACE_LIBRARY ||
if (this->TargetType != cm::TargetType::INTERFACE_LIBRARY ||
!this->IsImported()) {
this->Makefile->IssueMessage(
MessageType::FATAL_ERROR,
@@ -3428,9 +3427,9 @@ bool cmTarget::GetMappedConfigOld(std::string const& desired_config,
}
std::string locPropBase;
if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
if (this->GetType() == cm::TargetType::INTERFACE_LIBRARY) {
locPropBase = "IMPORTED_LIBNAME";
} else if (this->GetType() == cmStateEnums::OBJECT_LIBRARY) {
} else if (this->GetType() == cm::TargetType::OBJECT_LIBRARY) {
locPropBase = "IMPORTED_OBJECTS";
} else {
locPropBase = "IMPORTED_LOCATION";
@@ -3450,7 +3449,7 @@ bool cmTarget::GetMappedConfigOld(std::string const& desired_config,
// If we needed to find one of the mapped configurations but did not
// There may be only IMPORTED_IMPLIB for a shared library or an executable
// with exports.
bool allowImp = (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
bool allowImp = (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports()) ||
(this->IsAIX() && this->IsExecutableWithExports()) ||
(this->GetMakefile()->PlatformSupportsAppleTextStubs() &&
@@ -3493,7 +3492,7 @@ bool cmTarget::GetMappedConfigOld(std::string const& desired_config,
if (!mappedConfigs.empty() && !loc && !imp) {
// Interface libraries are always available because their
// library name is optional so it is okay to leave loc empty.
return this->GetType() == cmStateEnums::INTERFACE_LIBRARY;
return this->GetType() == cm::TargetType::INTERFACE_LIBRARY;
}
// If we have not yet found it then there are no mapped
@@ -3543,7 +3542,7 @@ bool cmTarget::GetMappedConfigOld(std::string const& desired_config,
if (!loc && !imp) {
// Interface libraries are always available because their
// library name is optional so it is okay to leave loc empty.
return this->GetType() == cmStateEnums::INTERFACE_LIBRARY;
return this->GetType() == cm::TargetType::INTERFACE_LIBRARY;
}
return true;
@@ -3566,7 +3565,7 @@ bool cmTarget::GetLocation(std::string const& config, cmValue& loc,
// There may be only IMPORTED_IMPLIB for a shared library or an executable
// with exports.
bool const allowImp = (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
bool const allowImp = (this->GetType() == cm::TargetType::SHARED_LIBRARY ||
this->IsExecutableWithExports()) ||
(this->IsAIX() && this->IsExecutableWithExports()) ||
(this->GetMakefile()->PlatformSupportsAppleTextStubs() &&
@@ -3577,10 +3576,10 @@ bool cmTarget::GetLocation(std::string const& config, cmValue& loc,
}
switch (this->GetType()) {
case cmStateEnums::INTERFACE_LIBRARY:
case cm::TargetType::INTERFACE_LIBRARY:
loc = this->GetLocation("IMPORTED_LIBNAME", suffix);
break;
case cmStateEnums::OBJECT_LIBRARY:
case cm::TargetType::OBJECT_LIBRARY:
loc = this->GetLocation("IMPORTED_OBJECTS", suffix);
break;
default:
@@ -3588,7 +3587,7 @@ bool cmTarget::GetLocation(std::string const& config, cmValue& loc,
break;
}
return loc || imp || (this->GetType() == cmStateEnums::INTERFACE_LIBRARY);
return loc || imp || (this->GetType() == cm::TargetType::INTERFACE_LIBRARY);
}
bool cmTarget::GetMappedConfigNew(std::string desiredConfig, cmValue& loc,

Some files were not shown because too many files have changed in this diff Show More