summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-10-21 13:17:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-10-21 13:17:01 (GMT)
commit9206120e30d91389470aa0908965103dc301bbae (patch)
tree8e87d98a885f35995d212fb229eb98ba81388b8f /Source
parentd31d92bf1d8b13ddff2c85c1fd380519867b788c (diff)
parentc099e00fc0a9c47a2addaca145952b1c33195fab (diff)
downloadCMake-9206120e30d91389470aa0908965103dc301bbae.zip
CMake-9206120e30d91389470aa0908965103dc301bbae.tar.gz
CMake-9206120e30d91389470aa0908965103dc301bbae.tar.bz2
Merge topic 'use-generator-target'
c099e00f Access policy status from cmGeneratorTarget at generate time. d74bca5a cmGeneratorTarget: Copy the policy map from the cmTarget. c6e86955 cmTarget: Remove unused NameResolvesToFramework. 18046bd5 cmCommonTargetGenerator: Use NameResolvesToFramework without cmTarget. 91411641 Move ComputeLinkType out of cmTarget. 6d94078e cmGeneratorTarget: Move IsDLLPlatform from cmTarget. 3ebc6285 cmGeneratorTarget: Move HaveWellDefinedOutputFiles from cmTarget. 311018e5 cmGeneratorTarget: Move GetExportMacro from cmTarget. 215cd21a cmGeneratorTarget: Provide direct access to the backtrace. 1df8bd3a cmGlobalGenerator: Port IsRootOnlyTarget to cmGeneratorTarget. 83703bda cmGeneratorTarget: Copy IsExecutableWithExports from cmTarget.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCommonTargetGenerator.cxx5
-rw-r--r--Source/cmComputeLinkDepends.cxx4
-rw-r--r--Source/cmComputeLinkInformation.cxx22
-rw-r--r--Source/cmComputeTargetDepends.cxx8
-rw-r--r--Source/cmExportBuildFileGenerator.cxx6
-rw-r--r--Source/cmExportFileGenerator.cxx12
-rw-r--r--Source/cmExportInstallFileGenerator.cxx4
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx2
-rw-r--r--Source/cmGeneratorExpressionNode.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx136
-rw-r--r--Source/cmGeneratorTarget.h26
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx6
-rw-r--r--Source/cmGlobalGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLinkItem.h24
-rw-r--r--Source/cmLocalGenerator.cxx12
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx4
-rw-r--r--Source/cmOSXBundleGenerator.cxx2
-rw-r--r--Source/cmOrderDirectories.cxx4
-rw-r--r--Source/cmPolicies.h17
-rw-r--r--Source/cmTarget.cxx68
-rw-r--r--Source/cmTarget.h33
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
26 files changed, 221 insertions, 189 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 41af89b..6920faf 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -265,7 +265,7 @@ std::string cmCommonTargetGenerator::GetFrameworkFlags(std::string const& l)
for(std::vector<std::string>::iterator i = includes.begin();
i != includes.end(); ++i)
{
- if(this->Target->NameResolvesToFramework(*i))
+ if(this->GlobalGenerator->NameResolvesToFramework(*i))
{
std::string frameworkDir = *i;
frameworkDir += "/../";
@@ -349,7 +349,8 @@ std::string cmCommonTargetGenerator::GetDefines(const std::string &l)
std::set<std::string> defines;
const char *lang = l.c_str();
// Add the export symbol definition for shared library objects.
- if(const char* exportMacro = this->Target->GetExportMacro())
+ if(const char* exportMacro =
+ this->GeneratorTarget->GetExportMacro())
{
this->LocalGenerator->AppendDefines(defines, exportMacro);
}
diff --git a/Source/cmComputeLinkDepends.cxx b/Source/cmComputeLinkDepends.cxx
index 465db92..13098ad 100644
--- a/Source/cmComputeLinkDepends.cxx
+++ b/Source/cmComputeLinkDepends.cxx
@@ -185,7 +185,9 @@ cmComputeLinkDepends
// The configuration being linked.
this->HasConfig = !config.empty();
this->Config = (this->HasConfig)? config : std::string();
- this->LinkType = this->Target->Target->ComputeLinkType(this->Config);
+ std::vector<std::string> debugConfigs =
+ this->Makefile->GetCMakeInstance()->GetDebugConfigs();
+ this->LinkType = CMP0003_ComputeLinkType(this->Config, debugConfigs);
// Enable debug mode if requested.
this->DebugMode = this->Makefile->IsOn("CMAKE_LINK_DEPENDS_DEBUG_MODE");
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 2497f82..a32bb48 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -407,7 +407,7 @@ cmComputeLinkInformation
// order to support such projects we need to add the directories
// containing libraries linked with a full path to the -L path.
this->OldLinkDirMode =
- this->Target->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
+ this->Target->GetPolicyStatusCMP0003() != cmPolicies::NEW;
if(this->OldLinkDirMode)
{
// Construct a mask to not bother with this behavior for link
@@ -571,7 +571,7 @@ bool cmComputeLinkInformation::Compute()
"name."
;
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
return true;
@@ -635,7 +635,7 @@ void cmComputeLinkInformation::AddItem(std::string const& item,
{
// Compute the proper name to use to link this library.
const std::string& config = this->Config;
- bool impexe = (tgt && tgt->Target->IsExecutableWithExports());
+ bool impexe = (tgt && tgt->IsExecutableWithExports());
if(impexe && !this->UseImportLibrary && !this->LoaderFlag)
{
// Skip linking to executables on platforms with no import
@@ -1140,7 +1140,7 @@ void cmComputeLinkInformation::AddFullItem(std::string const& item)
// Full path libraries should specify a valid library file name.
// See documentation of CMP0008.
std::string generator = this->GlobalGenerator->GetName();
- if(this->Target->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
+ if(this->Target->GetPolicyStatusCMP0008() != cmPolicies::NEW &&
(generator.find("Visual Studio") != generator.npos ||
generator.find("Xcode") != generator.npos))
{
@@ -1221,7 +1221,7 @@ bool cmComputeLinkInformation::CheckImplicitDirItem(std::string const& item)
}
// Check the policy for whether we should use the approach below.
- switch (this->Target->Target->GetPolicyStatusCMP0060())
+ switch (this->Target->GetPolicyStatusCMP0060())
{
case cmPolicies::WARN:
if (this->CMP0060Warn)
@@ -1531,7 +1531,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
this->OrderLinkerSearchPath->AddLinkLibrary(item);
// Produce any needed message.
- switch(this->Target->Target->GetPolicyStatusCMP0008())
+ switch(this->Target->GetPolicyStatusCMP0008())
{
case cmPolicies::WARN:
{
@@ -1548,7 +1548,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
}
case cmPolicies::OLD:
@@ -1566,7 +1566,7 @@ void cmComputeLinkInformation::HandleBadFullItem(std::string const& item,
<< " " << item << "\n"
<< "which is a full-path but not a valid library file name.";
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
break;
}
@@ -1583,7 +1583,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
}
// Enforce policy constraints.
- switch(this->Target->Target->GetPolicyStatusCMP0003())
+ switch(this->Target->GetPolicyStatusCMP0003())
{
case cmPolicies::WARN:
if(!this->CMakeInstance->GetState()
@@ -1594,7 +1594,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
std::ostringstream w;
this->PrintLinkPolicyDiagnosis(w);
this->CMakeInstance->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
case cmPolicies::OLD:
// OLD behavior is to add the paths containing libraries with
@@ -1610,7 +1610,7 @@ bool cmComputeLinkInformation::FinishLinkerSearchDirectories()
e << cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0003) << "\n";
this->PrintLinkPolicyDiagnosis(e);
this->CMakeInstance->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
return false;
}
}
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index a5a1f29..03f4fdd 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -245,7 +245,7 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
->IssueMessage(cmake::FATAL_ERROR,
"Only executables and non-OBJECT libraries may "
"reference target objects.",
- depender->Target->GetBacktrace());
+ depender->GetBacktrace());
return;
}
const_cast<cmGeneratorTarget*>(depender)->Target->AddUtility(objLib);
@@ -325,7 +325,7 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
// within the project.
if(dependee &&
dependee->GetType() == cmState::EXECUTABLE &&
- !dependee->Target->IsExecutableWithExports())
+ !dependee->IsExecutableWithExports())
{
dependee = 0;
}
@@ -362,7 +362,7 @@ void cmComputeTargetDepends::AddTargetDepend(
cmake::MessageType messageType = cmake::AUTHOR_WARNING;
bool issueMessage = false;
std::ostringstream e;
- switch(depender->Target->GetPolicyStatusCMP0046())
+ switch(depender->GetPolicyStatusCMP0046())
{
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0046) << "\n";
@@ -401,7 +401,7 @@ void cmComputeTargetDepends::AddTargetDepend(
// within the project.
if(linking && dependee &&
dependee->GetType() == cmState::EXECUTABLE &&
- !dependee->Target->IsExecutableWithExports())
+ !dependee->IsExecutableWithExports())
{
dependee = 0;
}
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 3af7b71..23c11d7 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -107,8 +107,8 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
gte, properties);
const bool newCMP0022Behavior =
- gte->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
- && gte->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ gte->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && gte->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior)
{
this->PopulateInterfaceLinkLibrariesProperty(gte,
@@ -220,7 +220,7 @@ cmExportBuildFileGenerator
// Add the import library for windows DLLs.
if(dll_platform &&
(target->GetType() == cmState::SHARED_LIBRARY ||
- target->Target->IsExecutableWithExports()) &&
+ target->IsExecutableWithExports()) &&
mf->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
{
std::string prop = "IMPORTED_IMPLIB";
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5177ec8..1a84625 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -270,7 +270,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{
if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
{
- switch (target->Target->GetPolicyStatusCMP0041())
+ switch (target->GetPolicyStatusCMP0041())
{
case cmPolicies::WARN:
messageType = cmake::WARNING;
@@ -317,7 +317,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
{
if (!shouldContinue)
{
- switch(target->Target->GetPolicyStatusCMP0052())
+ switch(target->GetPolicyStatusCMP0052())
{
case cmPolicies::WARN:
{
@@ -830,10 +830,8 @@ cmExportFileGenerator
}
const bool newCMP0022Behavior =
- target->Target
- ->GetPolicyStatusCMP0022() != cmPolicies::WARN
- && target->Target
- ->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ target->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if(newCMP0022Behavior && !this->ExportOld)
{
@@ -1075,7 +1073,7 @@ cmExportFileGenerator
}
// Mark the imported executable if it has exports.
- if(target->Target->IsExecutableWithExports())
+ if(target->IsExecutableWithExports())
{
os << "set_property(TARGET " << targetName
<< " PROPERTY ENABLE_EXPORTS 1)\n";
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index a2d6ad1..b695904 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -169,8 +169,8 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
properties, missingTargets);
const bool newCMP0022Behavior =
- gt->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
- && gt->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ gt->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && gt->GetPolicyStatusCMP0022() != cmPolicies::OLD;
if (newCMP0022Behavior)
{
if (this->PopulateInterfaceLinkLibrariesProperty(gt,
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index a6b14ba..ac0202b 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -427,7 +427,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg,
const std::string& config = makefile->GetSafeDefinition("CMAKE_BUILD_TYPE");
// Add the export symbol definition for shared library objects.
- if(const char* exportMacro = target->Target->GetExportMacro())
+ if(const char* exportMacro = target->GetExportMacro())
{
lg->AppendDefines(defines, exportMacro);
}
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 1a878e2..7a7e4ff 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -1579,7 +1579,7 @@ struct TargetFilesystemArtifactResultCreator<ArtifactSonameTag>
const GeneratorExpressionContent *content)
{
// The target soname file (.so.1).
- if(target->Target->IsDLLPlatform())
+ if(target->IsDLLPlatform())
{
::reportError(context, content->GetOriginalExpression(),
"TARGET_SONAME_FILE is not allowed "
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b2959fe..713ab6a 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -62,7 +62,7 @@ void reportBadObjLib(std::vector<cmSourceFile*> const& badObjLib,
e << "but may contain only sources that compile, header files, and "
"other files that would not affect linking of a normal library.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- target->Target->GetBacktrace());
+ target->GetBacktrace());
}
}
@@ -304,6 +304,12 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
t->GetSourceEntries(),
t->GetSourceBacktraces(),
this->SourceEntries, true);
+
+ this->DLLPlatform = (this->Makefile->IsOn("WIN32") ||
+ this->Makefile->IsOn("CYGWIN") ||
+ this->Makefile->IsOn("MINGW"));
+
+ this->PolicyMap = t->PolicyMap;
}
cmGeneratorTarget::~cmGeneratorTarget()
@@ -366,7 +372,7 @@ const char* cmGeneratorTarget::GetOutputTargetType(bool implib) const
switch(this->GetType())
{
case cmState::SHARED_LIBRARY:
- if(this->Target->IsDLLPlatform())
+ if(this->IsDLLPlatform())
{
if(implib)
{
@@ -483,7 +489,7 @@ std::string cmGeneratorTarget::GetOutputName(const std::string& config,
->IssueMessage(
cmake::FATAL_ERROR,
"Target '" + this->GetName() + "' OUTPUT_NAME depends on itself.",
- this->Target->GetBacktrace());
+ this->GetBacktrace());
}
return i->second;
}
@@ -1007,7 +1013,7 @@ static bool processSources(cmGeneratorTarget const* tgt,
{
cmake* cm = tgt->GetLocalGenerator()->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e,
- tgt->Target->GetBacktrace());
+ tgt->GetBacktrace());
}
return contextDependent;
}
@@ -1471,7 +1477,7 @@ bool cmGeneratorTarget::HasMacOSXRpathInstallNameDir(
w << " corrupt.";
cmake* cm = this->LocalGenerator->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, w.str(),
- this->Target->GetBacktrace());
+ this->GetBacktrace());
}
return true;
@@ -1492,7 +1498,7 @@ bool cmGeneratorTarget::MacOSXRpathInstallNameDirDefault() const
return this->GetPropertyAsBool("MACOSX_RPATH");
}
- cmPolicies::PolicyStatus cmp0042 = this->Target->GetPolicyStatusCMP0042();
+ cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042();
if(cmp0042 == cmPolicies::WARN)
{
@@ -1703,6 +1709,47 @@ std::string cmGeneratorTarget::GetInstallNameDirForInstallTree() const
}
}
+cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const
+{
+ return this->Target->GetBacktrace();
+}
+
+//----------------------------------------------------------------------------
+bool cmGeneratorTarget::HaveWellDefinedOutputFiles() const
+{
+ return
+ this->GetType() == cmState::STATIC_LIBRARY ||
+ this->GetType() == cmState::SHARED_LIBRARY ||
+ this->GetType() == cmState::MODULE_LIBRARY ||
+ this->GetType() == cmState::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 ||
+ this->IsExecutableWithExports())
+ {
+ if(const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL"))
+ {
+ this->ExportMacro = custom_export_name;
+ }
+ else
+ {
+ std::string in = this->GetName();
+ in += "_EXPORTS";
+ this->ExportMacro = cmSystemTools::MakeCidentifier(in);
+ }
+ return this->ExportMacro.c_str();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
//----------------------------------------------------------------------------
class cmTargetCollectLinkLanguages
{
@@ -1749,7 +1796,7 @@ public:
"call is missing for an IMPORTED target, or an ALIAS target is "
"missing?";
this->Target->GetLocalGenerator()->GetCMakeInstance()->IssueMessage(
- messageType, e.str(), this->Target->Target->GetBacktrace());
+ messageType, e.str(), this->Target->GetBacktrace());
}
}
return;
@@ -1846,7 +1893,7 @@ public:
e << "Set the LINKER_LANGUAGE property for this target.";
cmake* cm = this->Target->GetLocalGenerator()->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
return *this->Preferred.begin();
}
@@ -2017,6 +2064,11 @@ cmGeneratorTarget::GetModuleDefinitionFile(const std::string& config) const
return data;
}
+bool cmGeneratorTarget::IsDLLPlatform() const
+{
+ return this->DLLPlatform;
+}
+
//----------------------------------------------------------------------------
void
cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs,
@@ -2583,7 +2635,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
cmake::MessageType messageType = cmake::FATAL_ERROR;
if (checkCMP0027)
{
- switch(tgt->Target->GetPolicyStatusCMP0027())
+ switch(tgt->GetPolicyStatusCMP0027())
{
case cmPolicies::WARN:
e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0027) << "\n";
@@ -2622,7 +2674,7 @@ static void processIncludeDirectories(cmGeneratorTarget const* tgt,
}
else
{
- switch(tgt->Target->GetPolicyStatusCMP0021())
+ switch(tgt->GetPolicyStatusCMP0021())
{
case cmPolicies::WARN:
{
@@ -4571,7 +4623,7 @@ cmGeneratorTarget::GetLinkInterface(const std::string& config,
// Link interfaces are not supported for executables that do not
// export symbols.
if(this->GetType() == cmState::EXECUTABLE &&
- !this->Target->IsExecutableWithExports())
+ !this->IsExecutableWithExports())
{
return 0;
}
@@ -4654,8 +4706,8 @@ void cmGeneratorTarget::ComputeLinkInterface(const std::string& config,
}
}
}
- else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
{
// The link implementation is the default link interface.
cmLinkImplementationLibraries const*
@@ -4720,7 +4772,7 @@ cmGeneratorTarget::GetLinkInterfaceLibraries(const std::string& config,
// Link interfaces are not supported for executables that do not
// export symbols.
if(this->GetType() == cmState::EXECUTABLE &&
- !this->Target->IsExecutableWithExports())
+ !this->IsExecutableWithExports())
{
return 0;
}
@@ -4788,7 +4840,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
}
// Only libraries and executables have well-defined output files.
- if(!this->Target->HaveWellDefinedOutputFiles())
+ if(!this->HaveWellDefinedOutputFiles())
{
std::string msg = "cmGeneratorTarget::GetOutputInfo called for ";
msg += this->GetName();
@@ -4831,7 +4883,7 @@ cmGeneratorTarget::OutputInfo const* cmGeneratorTarget::GetOutputInfo(
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
cmake::FATAL_ERROR,
"Target '" + this->GetName() + "' OUTPUT_DIRECTORY depends on itself.",
- this->Target->GetBacktrace());
+ this->GetBacktrace());
return 0;
}
return &i->second;
@@ -5023,15 +5075,15 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
// libraries and executables that export symbols.
const char* explicitLibraries = 0;
std::string linkIfaceProp;
- if(this->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
- this->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN)
+ if(this->GetPolicyStatusCMP0022() != cmPolicies::OLD &&
+ this->GetPolicyStatusCMP0022() != cmPolicies::WARN)
{
// CMP0022 NEW behavior is to use INTERFACE_LINK_LIBRARIES.
linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
explicitLibraries = this->GetProperty(linkIfaceProp);
}
else if(this->GetType() == cmState::SHARED_LIBRARY ||
- this->Target->IsExecutableWithExports())
+ this->IsExecutableWithExports())
{
// CMP0022 OLD behavior is to use LINK_INTERFACE_LIBRARIES if set on a
// shared lib or executable.
@@ -5050,7 +5102,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
}
if(explicitLibraries &&
- this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
+ this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022)
{
// Compare the explicitly set old link interface properties to the
@@ -5095,8 +5147,8 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
iface.Libraries,
iface.HadHeadSensitiveCondition);
}
- else if (this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN
- || this->Target->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
// If CMP0022 is NEW then the plain tll signature sets the
// INTERFACE_LINK_LIBRARIES, so if we get here then the project
// cleared the property explicitly and we should not fall back
@@ -5107,7 +5159,7 @@ cmGeneratorTarget::ComputeLinkInterfaceLibraries(
this->GetLinkImplementationLibrariesInternal(config, headTarget);
iface.Libraries.insert(iface.Libraries.end(),
impl->Libraries.begin(), impl->Libraries.end());
- if(this->Target->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
+ if(this->GetPolicyStatusCMP0022() == cmPolicies::WARN &&
!this->PolicyWarnedCMP0022 && !usage_requirements_only)
{
// Compare the link implementation fallback link interface to the
@@ -5350,7 +5402,7 @@ void cmGeneratorTarget::ComputeImportInfo(std::string const& desired_config,
info.ImportLibrary = imp;
}
else if(this->GetType() == cmState::SHARED_LIBRARY ||
- this->Target->IsExecutableWithExports())
+ this->IsExecutableWithExports())
{
std::string impProp = "IMPORTED_IMPLIB";
impProp += suffix;
@@ -5569,7 +5621,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
if(lib != item)
{
cmake* cm = this->LocalGenerator->GetCMakeInstance();
- switch(this->Target->GetPolicyStatusCMP0004())
+ switch(this->GetPolicyStatusCMP0004())
{
case cmPolicies::WARN:
{
@@ -5578,7 +5630,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- this->Target->GetBacktrace());
+ this->GetBacktrace());
}
case cmPolicies::OLD:
break;
@@ -5589,7 +5641,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
<< item << "\" which has leading or trailing whitespace. "
<< "This is now an error according to policy CMP0004.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
+ this->GetBacktrace());
}
break;
case cmPolicies::REQUIRED_IF_USED:
@@ -5600,7 +5652,7 @@ std::string cmGeneratorTarget::CheckCMP0004(std::string const& item) const
<< "Target \"" << this->GetName() << "\" links to item \""
<< item << "\" which has leading or trailing whitespace.";
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
+ this->GetBacktrace());
}
break;
}
@@ -5777,7 +5829,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
bool noMessage = false;
cmake::MessageType messageType = cmake::FATAL_ERROR;
std::ostringstream e;
- switch(this->Target->GetPolicyStatusCMP0038())
+ switch(this->GetPolicyStatusCMP0038())
{
case cmPolicies::WARN:
{
@@ -5798,7 +5850,7 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
{
e << "Target \"" << this->GetName() << "\" links to itself.";
this->LocalGenerator->GetCMakeInstance()->IssueMessage(
- messageType, e.str(), this->Target->GetBacktrace());
+ messageType, e.str(), this->GetBacktrace());
if (messageType == cmake::FATAL_ERROR)
{
return;
@@ -5827,7 +5879,12 @@ void cmGeneratorTarget::ComputeLinkImplementationLibraries(
this->MaxLanguageStandards);
}
- cmTargetLinkLibraryType linkType = this->Target->ComputeLinkType(config);
+ // Get the list of configurations considered to be DEBUG.
+ std::vector<std::string> debugConfigs =
+ this->Makefile->GetCMakeInstance()->GetDebugConfigs();
+
+ cmTargetLinkLibraryType linkType =
+ CMP0003_ComputeLinkType(config, debugConfigs);
cmTarget::LinkLibraryVectorType const& oldllibs =
this->Target->GetOriginalLinkLibraries();
for(cmTarget::LinkLibraryVectorType::const_iterator li = oldllibs.begin();
@@ -5858,7 +5915,7 @@ cmGeneratorTarget::FindTargetToLink(std::string const& name) const
// name conflict between an external library and an executable
// within the project.
if(tgt && tgt->GetType() == cmState::EXECUTABLE &&
- !tgt->Target->IsExecutableWithExports())
+ !tgt->IsExecutableWithExports())
{
tgt = 0;
}
@@ -5873,7 +5930,7 @@ cmGeneratorTarget::FindTargetToLink(std::string const& name) const
"with the ENABLE_EXPORTS property set.";
cmake* cm = this->LocalGenerator->GetCMakeInstance();
cm->IssueMessage(cmake::FATAL_ERROR, e.str(),
- this->Target->GetBacktrace());
+ this->GetBacktrace());
tgt = 0;
}
@@ -5914,11 +5971,18 @@ bool cmGeneratorTarget::GetImplibGNUtoMS(std::string const& gnuName,
}
//----------------------------------------------------------------------------
+bool cmGeneratorTarget::IsExecutableWithExports() const
+{
+ return (this->GetType() == cmState::EXECUTABLE &&
+ this->GetPropertyAsBool("ENABLE_EXPORTS"));
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorTarget::HasImportLibrary() const
{
- return (this->Target->IsDLLPlatform() &&
+ return (this->IsDLLPlatform() &&
(this->GetType() == cmState::SHARED_LIBRARY ||
- this->Target->IsExecutableWithExports()));
+ this->IsExecutableWithExports()));
}
//----------------------------------------------------------------------------
@@ -5944,7 +6008,7 @@ bool cmGeneratorTarget::IsLinkable() const
this->GetType() == cmState::MODULE_LIBRARY ||
this->GetType() == cmState::UNKNOWN_LIBRARY ||
this->GetType() == cmState::INTERFACE_LIBRARY ||
- this->Target->IsExecutableWithExports());
+ this->IsExecutableWithExports());
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 6537421..2dc3a6f 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -33,6 +33,14 @@ public:
bool IsImported() const;
const char *GetLocation(const std::string& config) const;
+#define DECLARE_TARGET_POLICY(POLICY) \
+ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
+ { return this->PolicyMap.Get(cmPolicies::POLICY); }
+
+ CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
+
+#undef DECLARE_TARGET_POLICY
+
/** Get the location of the target in the build tree with a placeholder
referencing the configuration in the native build system. This
location is suitable for use as the LOCATION target property. */
@@ -166,6 +174,12 @@ public:
* install tree. For example: "\@rpath/" or "\@loader_path/". */
std::string GetInstallNameDirForInstallTree() const;
+ cmListFileBacktrace GetBacktrace() const;
+
+ /** Get the macro to define when building sources in this target.
+ If no macro should be defined null is returned. */
+ const char* GetExportMacro() const;
+
/** Get the soname of the target. Allowed only for a shared library. */
std::string GetSOName(const std::string& config) const;
@@ -190,6 +204,12 @@ public:
std::string GetModuleDefinitionFile(const std::string& config) const;
+ /** Return whether or not the target is for a DLL platform. */
+ bool IsDLLPlatform() const;
+
+ /** @return whether this target have a well defined output file name. */
+ bool HaveWellDefinedOutputFiles() const;
+
/** Link information from the transitive closure of the link
implementation and the interfaces of its dependencies. */
struct LinkClosure
@@ -406,6 +426,8 @@ public:
bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out,
const char* newExt = 0) const;
+ bool IsExecutableWithExports() const;
+
/** Return whether or not the target has a DLL import library. */
bool HasImportLibrary() const;
@@ -483,6 +505,8 @@ private:
std::set<cmSourceFile const*> ExplicitObjectName;
mutable std::map<std::string, std::vector<std::string> > SystemIncludesCache;
+ mutable std::string ExportMacro;
+
void ConstructSourceFileFlags() const;
mutable bool SourceFileFlagsConstructed;
mutable std::map<cmSourceFile const*, SourceFileFlags> SourceFlagsMap;
@@ -625,6 +649,7 @@ private:
typedef std::map<OutputNameKey, std::string> OutputNameMapType;
mutable OutputNameMapType OutputNameMap;
mutable std::set<cmLinkItem> UtilityItems;
+ cmPolicies::PolicyMap PolicyMap;
mutable bool PolicyWarnedCMP0022;
mutable bool DebugIncludesDone;
mutable bool DebugCompileOptionsDone;
@@ -633,6 +658,7 @@ private:
mutable bool DebugSourcesDone;
mutable bool LinkImplementationLanguageIsContextDependent;
mutable bool UtilityItemsDone;
+ bool DLLPlatform;
bool ComputePDBOutputDir(const std::string& kind, const std::string& config,
std::string& out) const;
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx
index 019cdd1..01e6f8c 100644
--- a/Source/cmGhsMultiTargetGenerator.cxx
+++ b/Source/cmGhsMultiTargetGenerator.cxx
@@ -297,7 +297,7 @@ std::string cmGhsMultiTargetGenerator::GetDefines(const std::string &language,
std::set<std::string> defines;
const char *lang = language.c_str();
// Add the export symbol definition for shared library objects.
- if (const char *exportMacro = this->Target->GetExportMacro())
+ if (const char *exportMacro = this->GeneratorTarget->GetExportMacro())
{
this->LocalGenerator->AppendDefines(defines, exportMacro);
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index a55365f..086ff25 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2701,13 +2701,13 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
for (cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
cmTarget* target = &l->second;
- if(this->IsRootOnlyTarget(target) &&
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
+ if(this->IsRootOnlyTarget(gt) &&
target->GetMakefile() != root->GetMakefile())
{
continue;
}
// put the target in the set of original targets
- cmGeneratorTarget* gt = this->GetGeneratorTarget(target);
originalTargets.insert(gt);
// Get the set of targets that depend on target
this->AddTargetDepends(gt, projectTargets);
@@ -2716,7 +2716,7 @@ void cmGlobalGenerator::GetTargetSets(TargetDependSet& projectTargets,
}
//----------------------------------------------------------------------------
-bool cmGlobalGenerator::IsRootOnlyTarget(cmTarget* target) const
+bool cmGlobalGenerator::IsRootOnlyTarget(cmGeneratorTarget* target) const
{
return (target->GetType() == cmState::GLOBAL_TARGET ||
target->GetName() == this->GetAllTargetName());
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 4e6b11d..c59d42d 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -376,7 +376,7 @@ protected:
void GetTargetSets(TargetDependSet& projectTargets,
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
- bool IsRootOnlyTarget(cmTarget* target) const;
+ bool IsRootOnlyTarget(cmGeneratorTarget* target) const;
void AddTargetDepends(const cmGeneratorTarget* target,
TargetDependSet& projectTargets);
void SetLanguageEnabledFlag(const std::string& l, cmMakefile* mf);
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 3838ebc..df208f6 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1850,7 +1850,7 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs,
"CMAKE_INTDIR=\"$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)\"");
}
- if(const char* exportMacro = target.GetExportMacro())
+ if(const char* exportMacro = gtgt->GetExportMacro())
{
// Add the export symbol definition for shared library objects.
this->AppendDefines(ppDefs, exportMacro);
diff --git a/Source/cmLinkItem.h b/Source/cmLinkItem.h
index b875cc0..b603bcc 100644
--- a/Source/cmLinkItem.h
+++ b/Source/cmLinkItem.h
@@ -14,6 +14,7 @@
#define cmLinkItem_h
#include "cmListFileCache.h"
+#include "cmSystemTools.h"
class cmGeneratorTarget;
@@ -118,4 +119,27 @@ struct cmOptionalLinkImplementation: public cmLinkImplementation
bool HadHeadSensitiveCondition;
};
+/** Compute the link type to use for the given configuration. */
+inline cmTargetLinkLibraryType
+CMP0003_ComputeLinkType(const std::string& config,
+ std::vector<std::string> const& debugConfigs)
+{
+ // No configuration is always optimized.
+ if(config.empty())
+ {
+ return OPTIMIZED_LibraryType;
+ }
+
+ // Check if any entry in the list matches this configuration.
+ std::string configUpper = cmSystemTools::UpperCase(config);
+ if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
+ debugConfigs.end())
+ {
+ return DEBUG_LibraryType;
+ }
+ // The current configuration is not a debug configuration.
+ return OPTIMIZED_LibraryType;
+}
+
+
#endif
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 833ffbf..8a76c21 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1438,7 +1438,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE");
linkFlags += " ";
}
- if (target->Target->IsExecutableWithExports())
+ if (target->IsExecutableWithExports())
{
std::string exportFlagVar = "CMAKE_EXE_EXPORTS_";
exportFlagVar += linkLanguage;
@@ -1545,7 +1545,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries,
GetGlobalPropertyAsBool("TARGET_SUPPORTS_SHARED_LIBS"))
{
bool add_shlib_flags = false;
- switch(tgt.Target->GetPolicyStatusCMP0065())
+ switch(tgt.GetPolicyStatusCMP0065())
{
case cmPolicies::WARN:
if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") &&
@@ -1976,7 +1976,7 @@ AddCompilerRequirementFlag(std::string &flags,
std::string e =
lang + "_STANDARD is set to invalid value '" + standard + "'";
this->GetGlobalGenerator()->GetCMakeInstance()
- ->IssueMessage(cmake::FATAL_ERROR, e, target->Target->GetBacktrace());
+ ->IssueMessage(cmake::FATAL_ERROR, e, target->GetBacktrace());
return;
}
@@ -2100,9 +2100,9 @@ void cmLocalGenerator
std::string *pWarnCMP0063 = 0;
if (target->GetType() != cmState::SHARED_LIBRARY &&
target->GetType() != cmState::MODULE_LIBRARY &&
- !target->Target->IsExecutableWithExports())
+ !target->IsExecutableWithExports())
{
- switch (target->Target->GetPolicyStatusCMP0063())
+ switch (target->GetPolicyStatusCMP0063())
{
case cmPolicies::OLD:
return;
@@ -2135,7 +2135,7 @@ void cmLocalGenerator
"For compatibility CMake is not honoring them for this target.";
target->Target->GetMakefile()->GetCMakeInstance()
->IssueMessage(cmake::AUTHOR_WARNING, w.str(),
- target->Target->GetBacktrace());
+ target->GetBacktrace());
}
}
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index f40e6dd..a51eb67 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1543,7 +1543,7 @@ void cmLocalVisualStudio6Generator
// Add the export symbol definition for shared library objects.
std::string exportSymbol;
- if(const char* exportMacro = target.GetExportMacro())
+ if(const char* exportMacro = gt->GetExportMacro())
{
exportSymbol = exportMacro;
}
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 485ac31..819998c 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -777,7 +777,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.AddDefine(configDefine);
// Add the export symbol definition for shared library objects.
- if(const char* exportMacro = target.GetExportMacro())
+ if(const char* exportMacro = gt->GetExportMacro())
{
targetOptions.AddDefine(exportMacro);
}
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 31fb37b..020e64c 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -209,7 +209,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
}
// Add symbol export flags if necessary.
- if(this->Target->IsExecutableWithExports())
+ if(this->GeneratorTarget->IsExecutableWithExports())
{
std::string export_flag_var = "CMAKE_EXE_EXPORTS_";
export_flag_var += linkLanguage;
@@ -297,7 +297,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
std::string linkRule = this->GetLinkRule(linkRuleVar);
std::vector<std::string> commands1;
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
- if(this->Target->IsExecutableWithExports())
+ if(this->GeneratorTarget->IsExecutableWithExports())
{
// If a separate rule for creating an import library is specified
// add it now.
diff --git a/Source/cmOSXBundleGenerator.cxx b/Source/cmOSXBundleGenerator.cxx
index 490759f..e9dc433 100644
--- a/Source/cmOSXBundleGenerator.cxx
+++ b/Source/cmOSXBundleGenerator.cxx
@@ -34,7 +34,7 @@ cmOSXBundleGenerator(cmGeneratorTarget* target,
//----------------------------------------------------------------------------
bool cmOSXBundleGenerator::MustSkip()
{
- return !this->GT->Target->HaveWellDefinedOutputFiles();
+ return !this->GT->HaveWellDefinedOutputFiles();
}
//----------------------------------------------------------------------------
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 35ee127..e3eedc7 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -555,7 +555,7 @@ void cmOrderDirectories::FindImplicitConflicts()
<< "Some of these libraries may not be found correctly.";
this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::WARNING, w.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
//----------------------------------------------------------------------------
@@ -637,5 +637,5 @@ void cmOrderDirectories::DiagnoseCycle()
e << "Some of these libraries may not be found correctly.";
this->GlobalGenerator->GetCMakeInstance()
->IssueMessage(cmake::WARNING, e.str(),
- this->Target->Target->GetBacktrace());
+ this->Target->GetBacktrace());
}
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a549d18..5023055 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -230,6 +230,23 @@ class cmPolicy;
#define CM_FOR_EACH_POLICY_ID(POLICY) \
CM_FOR_EACH_POLICY_TABLE(POLICY, CM_SELECT_ID)
+#define CM_FOR_EACH_TARGET_POLICY(F) \
+ F(CMP0003) \
+ F(CMP0004) \
+ F(CMP0008) \
+ F(CMP0020) \
+ F(CMP0021) \
+ F(CMP0022) \
+ F(CMP0027) \
+ F(CMP0038) \
+ F(CMP0041) \
+ F(CMP0042) \
+ F(CMP0046) \
+ F(CMP0052) \
+ F(CMP0060) \
+ F(CMP0063) \
+ F(CMP0065)
+
/** \class cmPolicies
* \brief Handles changes in CMake behavior and policies
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index f663678..e056469 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -583,31 +583,6 @@ const std::vector<std::string>& cmTarget::GetLinkDirectories() const
}
//----------------------------------------------------------------------------
-cmTargetLinkLibraryType cmTarget::ComputeLinkType(
- const std::string& config) const
-{
- // No configuration is always optimized.
- if(config.empty())
- {
- return OPTIMIZED_LibraryType;
- }
-
- // Get the list of configurations considered to be DEBUG.
- std::vector<std::string> debugConfigs =
- this->Makefile->GetCMakeInstance()->GetDebugConfigs();
-
- // Check if any entry in the list matches this configuration.
- std::string configUpper = cmSystemTools::UpperCase(config);
- if (std::find(debugConfigs.begin(), debugConfigs.end(), configUpper) !=
- debugConfigs.end())
- {
- return DEBUG_LibraryType;
- }
- // The current configuration is not a debug configuration.
- return OPTIMIZED_LibraryType;
-}
-
-//----------------------------------------------------------------------------
void cmTarget::ClearDependencyInformation( cmMakefile& mf,
const std::string& target )
{
@@ -636,13 +611,6 @@ void cmTarget::ClearDependencyInformation( cmMakefile& mf,
}
//----------------------------------------------------------------------------
-bool cmTarget::NameResolvesToFramework(const std::string& libname) const
-{
- return this->Makefile->GetGlobalGenerator()->
- NameResolvesToFramework(libname);
-}
-
-//----------------------------------------------------------------------------
std::string cmTarget::GetDebugGeneratorExpressions(const std::string &value,
cmTargetLinkLibraryType llt) const
{
@@ -1560,16 +1528,6 @@ void cmTarget::MarkAsImported()
}
//----------------------------------------------------------------------------
-bool cmTarget::HaveWellDefinedOutputFiles() const
-{
- return
- this->GetType() == cmState::STATIC_LIBRARY ||
- this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->GetType() == cmState::EXECUTABLE;
-}
-
-//----------------------------------------------------------------------------
bool cmTarget::HandleLocationPropertyPolicy(cmMakefile* context) const
{
if (this->IsImported())
@@ -2109,32 +2067,6 @@ std::string cmTarget::GetFrameworkVersion() const
}
}
-//----------------------------------------------------------------------------
-const char* cmTarget::GetExportMacro() const
-{
- // Define the symbol for targets that export symbols.
- if(this->GetType() == cmState::SHARED_LIBRARY ||
- this->GetType() == cmState::MODULE_LIBRARY ||
- this->IsExecutableWithExports())
- {
- if(const char* custom_export_name = this->GetProperty("DEFINE_SYMBOL"))
- {
- this->ExportMacro = custom_export_name;
- }
- else
- {
- std::string in = this->GetName();
- in += "_EXPORTS";
- this->ExportMacro = cmSystemTools::MakeCindentifier(in);
- }
- return this->ExportMacro.c_str();
- }
- else
- {
- return 0;
- }
-}
-
bool cmTarget::GetMappedConfig(std::string const& desired_config,
const char** loc,
const char** imp,
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 0e966e9..e8c05da 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -26,23 +26,6 @@
# endif
#endif
-#define CM_FOR_EACH_TARGET_POLICY(F) \
- F(CMP0003) \
- F(CMP0004) \
- F(CMP0008) \
- F(CMP0020) \
- F(CMP0021) \
- F(CMP0022) \
- F(CMP0027) \
- F(CMP0038) \
- F(CMP0041) \
- F(CMP0042) \
- F(CMP0046) \
- F(CMP0052) \
- F(CMP0060) \
- F(CMP0063) \
- F(CMP0065)
-
class cmake;
class cmMakefile;
class cmSourceFile;
@@ -140,16 +123,11 @@ public:
const LinkLibraryVectorType &GetOriginalLinkLibraries() const
{return this->OriginalLinkLibraries;}
- /** Compute the link type to use for the given configuration. */
- cmTargetLinkLibraryType ComputeLinkType(const std::string& config) const;
-
/**
* Clear the dependency information recorded for this target, if any.
*/
void ClearDependencyInformation(cmMakefile& mf, const std::string& target);
- // Check to see if a library is a framework and treat it different on Mac
- bool NameResolvesToFramework(const std::string& libname) const;
void AddLinkLibrary(cmMakefile& mf,
const std::string& target, const std::string& lib,
cmTargetLinkLibraryType llt);
@@ -220,17 +198,10 @@ public:
const char** imp,
std::string& suffix) const;
- /** Get the macro to define when building sources in this target.
- If no macro should be defined null is returned. */
- const char* GetExportMacro() const;
-
/** Return whether this target is an executable with symbol exports
enabled. */
bool IsExecutableWithExports() const;
- /** Return whether or not the target is for a DLL platform. */
- bool IsDLLPlatform() const { return this->DLLPlatform; }
-
/** Return whether this target is a shared library Framework on
Apple. */
bool IsFrameworkOnApple() const;
@@ -245,9 +216,6 @@ public:
/** Get a backtrace from the creation of the target. */
cmListFileBacktrace const& GetBacktrace() const;
- /** @return whether this target have a well defined output file name. */
- bool HaveWellDefinedOutputFiles() const;
-
void InsertInclude(std::string const& entry,
cmListFileBacktrace const& bt,
bool before = false);
@@ -369,7 +337,6 @@ private:
std::string Name;
std::string InstallPath;
std::string RuntimeInstallPath;
- mutable std::string ExportMacro;
std::vector<std::string> LinkDirectories;
std::vector<cmCustomCommand> PreBuildCommands;
std::vector<cmCustomCommand> PreLinkCommands;
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 2cbd306..f4c632d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1961,7 +1961,8 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
configDefine += configName;
configDefine += "\"";
clOptions.AddDefine(configDefine);
- if(const char* exportMacro = this->Target->GetExportMacro())
+ if(const char* exportMacro =
+ this->GeneratorTarget->GetExportMacro())
{
clOptions.AddDefine(exportMacro);
}