summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx313
1 files changed, 192 insertions, 121 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index e8d66a2..ca056c0 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -15,10 +15,13 @@
#include "cmPropertyMap.h"
#include "cmSourceFile.h"
#include "cmSourceFileLocation.h"
+#include "cmState.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
#include "cmTargetLinkLibraryType.h"
+#include "cmTargetPropertyComputer.h"
#include "cm_auto_ptr.hxx"
+#include "cm_unordered_set.hxx"
#include "cmake.h"
#include <algorithm>
@@ -32,15 +35,27 @@
#include <stdlib.h>
#include <string.h>
-#if defined(CMake_HAVE_CXX_UNORDERED_SET)
-#include <unordered_set>
-#define UNORDERED_SET std::unordered_set
-#elif defined(CMAKE_BUILD_WITH_CMAKE)
-#include <cmsys/hash_set.hxx>
-#define UNORDERED_SET cmsys::hash_set
-#else
-#define UNORDERED_SET std::set
-#endif
+template <>
+const char* cmTargetPropertyComputer::GetSources<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, cmMessenger* /* messenger */,
+ cmListFileBacktrace const& /* context */)
+{
+ return tgt->GetSourcesProperty();
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocationForBuild<
+ cmGeneratorTarget>(cmGeneratorTarget const* tgt)
+{
+ return tgt->GetLocation("");
+}
+
+template <>
+const char* cmTargetPropertyComputer::ComputeLocation<cmGeneratorTarget>(
+ cmGeneratorTarget const* tgt, const std::string& config)
+{
+ return tgt->GetLocation(config);
+}
class cmGeneratorTarget::TargetPropertyEntry
{
@@ -192,7 +207,7 @@ struct TagVisitor
, Target(target)
, GlobalGenerator(target->GetLocalGenerator()->GetGlobalGenerator())
, Header(CM_HEADER_REGEX)
- , IsObjLib(target->GetType() == cmState::OBJECT_LIBRARY)
+ , IsObjLib(target->GetType() == cmStateEnums::OBJECT_LIBRARY)
{
}
@@ -207,7 +222,7 @@ struct TagVisitor
std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
if (sf->GetCustomCommand()) {
DoAccept<IsSameTag<Tag, CustomCommandsTag>::Result>::Do(this->Data, sf);
- } else if (this->Target->GetType() == cmState::UTILITY) {
+ } else if (this->Target->GetType() == cmStateEnums::UTILITY) {
DoAccept<IsSameTag<Tag, ExtraSourcesTag>::Result>::Do(this->Data, sf);
} else if (sf->GetPropertyAsBool("HEADER_FILE_ONLY")) {
DoAccept<IsSameTag<Tag, HeaderSourcesTag>::Result>::Do(this->Data, sf);
@@ -320,12 +335,32 @@ cmGeneratorTarget::~cmGeneratorTarget()
cmDeleteAll(this->LinkInformation);
}
+const char* cmGeneratorTarget::GetSourcesProperty() const
+{
+ std::vector<std::string> values;
+ for (std::vector<cmGeneratorTarget::TargetPropertyEntry *>::const_iterator
+ it = this->SourceEntries.begin(),
+ end = this->SourceEntries.end();
+ it != end; ++it) {
+ values.push_back((*it)->ge->GetInput());
+ }
+ static std::string value;
+ value.clear();
+ value = cmJoin(values, "");
+ return value.c_str();
+}
+
+cmGlobalGenerator* cmGeneratorTarget::GetGlobalGenerator() const
+{
+ return this->GetLocalGenerator()->GetGlobalGenerator();
+}
+
cmLocalGenerator* cmGeneratorTarget::GetLocalGenerator() const
{
return this->LocalGenerator;
}
-cmState::TargetType cmGeneratorTarget::GetType() const
+cmStateEnums::TargetType cmGeneratorTarget::GetType() const
{
return this->Target->GetType();
}
@@ -354,13 +389,25 @@ std::string cmGeneratorTarget::GetExportName() const
const char* cmGeneratorTarget::GetProperty(const std::string& prop) const
{
+ if (!cmTargetPropertyComputer::PassesWhitelist(
+ this->GetType(), prop, this->Makefile->GetMessenger(),
+ this->GetBacktrace())) {
+ return CM_NULLPTR;
+ }
+ if (const char* result = cmTargetPropertyComputer::GetProperty(
+ this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) {
+ return result;
+ }
+ if (cmSystemTools::GetFatalErrorOccured()) {
+ return CM_NULLPTR;
+ }
return this->Target->GetProperty(prop);
}
const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
{
switch (this->GetType()) {
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
if (this->IsDLLPlatform()) {
if (implib) {
// A DLL import library is treated as an archive target.
@@ -373,10 +420,10 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
// library targets.
return "LIBRARY";
}
- case cmState::STATIC_LIBRARY:
+ case cmStateEnums::STATIC_LIBRARY:
// Static libraries are always treated as archive targets.
return "ARCHIVE";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
if (implib) {
// Module libraries are always treated as library targets.
return "ARCHIVE";
@@ -384,7 +431,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
// Module import libraries are treated as archive targets.
return "LIBRARY";
}
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
if (implib) {
// Executable import libraries are treated as archive targets.
return "ARCHIVE";
@@ -790,7 +837,7 @@ const char* cmGeneratorTarget::GetLocationForBuild() const
bool cmGeneratorTarget::IsSystemIncludeDirectory(
const std::string& dir, const std::string& config) const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
std::string config_upper;
if (!config.empty()) {
config_upper = cmSystemTools::UpperCase(config);
@@ -870,7 +917,7 @@ static void AddInterfaceEntries(
static bool processSources(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& srcs, UNORDERED_SET<std::string>& uniqueSrcs,
+ std::vector<std::string>& srcs, CM_UNORDERED_SET<std::string>& uniqueSrcs,
cmGeneratorExpressionDAGChecker* dagChecker, std::string const& config,
bool debugSources)
{
@@ -951,7 +998,7 @@ static bool processSources(
void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
const std::string& config) const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
if (!this->LocalGenerator->GetGlobalGenerator()->GetConfigureDoneCMP0026()) {
// At configure-time, this method can be called as part of getting the
@@ -997,7 +1044,7 @@ void cmGeneratorTarget::GetSourceFiles(std::vector<std::string>& files,
cmGeneratorExpressionDAGChecker dagChecker(this->GetName(), "SOURCES",
CM_NULLPTR, CM_NULLPTR);
- UNORDERED_SET<std::string> uniqueSrcs;
+ CM_UNORDERED_SET<std::string> uniqueSrcs;
bool contextDependentDirectSources =
processSources(this, this->SourceEntries, files, uniqueSrcs, &dagChecker,
config, debugSources);
@@ -1096,7 +1143,7 @@ bool cmGeneratorTarget::HasSOName(const std::string& config) const
{
// soname is supported only for shared libraries and modules,
// and then only when the platform supports an soname flag.
- return ((this->GetType() == cmState::SHARED_LIBRARY) &&
+ return ((this->GetType() == cmStateEnums::SHARED_LIBRARY) &&
!this->GetPropertyAsBool("NO_SONAME") &&
this->Makefile->GetSONameFlag(this->GetLinkerLanguage(config)));
}
@@ -1106,9 +1153,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
{
// Only executables and shared libraries can have an rpath and may
// need relinking.
- if (this->GetType() != cmState::EXECUTABLE &&
- this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::EXECUTABLE &&
+ this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY) {
return false;
}
@@ -1180,9 +1227,9 @@ bool cmGeneratorTarget::NeedRelinkBeforeInstall(
bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
{
// Only certain target types have an rpath.
- if (!(this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::EXECUTABLE)) {
+ if (!(this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::EXECUTABLE)) {
return false;
}
@@ -1237,7 +1284,7 @@ bool cmGeneratorTarget::IsChrpathUsed(const std::string& config) const
bool cmGeneratorTarget::IsImportedSharedLibWithoutSOName(
const std::string& config) const
{
- if (this->IsImported() && this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->IsImported() && this->GetType() == cmStateEnums::SHARED_LIBRARY) {
if (cmGeneratorTarget::ImportInfo const* info =
this->GetImportInfo(config)) {
return info->NoSOName;
@@ -1253,7 +1300,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
bool macosx_rpath = false;
if (!this->IsImported()) {
- if (this->GetType() != cmState::SHARED_LIBRARY) {
+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY) {
return false;
}
const char* install_name = this->GetProperty("INSTALL_NAME_DIR");
@@ -1507,17 +1554,17 @@ const cmListFileBacktrace* cmGeneratorTarget::GetUtilityBacktrace(
bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
{
- return this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::EXECUTABLE;
+ return this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::EXECUTABLE;
}
const char* cmGeneratorTarget::GetExportMacro() const
{
// Define the symbol for targets that export symbols.
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
this->IsExecutableWithExports()) {
if (const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL")) {
this->ExportMacro = custom_export_name;
@@ -1536,7 +1583,7 @@ class cmTargetCollectLinkLanguages
public:
cmTargetCollectLinkLanguages(cmGeneratorTarget const* target,
const std::string& config,
- UNORDERED_SET<std::string>& languages,
+ CM_UNORDERED_SET<std::string>& languages,
cmGeneratorTarget const* head)
: Config(config)
, Languages(languages)
@@ -1603,7 +1650,7 @@ public:
private:
std::string Config;
- UNORDERED_SET<std::string>& Languages;
+ CM_UNORDERED_SET<std::string>& Languages;
cmGeneratorTarget const* HeadTarget;
const cmGeneratorTarget* Target;
std::set<cmGeneratorTarget const*> Visited;
@@ -1675,7 +1722,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
LinkClosure& lc) const
{
// Get languages built in this target.
- UNORDERED_SET<std::string> languages;
+ CM_UNORDERED_SET<std::string> languages;
cmLinkImplementation const* impl = this->GetLinkImplementation(config);
assert(impl);
for (std::vector<std::string>::const_iterator li = impl->Languages.begin();
@@ -1692,7 +1739,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Store the transitive closure of languages.
- for (UNORDERED_SET<std::string>::const_iterator li = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator li = languages.begin();
li != languages.end(); ++li) {
lc.Languages.push_back(*li);
}
@@ -1713,7 +1760,7 @@ void cmGeneratorTarget::ComputeLinkClosure(const std::string& config,
}
// Now consider languages that propagate from linked targets.
- for (UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
+ for (CM_UNORDERED_SET<std::string>::const_iterator sit = languages.begin();
sit != languages.end(); ++sit) {
std::string propagates =
"CMAKE_" + *sit + "_LINKER_PREFERENCE_PROPAGATES";
@@ -1767,6 +1814,22 @@ std::string cmGeneratorTarget::GetMacContentDirectory(
return fpath;
}
+std::string cmGeneratorTarget::GetEffectiveFolderName() const
+{
+ std::string effectiveFolder;
+
+ if (!this->GlobalGenerator->UseFolderProperty()) {
+ return effectiveFolder;
+ }
+
+ const char* targetFolder = this->GetProperty("FOLDER");
+ if (targetFolder) {
+ effectiveFolder += targetFolder;
+ }
+
+ return effectiveFolder;
+}
+
cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
const std::string& config) const
{
@@ -1775,7 +1838,7 @@ cmGeneratorTarget::CompileInfo const* cmGeneratorTarget::GetCompileInfo(
return CM_NULLPTR;
}
- if (this->GetType() > cmState::OBJECT_LIBRARY) {
+ if (this->GetType() > cmStateEnums::OBJECT_LIBRARY) {
std::string msg = "cmTarget::GetCompileInfo called for ";
msg += this->GetName();
msg += " which has type ";
@@ -1952,7 +2015,7 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target)
this->CurrentEntry = CM_NULLPTR;
// Queue all the source files already specified for the target.
- if (target->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
std::vector<std::string> configs;
this->Makefile->GetConfigurations(configs);
if (configs.empty()) {
@@ -2087,8 +2150,8 @@ bool cmTargetTraceDependencies::IsUtility(std::string const& dep)
// then make sure it was not a full path to something else, and
// the fact that the name matched a target was just a coincidence.
if (cmSystemTools::FileIsFullPath(dep.c_str())) {
- if (t->GetType() >= cmState::EXECUTABLE &&
- t->GetType() <= cmState::MODULE_LIBRARY) {
+ if (t->GetType() >= cmStateEnums::EXECUTABLE &&
+ t->GetType() <= cmStateEnums::MODULE_LIBRARY) {
// This is really only for compatibility so we do not need to
// worry about configuration names and output names.
std::string tLocation = t->GetLocationForBuild();
@@ -2128,7 +2191,7 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc)
// Check for a target with this name.
if (cmGeneratorTarget* t =
this->LocalGenerator->FindGeneratorTargetToUse(command)) {
- if (t->GetType() == cmState::EXECUTABLE) {
+ if (t->GetType() == cmStateEnums::EXECUTABLE) {
// The command refers to an executable target built in
// this project. Add the target-level dependency to make
// sure the executable is up to date before this custom
@@ -2202,7 +2265,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() == cmState::GLOBAL_TARGET) {
+ if (this->GetType() == cmStateEnums::GLOBAL_TARGET) {
return;
}
@@ -2241,7 +2304,7 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
std::string const& lang, std::string const& config) const
{
switch (this->GetType()) {
- case cmState::STATIC_LIBRARY: {
+ case cmStateEnums::STATIC_LIBRARY: {
std::string var = "CMAKE_" + lang + "_CREATE_STATIC_LIBRARY";
if (this->GetFeatureAsBool("INTERPROCEDURAL_OPTIMIZATION", config)) {
std::string varIPO = var + "_IPO";
@@ -2251,11 +2314,11 @@ std::string cmGeneratorTarget::GetCreateRuleVariable(
}
return var;
}
- case cmState::SHARED_LIBRARY:
+ case cmStateEnums::SHARED_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_LIBRARY";
- case cmState::MODULE_LIBRARY:
+ case cmStateEnums::MODULE_LIBRARY:
return "CMAKE_" + lang + "_CREATE_SHARED_MODULE";
- case cmState::EXECUTABLE:
+ case cmStateEnums::EXECUTABLE:
return "CMAKE_" + lang + "_LINK_EXECUTABLE";
default:
break;
@@ -2266,7 +2329,7 @@ static void processIncludeDirectories(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
std::vector<std::string>& includes,
- UNORDERED_SET<std::string>& uniqueIncludes,
+ CM_UNORDERED_SET<std::string>& uniqueIncludes,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugIncludes, const std::string& language)
{
@@ -2379,7 +2442,7 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
const std::string& config, const std::string& lang) const
{
std::vector<std::string> includes;
- UNORDERED_SET<std::string> uniqueIncludes;
+ CM_UNORDERED_SET<std::string> uniqueIncludes;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "INCLUDE_DIRECTORIES", CM_NULLPTR, CM_NULLPTR);
@@ -2456,7 +2519,8 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
static void processCompileOptionsInternal(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, const char* logName, std::string const& language)
{
@@ -2493,7 +2557,8 @@ static void processCompileOptionsInternal(
static void processCompileOptions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2506,7 +2571,7 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_OPTIONS", CM_NULLPTR, CM_NULLPTR);
@@ -2546,7 +2611,8 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string>& result,
static void processCompileFeatures(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions)
{
@@ -2558,7 +2624,7 @@ static void processCompileFeatures(
void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
const std::string& config) const
{
- UNORDERED_SET<std::string> uniqueFeatures;
+ CM_UNORDERED_SET<std::string> uniqueFeatures;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_FEATURES", CM_NULLPTR, CM_NULLPTR);
@@ -2595,7 +2661,8 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string>& result,
static void processCompileDefinitions(
cmGeneratorTarget const* tgt,
const std::vector<cmGeneratorTarget::TargetPropertyEntry*>& entries,
- std::vector<std::string>& options, UNORDERED_SET<std::string>& uniqueOptions,
+ std::vector<std::string>& options,
+ CM_UNORDERED_SET<std::string>& uniqueOptions,
cmGeneratorExpressionDAGChecker* dagChecker, const std::string& config,
bool debugOptions, std::string const& language)
{
@@ -2608,7 +2675,7 @@ void cmGeneratorTarget::GetCompileDefinitions(
std::vector<std::string>& list, const std::string& config,
const std::string& language) const
{
- UNORDERED_SET<std::string> uniqueOptions;
+ CM_UNORDERED_SET<std::string> uniqueOptions;
cmGeneratorExpressionDAGChecker dagChecker(
this->GetName(), "COMPILE_DEFINITIONS", CM_NULLPTR, CM_NULLPTR);
@@ -2682,11 +2749,11 @@ void cmGeneratorTarget::ComputeTargetManifest(const std::string& config) const
std::string realName;
std::string impName;
std::string pdbName;
- if (this->GetType() == cmState::EXECUTABLE) {
+ if (this->GetType() == cmStateEnums::EXECUTABLE) {
this->GetExecutableNames(name, realName, impName, pdbName, config);
- } else if (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
this->GetLibraryNames(name, soName, realName, impName, pdbName, config);
} else {
return;
@@ -2772,7 +2839,7 @@ std::string cmGeneratorTarget::NormalGetRealName(
this->LocalGenerator->IssueMessage(cmake::INTERNAL_ERROR, msg);
}
- if (this->GetType() == cmState::EXECUTABLE) {
+ if (this->GetType() == cmStateEnums::EXECUTABLE) {
// Compute the real name that will be built.
std::string name;
std::string realName;
@@ -2855,8 +2922,8 @@ void cmGeneratorTarget::GetLibraryNames(std::string& name, std::string& soName,
}
// The import library name.
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
impName = this->GetFullNameInternal(config, true);
} else {
impName = "";
@@ -2888,7 +2955,7 @@ void cmGeneratorTarget::GetExecutableNames(std::string& name,
#else
// Check for executable version properties.
const char* version = this->GetProperty("VERSION");
- if (this->GetType() != cmState::EXECUTABLE ||
+ if (this->GetType() != cmStateEnums::EXECUTABLE ||
this->Makefile->IsOn("XCODE")) {
version = CM_NULLPTR;
}
@@ -2957,10 +3024,10 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
std::string& outSuffix) const
{
// Use just the target name for non-main target types.
- if (this->GetType() != cmState::STATIC_LIBRARY &&
- this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY &&
- this->GetType() != cmState::EXECUTABLE) {
+ if (this->GetType() != cmStateEnums::STATIC_LIBRARY &&
+ this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GetType() != cmStateEnums::EXECUTABLE) {
outPrefix = "";
outBase = this->GetName();
outSuffix = "";
@@ -2979,9 +3046,9 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// The implib option is only allowed for shared libraries, module
// libraries, and executables.
- if (this->GetType() != cmState::SHARED_LIBRARY &&
- this->GetType() != cmState::MODULE_LIBRARY &&
- this->GetType() != cmState::EXECUTABLE) {
+ if (this->GetType() != cmStateEnums::SHARED_LIBRARY &&
+ this->GetType() != cmStateEnums::MODULE_LIBRARY &&
+ this->GetType() != cmStateEnums::EXECUTABLE) {
implib = false;
}
@@ -3059,7 +3126,7 @@ void cmGeneratorTarget::GetFullNameInternal(const std::string& config,
// Name shared libraries with their version number on some platforms.
if (const char* soversion = this->GetProperty("SOVERSION")) {
- if (this->GetType() == cmState::SHARED_LIBRARY && !implib &&
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY && !implib &&
this->Makefile->IsOn("CMAKE_SHARED_LIBRARY_NAME_WITH_VERSION")) {
outBase += "-";
outBase += soversion;
@@ -3225,8 +3292,8 @@ cmGeneratorTarget::GetCompatibleInterfaces(std::string const& config) const
bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsBool.count(p) > 0;
@@ -3235,8 +3302,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentBoolProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsString.count(p) > 0;
@@ -3245,8 +3312,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentStringProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMin.count(p) > 0;
@@ -3255,8 +3322,8 @@ bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMinProperty(
bool cmGeneratorTarget::IsLinkInterfaceDependentNumberMaxProperty(
const std::string& p, const std::string& config) const
{
- if (this->GetType() == cmState::OBJECT_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::OBJECT_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return false;
}
return this->GetCompatibleInterfaces(config).PropsNumberMax.count(p) > 0;
@@ -3850,7 +3917,7 @@ void cmGeneratorTarget::GetTargetVersion(bool soversion, int& major,
minor = 0;
patch = 0;
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
// Look for a VERSION or SOVERSION property.
const char* prop = soversion ? "SOVERSION" : "VERSION";
@@ -3922,7 +3989,7 @@ std::string cmGeneratorTarget::CreateFortranModuleDirectory(
std::string cmGeneratorTarget::GetFrameworkVersion() const
{
- assert(this->GetType() != cmState::INTERFACE_LIBRARY);
+ assert(this->GetType() != cmStateEnums::INTERFACE_LIBRARY);
if (const char* fversion = this->GetProperty("FRAMEWORK_VERSION")) {
return fversion;
@@ -3950,7 +4017,7 @@ void cmGeneratorTarget::ComputeVersionedName(std::string& vName,
std::vector<std::string> cmGeneratorTarget::GetPropertyKeys() const
{
- cmPropertyMap propsObject = this->Target->GetProperties();
+ cmPropertyMap const& propsObject = this->Target->GetProperties();
std::vector<std::string> props;
props.reserve(propsObject.size());
for (cmPropertyMap::const_iterator it = propsObject.begin();
@@ -4038,7 +4105,7 @@ cmLinkInterface const* cmGeneratorTarget::GetLinkInterface(
// Link interfaces are not supported for executables that do not
// export symbols.
- if (this->GetType() == cmState::EXECUTABLE &&
+ if (this->GetType() == cmStateEnums::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return CM_NULLPTR;
}
@@ -4072,18 +4139,18 @@ void cmGeneratorTarget::ComputeLinkInterface(
cmGeneratorTarget const* headTarget) const
{
if (iface.ExplicitLibraries) {
- if (this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
// Shared libraries may have runtime implementation dependencies
// on other shared libraries that are not in the interface.
- UNORDERED_SET<std::string> emitted;
+ CM_UNORDERED_SET<std::string> emitted;
for (std::vector<cmLinkItem>::const_iterator li =
iface.Libraries.begin();
li != iface.Libraries.end(); ++li) {
emitted.insert(*li);
}
- if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
cmLinkImplementation const* impl = this->GetLinkImplementation(config);
for (std::vector<cmLinkImplItem>::const_iterator li =
impl->Libraries.begin();
@@ -4091,7 +4158,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
if (emitted.insert(*li).second) {
if (li->Target) {
// This is a runtime dependency on another shared library.
- if (li->Target->GetType() == cmState::SHARED_LIBRARY) {
+ if (li->Target->GetType() == cmStateEnums::SHARED_LIBRARY) {
iface.SharedDeps.push_back(*li);
}
} else {
@@ -4121,7 +4188,7 @@ void cmGeneratorTarget::ComputeLinkInterface(
}
}
- if (this->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
// Construct the property name suffix for this configuration.
std::string suffix = "_";
if (!config.empty()) {
@@ -4154,7 +4221,7 @@ const cmLinkInterfaceLibraries* cmGeneratorTarget::GetLinkInterfaceLibraries(
// Link interfaces are not supported for executables that do not
// export symbols.
- if (this->GetType() == cmState::EXECUTABLE &&
+ if (this->GetType() == cmStateEnums::EXECUTABLE &&
!this->IsExecutableWithExports()) {
return CM_NULLPTR;
}
@@ -4301,12 +4368,12 @@ bool cmGeneratorTarget::ComputeOutputDir(const std::string& config,
if (out != outdir) {
conf = "";
}
- } else if (this->GetType() == cmState::EXECUTABLE) {
+ } else if (this->GetType() == cmStateEnums::EXECUTABLE) {
// Lookup the output path for executables.
out = this->Makefile->GetSafeDefinition("EXECUTABLE_OUTPUT_PATH");
- } else if (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY) {
+ } else if (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY) {
// Lookup the output path for libraries.
out = this->Makefile->GetSafeDefinition("LIBRARY_OUTPUT_PATH");
}
@@ -4415,7 +4482,7 @@ void cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
explicitLibraries = this->GetProperty(linkIfaceProp);
- } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+ } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
// shared lib or executable.
@@ -4460,8 +4527,9 @@ 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 (!explicitLibraries && (this->GetType() == cmState::EXECUTABLE ||
- (this->GetType() == cmState::MODULE_LIBRARY))) {
+ if (!explicitLibraries &&
+ (this->GetType() == cmStateEnums::EXECUTABLE ||
+ (this->GetType() == cmStateEnums::MODULE_LIBRARY))) {
return;
}
iface.Exists = true;
@@ -4590,7 +4658,7 @@ cmGeneratorTarget::ImportInfo const* cmGeneratorTarget::GetImportInfo(
i = this->ImportInfoMap.insert(entry).first;
}
- if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return &i->second;
}
// If the location is empty then the target is not available for
@@ -4625,7 +4693,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
std::string linkProp = "INTERFACE_LINK_LIBRARIES";
const char* propertyLibs = this->GetProperty(linkProp);
- if (this->GetType() != cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
if (!propertyLibs) {
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
linkProp += suffix;
@@ -4642,7 +4710,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
info.Libraries = propertyLibs;
}
}
- if (this->GetType() == cmState::INTERFACE_LIBRARY) {
+ if (this->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
return;
}
@@ -4663,7 +4731,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the soname.
- if (this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = "IMPORTED_SONAME";
soProp += suffix;
if (const char* config_soname = this->GetProperty(soProp)) {
@@ -4674,7 +4742,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the "no-soname" mark.
- if (this->GetType() == cmState::SHARED_LIBRARY) {
+ if (this->GetType() == cmStateEnums::SHARED_LIBRARY) {
std::string soProp = "IMPORTED_NO_SONAME";
soProp += suffix;
if (const char* config_no_soname = this->GetProperty(soProp)) {
@@ -4688,7 +4756,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
// Get the import library.
if (imp) {
info.ImportLibrary = imp;
- } else if (this->GetType() == cmState::SHARED_LIBRARY ||
+ } else if (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()) {
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
@@ -4724,7 +4792,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
}
// Get the cyclic repetition count.
- if (this->GetType() == cmState::STATIC_LIBRARY) {
+ if (this->GetType() == cmStateEnums::STATIC_LIBRARY) {
std::string linkProp = "IMPORTED_LINK_INTERFACE_MULTIPLICITY";
linkProp += suffix;
if (const char* config_reps = this->GetProperty(linkProp)) {
@@ -4965,6 +5033,9 @@ bool cmGeneratorTarget::HaveBuildTreeRPATH(const std::string& config) const
if (this->GetPropertyAsBool("SKIP_BUILD_RPATH")) {
return false;
}
+ if (this->GetProperty("BUILD_RPATH")) {
+ return true;
+ }
if (cmLinkImplementationLibraries const* impl =
this->GetLinkImplementationLibraries(config)) {
return !impl->Libraries.empty();
@@ -5117,12 +5188,12 @@ cmGeneratorTarget* cmGeneratorTarget::FindTargetToLink(
// 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 (tgt && tgt->GetType() == cmState::EXECUTABLE &&
+ if (tgt && tgt->GetType() == cmStateEnums::EXECUTABLE &&
!tgt->IsExecutableWithExports()) {
tgt = CM_NULLPTR;
}
- if (tgt && tgt->GetType() == cmState::OBJECT_LIBRARY) {
+ if (tgt && tgt->GetType() == cmStateEnums::OBJECT_LIBRARY) {
std::ostringstream e;
e << "Target \"" << this->GetName() << "\" links to "
"OBJECT library \""
@@ -5168,14 +5239,14 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
bool cmGeneratorTarget::IsExecutableWithExports() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->GetPropertyAsBool("ENABLE_EXPORTS"));
}
bool cmGeneratorTarget::HasImportLibrary() const
{
return (this->IsDLLPlatform() &&
- (this->GetType() == cmState::SHARED_LIBRARY ||
+ (this->GetType() == cmStateEnums::SHARED_LIBRARY ||
this->IsExecutableWithExports()));
}
@@ -5195,24 +5266,24 @@ std::string cmGeneratorTarget::GetSupportDirectory() const
bool cmGeneratorTarget::IsLinkable() const
{
- return (this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::UNKNOWN_LIBRARY ||
- this->GetType() == cmState::INTERFACE_LIBRARY ||
+ return (this->GetType() == cmStateEnums::STATIC_LIBRARY ||
+ this->GetType() == cmStateEnums::SHARED_LIBRARY ||
+ this->GetType() == cmStateEnums::MODULE_LIBRARY ||
+ this->GetType() == cmStateEnums::UNKNOWN_LIBRARY ||
+ this->GetType() == cmStateEnums::INTERFACE_LIBRARY ||
this->IsExecutableWithExports());
}
bool cmGeneratorTarget::IsFrameworkOnApple() const
{
- return (this->GetType() == cmState::SHARED_LIBRARY &&
+ return (this->GetType() == cmStateEnums::SHARED_LIBRARY &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("FRAMEWORK"));
}
bool cmGeneratorTarget::IsAppBundleOnApple() const
{
- return (this->GetType() == cmState::EXECUTABLE &&
+ return (this->GetType() == cmStateEnums::EXECUTABLE &&
this->Makefile->IsOn("APPLE") &&
this->GetPropertyAsBool("MACOSX_BUNDLE"));
}
@@ -5224,6 +5295,6 @@ bool cmGeneratorTarget::IsXCTestOnApple() const
bool cmGeneratorTarget::IsCFBundleOnApple() const
{
- return (this->GetType() == cmState::MODULE_LIBRARY &&
+ return (this->GetType() == cmStateEnums::MODULE_LIBRARY &&
this->Makefile->IsOn("APPLE") && this->GetPropertyAsBool("BUNDLE"));
}