summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2015-10-19 20:42:01 (GMT)
committerStephen Kelly <steveire@gmail.com>2015-10-20 22:52:22 (GMT)
commit311018e5ad27abf7c76003ec91d3f26ef316e3cc (patch)
tree12691ae0c22b86e09aa0a1bef1e6ca5fa8b1bb9c
parent215cd21a0238ba00aec7c81014fe83e3d47187a6 (diff)
downloadCMake-311018e5ad27abf7c76003ec91d3f26ef316e3cc.zip
CMake-311018e5ad27abf7c76003ec91d3f26ef316e3cc.tar.gz
CMake-311018e5ad27abf7c76003ec91d3f26ef316e3cc.tar.bz2
cmGeneratorTarget: Move GetExportMacro from cmTarget.
-rw-r--r--Source/cmCommonTargetGenerator.cxx3
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx2
-rw-r--r--Source/cmGeneratorTarget.cxx26
-rw-r--r--Source/cmGeneratorTarget.h6
-rw-r--r--Source/cmGhsMultiTargetGenerator.cxx2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx2
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx2
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx2
-rw-r--r--Source/cmTarget.cxx26
-rw-r--r--Source/cmTarget.h5
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx3
11 files changed, 41 insertions, 38 deletions
diff --git a/Source/cmCommonTargetGenerator.cxx b/Source/cmCommonTargetGenerator.cxx
index 41af89b..1982bba 100644
--- a/Source/cmCommonTargetGenerator.cxx
+++ b/Source/cmCommonTargetGenerator.cxx
@@ -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/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/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index 0a1a364..f41243e 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -1709,6 +1709,32 @@ cmListFileBacktrace cmGeneratorTarget::GetBacktrace() const
}
//----------------------------------------------------------------------------
+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
{
public:
diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h
index 9533f43..b32bfd9 100644
--- a/Source/cmGeneratorTarget.h
+++ b/Source/cmGeneratorTarget.h
@@ -168,6 +168,10 @@ public:
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;
@@ -487,6 +491,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;
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/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index ea1b1a0..35f6a58 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1848,7 +1848,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/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/cmTarget.cxx b/Source/cmTarget.cxx
index f663678..58dea03 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2109,32 +2109,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..865bc8d 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -220,10 +220,6 @@ 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;
@@ -369,7 +365,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);
}