[Cmake-commits] CMake branch, next, updated. v2.8.11.2-3555-g5e0be1d
Stephen Kelly
steveire at gmail.com
Thu Aug 1 05:57:45 EDT 2013
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 5e0be1d2be4172150daa9eecae900d9b0ce9c74b (commit)
via 126122618e576242f94d663ef6b9fd7d787012a9 (commit)
from 1cc328390a69d132ad5afd1e5fe809401d4a8743 (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=5e0be1d2be4172150daa9eecae900d9b0ce9c74b
commit 5e0be1d2be4172150daa9eecae900d9b0ce9c74b
Merge: 1cc3283 1261226
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Aug 1 05:57:39 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Aug 1 05:57:39 2013 -0400
Merge topic 'ALIAS-targets' into next
1261226 Additional restrictions for ALIAS targets.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=126122618e576242f94d663ef6b9fd7d787012a9
commit 126122618e576242f94d663ef6b9fd7d787012a9
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Fri Jul 12 09:14:31 2013 +0200
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Thu Aug 1 11:56:43 2013 +0200
Additional restrictions for ALIAS targets.
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 04a304e..e4d7f7f 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -24,6 +24,13 @@ bool cmAddDependenciesCommand
}
std::string target_name = args[0];
+ if(this->Makefile->IsAlias(target_name.c_str()))
+ {
+ cmOStringStream e;
+ e << "Cannot add target-level dependencies to alias target \""
+ << target_name << "\".\n";
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, e.str());
+ }
if(cmTarget* target = this->Makefile->FindTargetToUse(target_name.c_str()))
{
std::vector<std::string>::const_iterator s = args.begin();
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 08deaf0..15b4d92 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -4247,6 +4247,14 @@ cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name)
bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg,
bool isCustom)
{
+ if(this->IsAlias(name.c_str()))
+ {
+ cmOStringStream e;
+ e << "cannot create target \"" << name
+ << "\" because an alias with the same name already exists.";
+ msg = e.str();
+ return false;
+ }
if(cmTarget* existing = this->FindTargetToUse(name.c_str()))
{
// The name given conflicts with an existing target. Produce an
diff --git a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake
index c0289a7..5bcba53 100644
--- a/Tests/RunCMake/alias_targets/RunCMakeTest.cmake
+++ b/Tests/RunCMake/alias_targets/RunCMakeTest.cmake
@@ -14,3 +14,5 @@ run_cmake(target_link_libraries)
run_cmake(target_include_directories)
run_cmake(export)
run_cmake(install-export)
+run_cmake(name-conflict)
+run_cmake(add_dependencies)
diff --git a/Tests/RunCMake/alias_targets/add_dependencies-result.txt b/Tests/RunCMake/alias_targets/add_dependencies-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/add_dependencies-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt b/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt
new file mode 100644
index 0000000..53f2487
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/add_dependencies-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at add_dependencies.cmake:9 \(add_dependencies\):
+ Cannot add target-level dependencies to alias target "alias".
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/alias_targets/add_dependencies.cmake b/Tests/RunCMake/alias_targets/add_dependencies.cmake
new file mode 100644
index 0000000..7436371
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/add_dependencies.cmake
@@ -0,0 +1,9 @@
+
+enable_language(CXX)
+
+add_library(foo empty.cpp)
+add_library(bar empty.cpp)
+
+add_library(alias ALIAS foo)
+
+add_dependencies(alias bar)
diff --git a/Tests/RunCMake/alias_targets/name-conflict-result.txt b/Tests/RunCMake/alias_targets/name-conflict-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/name-conflict-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/alias_targets/name-conflict-stderr.txt b/Tests/RunCMake/alias_targets/name-conflict-stderr.txt
new file mode 100644
index 0000000..3c0faa9
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/name-conflict-stderr.txt
@@ -0,0 +1,5 @@
+CMake Error at name-conflict.cmake:8 \(add_library\):
+ add_library cannot create target "bar" because an alias with the same name
+ already exists.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/alias_targets/name-conflict.cmake b/Tests/RunCMake/alias_targets/name-conflict.cmake
new file mode 100644
index 0000000..d21a092
--- /dev/null
+++ b/Tests/RunCMake/alias_targets/name-conflict.cmake
@@ -0,0 +1,8 @@
+
+enable_language(CXX)
+
+add_library(foo empty.cpp)
+
+add_library(bar ALIAS foo)
+
+add_library(bar empty.cpp)
-----------------------------------------------------------------------
Summary of changes:
Source/cmAddDependenciesCommand.cxx | 7 +++++++
Source/cmMakefile.cxx | 8 ++++++++
Tests/RunCMake/alias_targets/RunCMakeTest.cmake | 2 ++
.../add_dependencies-result.txt} | 0
.../alias_targets/add_dependencies-stderr.txt | 5 +++++
...link_libraries.cmake => add_dependencies.cmake} | 2 +-
.../name-conflict-result.txt} | 0
.../alias_targets/name-conflict-stderr.txt | 5 +++++
...{multiple-targets.cmake => name-conflict.cmake} | 5 +++--
9 files changed, 31 insertions(+), 3 deletions(-)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => alias_targets/add_dependencies-result.txt} (100%)
create mode 100644 Tests/RunCMake/alias_targets/add_dependencies-stderr.txt
copy Tests/RunCMake/alias_targets/{target_link_libraries.cmake => add_dependencies.cmake} (76%)
copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => alias_targets/name-conflict-result.txt} (100%)
create mode 100644 Tests/RunCMake/alias_targets/name-conflict-stderr.txt
copy Tests/RunCMake/alias_targets/{multiple-targets.cmake => name-conflict.cmake} (70%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list