summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-10-11 18:45:35 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2011-10-11 18:45:35 (GMT)
commit12264045453f53aa9ca3defb350842c8b0b3c30c (patch)
tree480006df3a19485ec7c9b59fc9548f592fd051fa
parentd9f996334bae5c5bd6ceecaa71dd5ed64261a596 (diff)
parent32f8437bbfc7141ba4ff9c6dd4311e67c25c2ad2 (diff)
downloadCMake-12264045453f53aa9ca3defb350842c8b0b3c30c.zip
CMake-12264045453f53aa9ca3defb350842c8b0b3c30c.tar.gz
CMake-12264045453f53aa9ca3defb350842c8b0b3c30c.tar.bz2
Merge topic 'ninja-generator-prep'
32f8437 Fix line-too-long style violations 029ab31 Constify XCode generator getters to match cmGlobalGenerator 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.
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmGlobalGenerator.cxx73
-rw-r--r--Source/cmGlobalGenerator.h41
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.cxx70
-rw-r--r--Source/cmGlobalUnixMakefileGenerator3.h24
-rw-r--r--Source/cmGlobalXCodeGenerator.h4
-rw-r--r--Source/cmLocalGenerator.cxx38
-rw-r--r--Source/cmLocalGenerator.h8
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmTarget.cxx72
-rw-r--r--Source/cmTarget.h2
11 files changed, 184 insertions, 152 deletions
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/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 88eb8b6..9f140a9 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,
@@ -120,6 +127,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 {
@@ -162,8 +170,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);
@@ -178,11 +186,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.
@@ -212,7 +220,8 @@ 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
@@ -223,17 +232,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.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);
}
}
diff --git a/Source/cmGlobalUnixMakefileGenerator3.h b/Source/cmGlobalUnixMakefileGenerator3.h
index d21d5b9..481640b 100644
--- a/Source/cmGlobalUnixMakefileGenerator3.h
+++ b/Source/cmGlobalUnixMakefileGenerator3.h
@@ -136,18 +136,18 @@ protected:
// does this generator need a requires step for any of its targets
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"; }
+ // Target name hooks for superclass.
+ const char* GetAllTargetName() const { return "all"; }
+ const char* GetInstallTargetName() const { return "install"; }
+ const char* GetInstallLocalTargetName() const { return "install/local"; }
+ const char* GetInstallStripTargetName() const { return "install/strip"; }
+ const char* GetPreinstallTargetName() const { return "preinstall"; }
+ const char* GetTestTargetName() const { return "test"; }
+ const char* GetPackageTargetName() const { return "package"; }
+ const char* GetPackageSourceTargetName() const { return "package_source"; }
+ const char* GetEditCacheTargetName() const { return "edit_cache"; }
+ const char* GetRebuildCacheTargetName() const { return "rebuild_cache"; }
+ const char* GetCleanTargetName() const { return "clean"; }
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { return true; }
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index fa55ff0..ed54be3 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -194,8 +194,8 @@ private:
void AppendFlag(std::string& flags, std::string const& flag);
protected:
- virtual const char* GetInstallTargetName() { return "install"; }
- virtual const char* GetPackageTargetName() { return "package"; }
+ virtual const char* GetInstallTargetName() const { return "install"; }
+ virtual const char* GetPackageTargetName() const { return "package"; }
unsigned int XcodeVersion;
std::string VersionString;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 1d1e8da..65d6fa6 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)
@@ -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] != '\"')
{
@@ -1456,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:
@@ -1464,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 += "_";
@@ -1495,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)
@@ -1514,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;
@@ -1566,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)
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index cfc09dc..c0fe886 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);
@@ -177,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 */) {}
@@ -367,7 +371,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. */
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 };
/**