summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2016-10-07 18:13:36 (GMT)
committerStephen Kelly <steveire@gmail.com>2016-10-07 20:07:16 (GMT)
commit17ab8e33f005aab3e493ac4535f63b6f229aacab (patch)
tree34830b31d43bd18de1fcbf9d48d8bf27e4d37e8f /Source
parent7edfcd0e834a4dc8d3da9cada6ad6b9b46dfb4dd (diff)
downloadCMake-17ab8e33f005aab3e493ac4535f63b6f229aacab.zip
CMake-17ab8e33f005aab3e493ac4535f63b6f229aacab.tar.gz
CMake-17ab8e33f005aab3e493ac4535f63b6f229aacab.tar.bz2
cmMakefile: Inline method into only remaining caller
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCPluginAPI.cxx35
-rw-r--r--Source/cmMakefile.cxx29
-rw-r--r--Source/cmMakefile.h2
3 files changed, 32 insertions, 34 deletions
diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 2498ecb..56a469d 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -337,6 +337,35 @@ void CCONV cmAddCustomCommandToTarget(void* arg, const char* target,
cctype, no_comment, no_working_dir);
}
+static void addLinkLibrary(cmMakefile* mf, std::string const& target,
+ std::string const& lib, cmTargetLinkLibraryType llt)
+{
+ cmTarget* t = mf->FindLocalNonAliasTarget(target);
+ if (!t) {
+ std::ostringstream e;
+ e << "Attempt to add link library \"" << lib << "\" to target \"" << target
+ << "\" which is not built in this directory.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
+ cmTarget* tgt = mf->GetGlobalGenerator()->FindTarget(lib);
+ if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) &&
+ (tgt->GetType() != cmState::SHARED_LIBRARY) &&
+ (tgt->GetType() != cmState::INTERFACE_LIBRARY) &&
+ !tgt->IsExecutableWithExports()) {
+ std::ostringstream e;
+ e << "Target \"" << lib << "\" of type "
+ << cmState::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.";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
+
+ t->AddLinkLibrary(*mf, lib, llt);
+}
+
void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
const char* value, int libtype)
{
@@ -344,13 +373,13 @@ void CCONV cmAddLinkLibraryForTarget(void* arg, const char* tgt,
switch (libtype) {
case CM_LIBRARY_GENERAL:
- mf->AddLinkLibraryForTarget(tgt, value, GENERAL_LibraryType);
+ addLinkLibrary(mf, tgt, value, GENERAL_LibraryType);
break;
case CM_LIBRARY_DEBUG:
- mf->AddLinkLibraryForTarget(tgt, value, DEBUG_LibraryType);
+ addLinkLibrary(mf, tgt, value, DEBUG_LibraryType);
break;
case CM_LIBRARY_OPTIMIZED:
- mf->AddLinkLibraryForTarget(tgt, value, OPTIMIZED_LibraryType);
+ addLinkLibrary(mf, tgt, value, OPTIMIZED_LibraryType);
break;
}
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index eda08c0..6e451b6 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1216,35 +1216,6 @@ void cmMakefile::AddLinkLibrary(const std::string& lib,
this->LinkLibraries.push_back(tmp);
}
-void cmMakefile::AddLinkLibraryForTarget(const std::string& target,
- const std::string& lib,
- cmTargetLinkLibraryType llt)
-{
- cmTarget* t = this->FindLocalNonAliasTarget(target);
- if (!t) {
- std::ostringstream e;
- e << "Attempt to add link library \"" << lib << "\" to target \"" << target
- << "\" which is not built in this directory.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- return;
- }
-
- cmTarget* tgt = this->GetGlobalGenerator()->FindTarget(lib);
- if (tgt && (tgt->GetType() != cmState::STATIC_LIBRARY) &&
- (tgt->GetType() != cmState::SHARED_LIBRARY) &&
- (tgt->GetType() != cmState::INTERFACE_LIBRARY) &&
- !tgt->IsExecutableWithExports()) {
- std::ostringstream e;
- e << "Target \"" << lib << "\" of type "
- << cmState::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.";
- this->IssueMessage(cmake::FATAL_ERROR, e.str());
- }
- t->AddLinkLibrary(*this, lib, llt);
-}
-
void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 9f5f8ee..a16c6bb 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -200,8 +200,6 @@ public:
* Add a link library to the build.
*/
void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type);
- void AddLinkLibraryForTarget(const std::string& tgt, const std::string&,
- cmTargetLinkLibraryType type);
/**
* Add a subdirectory to the build.