[Cmake-commits] CMake branch, next, updated. v2.8.6-1493-g2b312da
Brad King
brad.king at kitware.com
Wed Oct 5 09:03:55 EDT 2011
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 2b312da218a3e9ab41b0d27e169b7d78b42c397b (commit)
via fec4b637148bf6dca4b1d532ad0c1332c3038ea8 (commit)
via 557956f3489dbc75c7b6d26ed531c7c577aac146 (commit)
via 5b114c9bee735eebf3e6b4d6ef18e4c732ac55f0 (commit)
via 903d914b28655f0643409c4c165654b1daf2e0fd (commit)
via 8a0eb78f3b49b1f999f4b0c0d5d23f4589b465f7 (commit)
via 4532d36cc948228ca5e1ed072b7907a84a78c0e7 (commit)
via 3db2973bd2ceb65a0d88ed6a3428e17cc9f0e182 (commit)
from a48ebb532a36bd81f14298ec135304fe7e7f1dda (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=2b312da218a3e9ab41b0d27e169b7d78b42c397b
commit 2b312da218a3e9ab41b0d27e169b7d78b42c397b
Merge: a48ebb5 fec4b63
Author: Brad King <brad.king at kitware.com>
AuthorDate: Wed Oct 5 09:03:43 2011 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 5 09:03:43 2011 -0400
Merge topic 'ninja-generator-prep' into next
fec4b63 Fix configuration-dependent flag lookup in cmLocalGenerator::GetTargetFlags
557956f Introduce a cmGlobalGenerator::ResolveLanguageCompiler function
5b114c9 Introduce a cmLocalGenerator::ConvertToIncludeReference function
903d914 Make cmLocalGenerator::ConvertToLinkReference virtual
8a0eb78 Constify many getters of cmGlobalGenerator.
4532d36 Add const versions of some getters.
3db2973 Refactor TargetTypeNames.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=fec4b637148bf6dca4b1d532ad0c1332c3038ea8
commit fec4b637148bf6dca4b1d532ad0c1332c3038ea8
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Thu Sep 22 03:59:55 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:43 2011 +0100
Fix configuration-dependent flag lookup in cmLocalGenerator::GetTargetFlags
Specifically, perform configuration-dependent lookup of
STATIC_LIBRARY_FLAGS for static libraries, and use the correct prefix
for configuration-dependent lookup of LINK_FLAGS (i.e. "LINK_FLAGS_",
as opposed to the value of the LINK_FLAGS property).
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index aeda164..65d6fa6 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1463,6 +1463,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags += targetLinkFlags;
linkFlags += " ";
}
+ if(!buildType.empty())
+ {
+ std::string build = "STATIC_LIBRARY_FLAGS_";
+ build += buildType;
+ targetLinkFlags = target.GetProperty(build.c_str());
+ if(targetLinkFlags)
+ {
+ linkFlags += targetLinkFlags;
+ linkFlags += " ";
+ }
+ }
}
break;
case cmTarget::MODULE_LIBRARY:
@@ -1471,7 +1482,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags = this->Makefile->GetSafeDefinition(libraryLinkVariable);
linkFlags += " ";
- if(buildType.size())
+ if(!buildType.empty())
{
std::string build = libraryLinkVariable;
build += "_";
@@ -1502,7 +1513,10 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
{
linkFlags += targetLinkFlags;
linkFlags += " ";
- std::string configLinkFlags = targetLinkFlags;
+ }
+ if(!buildType.empty())
+ {
+ std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
@@ -1521,7 +1535,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
linkFlags +=
this->Makefile->GetSafeDefinition("CMAKE_EXE_LINKER_FLAGS");
linkFlags += " ";
- if(buildType.size())
+ if(!buildType.empty())
{
std::string build = "CMAKE_EXE_LINKER_FLAGS_";
build += buildType;
@@ -1573,8 +1587,11 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs,
if(targetLinkFlags)
{
linkFlags += targetLinkFlags;
- linkFlags += " ";
- std::string configLinkFlags = targetLinkFlags;
+ linkFlags += " ";
+ }
+ if(!buildType.empty())
+ {
+ std::string configLinkFlags = "LINK_FLAGS_";
configLinkFlags += buildType;
targetLinkFlags = target.GetProperty(configLinkFlags.c_str());
if(targetLinkFlags)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=557956f3489dbc75c7b6d26ed531c7c577aac146
commit 557956f3489dbc75c7b6d26ed531c7c577aac146
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Sat Sep 10 03:52:53 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:43 2011 +0100
Introduce a cmGlobalGenerator::ResolveLanguageCompiler function
It is factored out of cmGlobalUnixMakefileGenerator3::EnableLanguage,
and may be used by other generators to resolve CMAKE_*_COMPILER
settings.
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index d62fb44..124519a 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -77,6 +77,79 @@ cmGlobalGenerator::~cmGlobalGenerator()
this->ClearExportSets();
}
+void cmGlobalGenerator::ResolveLanguageCompiler(const std::string &lang,
+ cmMakefile *mf,
+ bool optional) {
+ std::string langComp = "CMAKE_";
+ langComp += lang;
+ langComp += "_COMPILER";
+
+ if(!mf->GetDefinition(langComp.c_str()))
+ {
+ if(!optional)
+ {
+ cmSystemTools::Error(langComp.c_str(),
+ " not set, after EnableLanguage");
+ }
+ return;
+ }
+ const char* name = mf->GetRequiredDefinition(langComp.c_str());
+ std::string path;
+ if(!cmSystemTools::FileIsFullPath(name))
+ {
+ path = cmSystemTools::FindProgram(name);
+ }
+ else
+ {
+ path = name;
+ }
+ if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
+ && (optional==false))
+ {
+ std::string message = "your ";
+ message += lang;
+ message += " compiler: \"";
+ message += name;
+ message += "\" was not found. Please set ";
+ message += langComp;
+ message += " to a valid compiler path or name.";
+ cmSystemTools::Error(message.c_str());
+ path = name;
+ }
+ std::string doc = lang;
+ doc += " compiler.";
+ const char* cname = this->GetCMakeInstance()->
+ GetCacheManager()->GetCacheValue(langComp.c_str());
+ std::string changeVars;
+ if(cname && (path != cname) && (optional==false))
+ {
+ std::string cnameString = cname;
+ std::string pathString = path;
+ // get rid of potentially multiple slashes:
+ cmSystemTools::ConvertToUnixSlashes(cnameString);
+ cmSystemTools::ConvertToUnixSlashes(pathString);
+ if (cnameString != pathString)
+ {
+ const char* cvars =
+ this->GetCMakeInstance()->GetProperty(
+ "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
+ if(cvars)
+ {
+ changeVars += cvars;
+ changeVars += ";";
+ }
+ changeVars += langComp;
+ changeVars += ";";
+ changeVars += cname;
+ this->GetCMakeInstance()->SetProperty(
+ "__CMAKE_DELETE_CACHE_CHANGE_VARS_",
+ changeVars.c_str());
+ }
+ }
+ mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
+ doc.c_str(), cmCacheManager::FILEPATH);
+}
+
// Find the make program for the generator, required for try compiles
void cmGlobalGenerator::FindMakeProgram(cmMakefile* mf)
{
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index adf7b77..96a326c 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -77,6 +77,13 @@ public:
cmMakefile *, bool optional);
/**
+ * Resolve the CMAKE_<lang>_COMPILER setting for the given language.
+ * Intended to be called from EnableLanguage.
+ */
+ void ResolveLanguageCompiler(const std::string &lang, cmMakefile *mf,
+ bool optional);
+
+ /**
* Try to determine system infomation, get it from another generator
*/
virtual void EnableLanguagesFromGenerator(cmGlobalGenerator *gen,
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx
index 169d77d..a23c0d8 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.cxx
+++ b/Source/cmGlobalUnixMakefileGenerator3.cxx
@@ -39,7 +39,6 @@ void cmGlobalUnixMakefileGenerator3
bool optional)
{
this->cmGlobalGenerator::EnableLanguage(languages, mf, optional);
- std::string path;
for(std::vector<std::string>::const_iterator l = languages.begin();
l != languages.end(); ++l)
{
@@ -47,74 +46,7 @@ void cmGlobalUnixMakefileGenerator3
{
continue;
}
- const char* lang = l->c_str();
- std::string langComp = "CMAKE_";
- langComp += lang;
- langComp += "_COMPILER";
-
- if(!mf->GetDefinition(langComp.c_str()))
- {
- if(!optional)
- {
- cmSystemTools::Error(langComp.c_str(),
- " not set, after EnableLanguage");
- }
- continue;
- }
- const char* name = mf->GetRequiredDefinition(langComp.c_str());
- if(!cmSystemTools::FileIsFullPath(name))
- {
- path = cmSystemTools::FindProgram(name);
- }
- else
- {
- path = name;
- }
- if((path.size() == 0 || !cmSystemTools::FileExists(path.c_str()))
- && (optional==false))
- {
- std::string message = "your ";
- message += lang;
- message += " compiler: \"";
- message += name;
- message += "\" was not found. Please set ";
- message += langComp;
- message += " to a valid compiler path or name.";
- cmSystemTools::Error(message.c_str());
- path = name;
- }
- std::string doc = lang;
- doc += " compiler.";
- const char* cname = this->GetCMakeInstance()->
- GetCacheManager()->GetCacheValue(langComp.c_str());
- std::string changeVars;
- if(cname && (path != cname) && (optional==false))
- {
- std::string cnameString = cname;
- std::string pathString = path;
- // get rid of potentially multiple slashes:
- cmSystemTools::ConvertToUnixSlashes(cnameString);
- cmSystemTools::ConvertToUnixSlashes(pathString);
- if (cnameString != pathString)
- {
- const char* cvars =
- this->GetCMakeInstance()->GetProperty(
- "__CMAKE_DELETE_CACHE_CHANGE_VARS_");
- if(cvars)
- {
- changeVars += cvars;
- changeVars += ";";
- }
- changeVars += langComp;
- changeVars += ";";
- changeVars += cname;
- this->GetCMakeInstance()->SetProperty(
- "__CMAKE_DELETE_CACHE_CHANGE_VARS_",
- changeVars.c_str());
- }
- }
- mf->AddCacheDefinition(langComp.c_str(), path.c_str(),
- doc.c_str(), cmCacheManager::FILEPATH);
+ this->ResolveLanguageCompiler(*l, mf, optional);
}
}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5b114c9bee735eebf3e6b4d6ef18e4c732ac55f0
commit 5b114c9bee735eebf3e6b4d6ef18e4c732ac55f0
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Wed Sep 7 02:41:41 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:43 2011 +0100
Introduce a cmLocalGenerator::ConvertToIncludeReference function
This provides a mechanism for the local generator to override how
header search paths are generated.
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 6af7fd5..aeda164 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1185,6 +1185,13 @@ cmLocalGenerator::ConvertToOutputForExisting(RelativeRoot remote,
}
//----------------------------------------------------------------------------
+std::string
+cmLocalGenerator::ConvertToIncludeReference(std::string const& path)
+{
+ return this->ConvertToOutputForExisting(path.c_str());
+}
+
+//----------------------------------------------------------------------------
const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
bool forResponseFile)
{
@@ -1285,7 +1292,7 @@ const char* cmLocalGenerator::GetIncludeFlags(const char* lang,
}
else
{
- includePath = this->ConvertToOutputForExisting(i->c_str());
+ includePath = this->ConvertToIncludeReference(*i);
}
if(quotePaths && includePath.size() && includePath[0] != '\"')
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 69e452b..c0fe886 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -179,7 +179,9 @@ public:
path and short path if spaces. */
std::string ConvertToOutputForExisting(RelativeRoot remote,
const char* local = 0);
-
+
+ virtual std::string ConvertToIncludeReference(std::string const& path);
+
/** Called from command-line hook to clear dependencies. */
virtual void ClearDependencies(cmMakefile* /* mf */,
bool /* verbose */) {}
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=903d914b28655f0643409c4c165654b1daf2e0fd
commit 903d914b28655f0643409c4c165654b1daf2e0fd
Author: Peter Collingbourne <peter at pcc.me.uk>
AuthorDate: Mon Aug 22 14:02:20 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:43 2011 +0100
Make cmLocalGenerator::ConvertToLinkReference virtual
This provides a mechanism for the local generator to override how
library search paths are generated.
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 1f5a26e..69e452b 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -369,7 +369,7 @@ protected:
std::string FindRelativePathTopBinary();
void SetupPathConversions();
- std::string ConvertToLinkReference(std::string const& lib);
+ virtual std::string ConvertToLinkReference(std::string const& lib);
/** Check whether the native build system supports the given
definition. Issues a warning. */
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=8a0eb78f3b49b1f999f4b0c0d5d23f4589b465f7
commit 8a0eb78f3b49b1f999f4b0c0d5d23f4589b465f7
Author: Nicolas Despres <nicolas.despres at gmail.com>
AuthorDate: Sat Mar 26 14:52:19 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:42 2011 +0100
Constify many getters of cmGlobalGenerator.
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 97cacc5..adf7b77 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -163,8 +163,8 @@ public:
int TryCompileTimeout;
- bool GetForceUnixPaths() {return this->ForceUnixPaths;}
- bool GetToolSupportsColor() { return this->ToolSupportsColor; }
+ bool GetForceUnixPaths() const { return this->ForceUnixPaths; }
+ bool GetToolSupportsColor() const { return this->ToolSupportsColor; }
///! return the language for the given extension
const char* GetLanguageFromExtension(const char* ext);
@@ -179,11 +179,11 @@ public:
virtual const char* GetCMakeCFGInitDirectory() { return "."; }
/** Get whether the generator should use a script for link commands. */
- bool GetUseLinkScript() { return this->UseLinkScript; }
+ bool GetUseLinkScript() const { return this->UseLinkScript; }
/** Get whether the generator should produce special marks on rules
producing symbolic (non-file) outputs. */
- bool GetNeedSymbolicMark() { return this->NeedSymbolicMark; }
+ bool GetNeedSymbolicMark() const { return this->NeedSymbolicMark; }
/*
* Determine what program to use for building the project.
@@ -213,7 +213,7 @@ public:
/** Get the manifest of all targets that will be built for each
configuration. This is valid during generation only. */
- cmTargetManifest const& GetTargetManifest() { return this->TargetManifest; }
+ cmTargetManifest const& GetTargetManifest() const { return this->TargetManifest; }
/** Get the content of a directory. Directory listings are loaded
from disk at most once and cached. During the generation step
@@ -224,17 +224,17 @@ public:
void AddTarget(cmTargets::value_type &v);
- virtual const char* GetAllTargetName() { return "ALL_BUILD"; }
- virtual const char* GetInstallTargetName() { return "INSTALL"; }
- virtual const char* GetInstallLocalTargetName() { return 0; }
- virtual const char* GetInstallStripTargetName() { return 0; }
- virtual const char* GetPreinstallTargetName() { return 0; }
- virtual const char* GetTestTargetName() { return "RUN_TESTS"; }
- virtual const char* GetPackageTargetName() { return "PACKAGE"; }
- virtual const char* GetPackageSourceTargetName(){ return 0; }
- virtual const char* GetEditCacheTargetName() { return 0; }
- virtual const char* GetRebuildCacheTargetName() { return 0; }
- virtual const char* GetCleanTargetName() { return 0; }
+ virtual const char* GetAllTargetName() const { return "ALL_BUILD"; }
+ virtual const char* GetInstallTargetName() const { return "INSTALL"; }
+ virtual const char* GetInstallLocalTargetName() const { return 0; }
+ virtual const char* GetInstallStripTargetName() const { return 0; }
+ virtual const char* GetPreinstallTargetName() const { return 0; }
+ virtual const char* GetTestTargetName() const { return "RUN_TESTS"; }
+ virtual const char* GetPackageTargetName() const { return "PACKAGE"; }
+ virtual const char* GetPackageSourceTargetName() const { return 0; }
+ virtual const char* GetEditCacheTargetName() const { return 0; }
+ virtual const char* GetRebuildCacheTargetName() const { return 0; }
+ virtual const char* GetCleanTargetName() const { return 0; }
// Class to track a set of dependencies.
typedef cmTargetDependSet TargetDependSet;
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index d21d5b9..7c6bbc2 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -137,17 +137,17 @@ protected:
bool NeedRequiresStep(cmTarget const&);
// Setup target names
- virtual const char* GetAllTargetName() { return "all"; }
- virtual const char* GetInstallTargetName() { return "install"; }
- virtual const char* GetInstallLocalTargetName() { return "install/local"; }
- virtual const char* GetInstallStripTargetName() { return "install/strip"; }
- virtual const char* GetPreinstallTargetName() { return "preinstall"; }
- virtual const char* GetTestTargetName() { return "test"; }
- virtual const char* GetPackageTargetName() { return "package"; }
- virtual const char* GetPackageSourceTargetName(){ return "package_source"; }
- virtual const char* GetEditCacheTargetName() { return "edit_cache"; }
- virtual const char* GetRebuildCacheTargetName() { return "rebuild_cache"; }
- virtual const char* GetCleanTargetName() { return "clean"; }
+ virtual const char* GetAllTargetName() const { return "all"; }
+ virtual const char* GetInstallTargetName() const { return "install"; }
+ virtual const char* GetInstallLocalTargetName() const { return "install/local"; }
+ virtual const char* GetInstallStripTargetName() const { return "install/strip"; }
+ virtual const char* GetPreinstallTargetName() const { return "preinstall"; }
+ virtual const char* GetTestTargetName() const { return "test"; }
+ virtual const char* GetPackageTargetName() const { return "package"; }
+ virtual const char* GetPackageSourceTargetName() const { return "package_source"; }
+ virtual const char* GetEditCacheTargetName() const { return "edit_cache"; }
+ virtual const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; }
+ virtual const char* GetCleanTargetName() const { return "clean"; }
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4532d36cc948228ca5e1ed072b7907a84a78c0e7
commit 4532d36cc948228ca5e1ed072b7907a84a78c0e7
Author: Nicolas Despres <nicolas.despres at gmail.com>
AuthorDate: Sat Mar 26 14:31:59 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:42 2011 +0100
Add const versions of some getters.
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index 88eb8b6..97cacc5 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -120,6 +120,7 @@ public:
///! Get the CMake instance
cmake *GetCMakeInstance() { return this->CMakeInstance; };
+ const cmake *GetCMakeInstance() const { return this->CMakeInstance; };
void SetConfiguredFilesPath(cmGlobalGenerator* gen);
const std::vector<cmLocalGenerator *>& GetLocalGenerators() const {
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index cfc09dc..1f5a26e 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -83,6 +83,8 @@ public:
///! Get the GlobalGenerator this is associated with
cmGlobalGenerator *GetGlobalGenerator() {
return this->GlobalGenerator; };
+ const cmGlobalGenerator *GetGlobalGenerator() const {
+ return this->GlobalGenerator; };
///! Set the Global Generator, done on creation by the GlobalGenerator
void SetGlobalGenerator(cmGlobalGenerator *gg);
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3db2973bd2ceb65a0d88ed6a3428e17cc9f0e182
commit 3db2973bd2ceb65a0d88ed6a3428e17cc9f0e182
Author: Nicolas Despres <nicolas.despres at gmail.com>
AuthorDate: Sun Mar 20 17:57:42 2011 +0100
Commit: Peter Collingbourne <peter at pcc.me.uk>
CommitDate: Sun Oct 2 18:30:42 2011 +0100
Refactor TargetTypeNames.
Make it a static method instead of an array. It is safer for the
type checking and if we add a new target type we will be warned to add
a case to the switch.
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 3a0ed06..8e701c4 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -404,7 +404,7 @@ cmComputeTargetDepends
// Describe the depender.
e << " \"" << depender->GetName() << "\" of type "
- << cmTarget::TargetTypeNames[depender->GetType()] << "\n";
+ << cmTarget::GetTargetTypeName(depender->GetType()) << "\n";
// List its dependencies that are inside the component.
EdgeList const& nl = this->InitialGraph[i];
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1d1e8da..6af7fd5 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -996,7 +996,7 @@ cmLocalGenerator::ExpandRuleVariable(std::string const& variable,
}
if(variable == "TARGET_TYPE")
{
- return cmTarget::TargetTypeNames[replaceValues.CMTarget->GetType()];
+ return cmTarget::GetTargetTypeName(replaceValues.CMTarget->GetType());
}
}
if(replaceValues.Output)
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index e5b5443..573c430 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1379,7 +1379,7 @@ void cmMakefile::AddLinkLibraryForTarget(const char *target,
{
cmOStringStream e;
e << "Target \"" << lib << "\" of type "
- << cmTarget::TargetTypeNames[static_cast<int>(tgt->GetType())]
+ << cmTarget::GetTargetTypeName(tgt->GetType())
<< " may not be linked into another target. "
<< "One may link only to STATIC or SHARED libraries, or "
<< "to executables with the ENABLE_EXPORTS property set.";
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index fb92016..e74e70c 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -25,12 +25,35 @@
#include <queue>
#include <stdlib.h> // required for atof
#include <assert.h>
-const char* cmTarget::TargetTypeNames[] = {
- "EXECUTABLE", "STATIC_LIBRARY",
- "SHARED_LIBRARY", "MODULE_LIBRARY", "UTILITY", "GLOBAL_TARGET",
- "INSTALL_FILES", "INSTALL_PROGRAMS", "INSTALL_DIRECTORY",
- "UNKNOWN_LIBRARY"
-};
+
+const char* cmTarget::GetTargetTypeName(TargetType targetType)
+{
+ switch( targetType )
+ {
+ case cmTarget::STATIC_LIBRARY:
+ return "STATIC_LIBRARY";
+ case cmTarget::MODULE_LIBRARY:
+ return "MODULE_LIBRARY";
+ case cmTarget::SHARED_LIBRARY:
+ return "SHARED_LIBRARY";
+ case cmTarget::EXECUTABLE:
+ return "EXECUTABLE";
+ case cmTarget::UTILITY:
+ return "UTILITY";
+ case cmTarget::GLOBAL_TARGET:
+ return "GLOBAL_TARGET";
+ case cmTarget::INSTALL_FILES:
+ return "INSTALL_FILES";
+ case cmTarget::INSTALL_PROGRAMS:
+ return "INSTALL_PROGRAMS";
+ case cmTarget::INSTALL_DIRECTORY:
+ return "INSTALL_DIRECTORY";
+ case cmTarget::UNKNOWN_LIBRARY:
+ return "UNKNOWN_LIBRARY";
+ }
+ assert(0 && "Unexpected target type");
+ return 0;
+}
//----------------------------------------------------------------------------
struct cmTarget::OutputInfo
@@ -2346,7 +2369,7 @@ cmTarget::OutputInfo const* cmTarget::GetOutputInfo(const char* config)
std::string msg = "cmTarget::GetOutputInfo called for ";
msg += this->GetName();
msg += " which has type ";
- msg += cmTarget::TargetTypeNames[this->GetType()];
+ msg += cmTarget::GetTargetTypeName(this->GetType());
this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, msg);
abort();
return 0;
@@ -2645,40 +2668,7 @@ const char *cmTarget::GetProperty(const char* prop,
// the type property returns what type the target is
if (!strcmp(prop,"TYPE"))
{
- switch( this->GetType() )
- {
- case cmTarget::STATIC_LIBRARY:
- return "STATIC_LIBRARY";
- // break; /* unreachable */
- case cmTarget::MODULE_LIBRARY:
- return "MODULE_LIBRARY";
- // break; /* unreachable */
- case cmTarget::SHARED_LIBRARY:
- return "SHARED_LIBRARY";
- // break; /* unreachable */
- case cmTarget::EXECUTABLE:
- return "EXECUTABLE";
- // break; /* unreachable */
- case cmTarget::UTILITY:
- return "UTILITY";
- // break; /* unreachable */
- case cmTarget::GLOBAL_TARGET:
- return "GLOBAL_TARGET";
- // break; /* unreachable */
- case cmTarget::INSTALL_FILES:
- return "INSTALL_FILES";
- // break; /* unreachable */
- case cmTarget::INSTALL_PROGRAMS:
- return "INSTALL_PROGRAMS";
- // break; /* unreachable */
- case cmTarget::INSTALL_DIRECTORY:
- return "INSTALL_DIRECTORY";
- // break; /* unreachable */
- case cmTarget::UNKNOWN_LIBRARY:
- return "UNKNOWN_LIBRARY";
- // break; /* unreachable */
- }
- return 0;
+ return cmTarget::GetTargetTypeName(this->GetType());
}
bool chain = false;
const char *retVal =
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 26fcef2..0abdddb 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -62,7 +62,7 @@ public:
SHARED_LIBRARY, MODULE_LIBRARY, UTILITY, GLOBAL_TARGET,
INSTALL_FILES, INSTALL_PROGRAMS, INSTALL_DIRECTORY,
UNKNOWN_LIBRARY};
- static const char* TargetTypeNames[];
+ static const char* GetTargetTypeName(TargetType targetType);
enum CustomCommandType { PRE_BUILD, PRE_LINK, POST_BUILD };
/**
-----------------------------------------------------------------------
Summary of changes:
Source/cmComputeTargetDepends.cxx | 2 +-
Source/cmGlobalGenerator.cxx | 73 +++++++++++++++++++++++++++++
Source/cmGlobalGenerator.h | 40 +++++++++------
Source/cmGlobalUnixMakefileGenerator3.cxx | 70 +---------------------------
Source/cmGlobalUnixMakefileGenerator3.h | 22 ++++----
Source/cmLocalGenerator.cxx | 38 ++++++++++++---
Source/cmLocalGenerator.h | 8 ++-
Source/cmMakefile.cxx | 2 +-
Source/cmTarget.cxx | 72 ++++++++++++----------------
Source/cmTarget.h | 2 +-
10 files changed, 180 insertions(+), 149 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list