[Cmake-commits] CMake branch, next, updated. v3.7.0-rc1-260-g1035d0e
Stephen Kelly
steveire at gmail.com
Fri Oct 7 16:08:38 EDT 2016
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 1035d0e0d270301d266f2d20b39bf09fa3448972 (commit)
via a1cfc4fe3deed4d642773d0ae63dd524c3f2eba1 (commit)
via 4079ba20d9d9c8d15fd28d9440d56c907dda811c (commit)
via 17ab8e33f005aab3e493ac4535f63b6f229aacab (commit)
from d808f0fdad129f19f1607aa5585a5642fcecf01a (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1035d0e0d270301d266f2d20b39bf09fa3448972
commit 1035d0e0d270301d266f2d20b39bf09fa3448972
Merge: d808f0f a1cfc4f
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 16:08:36 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Oct 7 16:08:36 2016 -0400
Merge topic 'clean-up-link-configuration' into next
a1cfc4fe cmMakefile: Simplify programmer error to an assert
4079ba20 cmMakefile: Implement LinkLibraries as an internal property
17ab8e33 cmMakefile: Inline method into only remaining caller
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a1cfc4fe3deed4d642773d0ae63dd524c3f2eba1
commit a1cfc4fe3deed4d642773d0ae63dd524c3f2eba1
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 20:13:37 2016 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 22:08:03 2016 +0200
cmMakefile: Simplify programmer error to an assert
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 47d9b47..6ab45bb 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1832,14 +1832,9 @@ cmTarget* cmMakefile::AddLibrary(const std::string& lname,
const std::vector<std::string>& srcs,
bool excludeFromAll)
{
- // wrong type ? default to STATIC
- if ((type != cmState::STATIC_LIBRARY) && (type != cmState::SHARED_LIBRARY) &&
- (type != cmState::MODULE_LIBRARY) && (type != cmState::OBJECT_LIBRARY) &&
- (type != cmState::INTERFACE_LIBRARY)) {
- this->IssueMessage(cmake::INTERNAL_ERROR,
- "cmMakefile::AddLibrary given invalid target type.");
- type = cmState::STATIC_LIBRARY;
- }
+ assert(type == cmState::STATIC_LIBRARY || type == cmState::SHARED_LIBRARY ||
+ type == cmState::MODULE_LIBRARY || type == cmState::OBJECT_LIBRARY ||
+ type == cmState::INTERFACE_LIBRARY);
cmTarget* target = this->AddNewTarget(type, lname);
// Clear its dependencies. Otherwise, dependencies might persist
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4079ba20d9d9c8d15fd28d9440d56c907dda811c
commit 4079ba20d9d9c8d15fd28d9440d56c907dda811c
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 20:13:37 2016 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 22:07:50 2016 +0200
cmMakefile: Implement LinkLibraries as an internal property
cmMakefile should not have logic particular to individual cmake
commands. The link_libraries() command is generally obsolete in favor
of target_link_libraries(). An alternative language for CMake probably
would not offer the former. The quirks and historical behaviors of the
current language should be separate from the core classes of CMake to
allow replacing the language.
diff --git a/Source/cmLinkLibrariesCommand.cxx b/Source/cmLinkLibrariesCommand.cxx
index 3fc7bd9..4202cf5 100644
--- a/Source/cmLinkLibrariesCommand.cxx
+++ b/Source/cmLinkLibrariesCommand.cxx
@@ -20,7 +20,7 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
"a library");
return false;
}
- this->Makefile->AddLinkLibrary(*i, DEBUG_LibraryType);
+ this->Makefile->AppendProperty("LINK_LIBRARIES", "debug");
} else if (*i == "optimized") {
++i;
if (i == args.end()) {
@@ -28,10 +28,9 @@ bool cmLinkLibrariesCommand::InitialPass(std::vector<std::string> const& args,
"a library");
return false;
}
- this->Makefile->AddLinkLibrary(*i, OPTIMIZED_LibraryType);
- } else {
- this->Makefile->AddLinkLibrary(*i, GENERAL_LibraryType);
+ this->Makefile->AppendProperty("LINK_LIBRARIES", "optimized");
}
+ this->Makefile->AppendProperty("LINK_LIBRARIES", i->c_str());
}
return true;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 6e451b6..47d9b47 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1207,15 +1207,6 @@ bool cmMakefile::ParseDefineFlag(std::string const& def, bool remove)
return true;
}
-void cmMakefile::AddLinkLibrary(const std::string& lib,
- cmTargetLinkLibraryType llt)
-{
- cmTarget::LibraryID tmp;
- tmp.first = lib;
- tmp.second = llt;
- this->LinkLibraries.push_back(tmp);
-}
-
void cmMakefile::InitializeFromParent(cmMakefile* parent)
{
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
@@ -1247,7 +1238,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
}
// link libraries
- this->LinkLibraries = parent->LinkLibraries;
+ this->SetProperty("LINK_LIBRARIES", parent->GetProperty("LINK_LIBRARIES"));
// link directories
this->SetProperty("LINK_DIRECTORIES",
@@ -1804,14 +1795,29 @@ void cmMakefile::AddGlobalLinkInformation(cmTarget& target)
}
}
- cmTarget::LinkLibraryVectorType::const_iterator i =
- this->LinkLibraries.begin();
- for (; i != this->LinkLibraries.end(); ++i) {
- // This is equivalent to the target_link_libraries plain signature.
- target.AddLinkLibrary(*this, i->first, i->second);
- target.AppendProperty(
- "INTERFACE_LINK_LIBRARIES",
- target.GetDebugGeneratorExpressions(i->first, i->second).c_str());
+ if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs;
+ cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+
+ for (std::vector<std::string>::iterator j = linkLibs.begin();
+ j != linkLibs.end(); ++j) {
+ std::string libraryName = *j;
+ cmTargetLinkLibraryType libType = GENERAL_LibraryType;
+ if (libraryName == "optimized") {
+ libType = OPTIMIZED_LibraryType;
+ ++j;
+ libraryName = *j;
+ } else if (libraryName == "debug") {
+ libType = DEBUG_LibraryType;
+ ++j;
+ libraryName = *j;
+ }
+ // This is equivalent to the target_link_libraries plain signature.
+ target.AddLinkLibrary(*this, libraryName, libType);
+ target.AppendProperty(
+ "INTERFACE_LINK_LIBRARIES",
+ target.GetDebugGeneratorExpressions(libraryName, libType).c_str());
+ }
}
}
@@ -2074,19 +2080,32 @@ void cmMakefile::ExpandVariablesCMP0019()
}
}
}
- for (cmTarget::LinkLibraryVectorType::iterator l =
- this->LinkLibraries.begin();
- l != this->LinkLibraries.end(); ++l) {
- if (mightExpandVariablesCMP0019(l->first.c_str())) {
- std::string orig = l->first;
- this->ExpandVariablesInString(l->first, true, true);
- if (pol == cmPolicies::WARN && l->first != orig) {
- /* clang-format off */
+
+ if (const char* linkLibsProp = this->GetProperty("LINK_LIBRARIES")) {
+ std::vector<std::string> linkLibs;
+ cmSystemTools::ExpandListArgument(linkLibsProp, linkLibs);
+
+ for (std::vector<std::string>::iterator l = linkLibs.begin();
+ l != linkLibs.end(); ++l) {
+ std::string libName = *l;
+ if (libName == "optimized") {
+ ++l;
+ libName = *l;
+ } else if (libName == "debug") {
+ ++l;
+ libName = *l;
+ }
+ if (mightExpandVariablesCMP0019(libName.c_str())) {
+ std::string orig = libName;
+ this->ExpandVariablesInString(libName, true, true);
+ if (pol == cmPolicies::WARN && libName != orig) {
+ /* clang-format off */
w << "Evaluated link library\n"
<< " " << orig << "\n"
<< "as\n"
- << " " << l->first << "\n";
- /* clang-format on */
+ << " " << libName << "\n";
+ /* clang-format on */
+ }
}
}
}
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index a16c6bb..8fef38b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -197,11 +197,6 @@ public:
const char* comment = CM_NULLPTR, bool uses_terminal = false);
/**
- * Add a link library to the build.
- */
- void AddLinkLibrary(const std::string&, cmTargetLinkLibraryType type);
-
- /**
* Add a subdirectory to the build.
*/
void AddSubDirectory(const std::string& fullSrcDir,
@@ -808,8 +803,6 @@ protected:
std::vector<std::string> ListFiles;
std::vector<std::string> OutputFiles;
- cmTarget::LinkLibraryVectorType LinkLibraries;
-
std::vector<cmInstallGenerator*> InstallGenerators;
std::vector<cmTestGenerator*> TestGenerators;
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=17ab8e33f005aab3e493ac4535f63b6f229aacab
commit 17ab8e33f005aab3e493ac4535f63b6f229aacab
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Oct 7 20:13:36 2016 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Fri Oct 7 22:07:16 2016 +0200
cmMakefile: Inline method into only remaining caller
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.
-----------------------------------------------------------------------
Summary of changes:
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list