[Cmake-commits] CMake branch, next, updated. v2.8.11.2-4353-g73a36ca
Brad King
brad.king at kitware.com
Mon Sep 30 09:54:36 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 73a36cae17a1ff85c4ab65c289222e1d0ef4236e (commit)
via 68bfed63764c19a63bc76ac9be45b44034ade874 (commit)
from 5e530c1f1d16a33ad01b9832a68a8d3a491bb4c0 (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=73a36cae17a1ff85c4ab65c289222e1d0ef4236e
commit 73a36cae17a1ff85c4ab65c289222e1d0ef4236e
Merge: 5e530c1 68bfed6
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 30 09:54:30 2013 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 30 09:54:30 2013 -0400
Merge topic 'fix-duplicate-custom-commands' into next
68bfed6 Warn and skip multiple custom commands for the same output (#14446)
diff --cc Tests/RunCMake/CMakeLists.txt
index 7fc3203,e2b1cec..e8001aa
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@@ -85,8 -85,8 +85,9 @@@ if(NOT WIN32
endif()
endif()
add_RunCMake_test(CompatibleInterface)
+add_RunCMake_test(Syntax)
+ add_RunCMake_test(add_custom_command)
add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command)
add_RunCMake_test(find_package)
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=68bfed63764c19a63bc76ac9be45b44034ade874
commit 68bfed63764c19a63bc76ac9be45b44034ade874
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 30 09:27:49 2013 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 30 09:39:42 2013 -0400
Warn and skip multiple custom commands for the same output (#14446)
In buggy code like
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/out.h
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/out.h.in
...)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/out.h
...)
that has more than one rule to generate the same output CMake has always
used the first rule. However, since commit 2268c41a (Optimize custom
command full-path dependency lookup, 2013-08-06) we update the map from
output to cmSourceFile for every rule generating an output, effectively
keeping the last command instead of the first.
Fix this regression by checking for each map update if the output
already has an entry. If so, keep only the original entry. Also
generate a warning to help authors track down such cases and fix their
projects.
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 08c9763..292bc86 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1033,6 +1033,18 @@ void
cmMakefile::UpdateOutputToSourceMap(std::string const& output,
cmSourceFile* source)
{
+ OutputToSourceMap::iterator i = this->OutputToSource.find(output);
+ if(i != this->OutputToSource.end())
+ {
+ cmOStringStream m;
+ m <<
+ "Attempt to add a custom command to generate\n"
+ " " << output << "\n"
+ "but source file \"" << i->second->GetLocation().GetName() <<
+ "\" already has a custom command to generate it.";
+ this->IssueMessage(cmake::AUTHOR_WARNING, m.str());
+ return;
+ }
this->OutputToSource[output] = source;
}
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 1b9c17b..e2b1cec 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -86,6 +86,7 @@ if(NOT WIN32)
endif()
add_RunCMake_test(CompatibleInterface)
+add_RunCMake_test(add_custom_command)
add_RunCMake_test(add_dependencies)
add_RunCMake_test(build_command)
add_RunCMake_test(find_package)
diff --git a/Tests/RunCMake/add_custom_command/CMakeLists.txt b/Tests/RunCMake/add_custom_command/CMakeLists.txt
new file mode 100644
index 0000000..e8db6b0
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 2.8)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/add_custom_command/DuplicateOutput-stderr.txt b/Tests/RunCMake/add_custom_command/DuplicateOutput-stderr.txt
new file mode 100644
index 0000000..6ee49ec
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/DuplicateOutput-stderr.txt
@@ -0,0 +1,9 @@
+CMake Warning \(dev\) at DuplicateOutput.cmake:6 \(add_custom_command\):
+ Attempt to add a custom command to generate
+
+ .*/Tests/RunCMake/add_custom_command/DuplicateOutput-build/out.h
+
+ but source file "out.h.in" already has a custom command to generate it.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/add_custom_command/DuplicateOutput.cmake b/Tests/RunCMake/add_custom_command/DuplicateOutput.cmake
new file mode 100644
index 0000000..7adc97c
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/DuplicateOutput.cmake
@@ -0,0 +1,9 @@
+add_custom_command(
+ OUTPUT out.h
+ COMMAND echo
+ MAIN_DEPENDENCY out.h.in
+ )
+add_custom_command(
+ OUTPUT out.h
+ COMMAND echo
+ )
diff --git a/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
new file mode 100644
index 0000000..68a281d
--- /dev/null
+++ b/Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(DuplicateOutput)
diff --git a/Tests/RunCMake/add_custom_command/out.h.in b/Tests/RunCMake/add_custom_command/out.h.in
new file mode 100644
index 0000000..e69de29
-----------------------------------------------------------------------
Summary of changes:
Source/cmMakefile.cxx | 12 ++++++++++++
Tests/RunCMake/CMakeLists.txt | 1 +
.../CMakeLists.txt | 2 +-
.../add_custom_command/DuplicateOutput-stderr.txt | 9 +++++++++
.../add_custom_command/DuplicateOutput.cmake | 9 +++++++++
.../RunCMake/add_custom_command/RunCMakeTest.cmake | 3 +++
.../RunCMake/add_custom_command/out.h.in | 0
7 files changed, 35 insertions(+), 1 deletions(-)
copy Tests/RunCMake/{Configure => add_custom_command}/CMakeLists.txt (62%)
create mode 100644 Tests/RunCMake/add_custom_command/DuplicateOutput-stderr.txt
create mode 100644 Tests/RunCMake/add_custom_command/DuplicateOutput.cmake
create mode 100644 Tests/RunCMake/add_custom_command/RunCMakeTest.cmake
copy Modules/IntelVSImplicitPath/hello.f => Tests/RunCMake/add_custom_command/out.h.in (100%)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list