[Cmake-commits] CMake branch, next, updated. v3.6.1-1767-g40cbdc2
Brad King
brad.king at kitware.com
Mon Sep 5 09:11:41 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 40cbdc24ce4fa2171ed001ccb09e4ddbe6689909 (commit)
via f6fd0abc5bbfa7d677cd090ba8e2894d96afdde8 (commit)
via f6428725bb0ae7e64866e3eca16a5ad8f007f916 (commit)
from 083f1806004094f87741ba58655d7536dc05aa1d (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=40cbdc24ce4fa2171ed001ccb09e4ddbe6689909
commit 40cbdc24ce4fa2171ed001ccb09e4ddbe6689909
Merge: 083f180 f6fd0ab
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 5 09:11:40 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Sep 5 09:11:40 2016 -0400
Merge topic 'genex-LINK_ONLY-not-linking' into next
f6fd0abc Genex: Diagnose invalid LINK_ONLY usage instead of crashing
f6428725 CMake Nightly Date Stamp
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f6fd0abc5bbfa7d677cd090ba8e2894d96afdde8
commit f6fd0abc5bbfa7d677cd090ba8e2894d96afdde8
Author: Brad King <brad.king at kitware.com>
AuthorDate: Mon Sep 5 09:04:30 2016 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 5 09:06:00 2016 -0400
Genex: Diagnose invalid LINK_ONLY usage instead of crashing
When `$<LINK_ONLY:...>` is used outside of linking we may evaluate it
without a `dagChecker`. Do not dereference the NULL pointer and issue a
diagnostic instead.
Closes: #16287
diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx
index 44e9ce1..c19a741 100644
--- a/Source/cmGeneratorExpressionNode.cxx
+++ b/Source/cmGeneratorExpressionNode.cxx
@@ -672,15 +672,20 @@ static const struct LinkOnlyNode : public cmGeneratorExpressionNode
LinkOnlyNode() {}
std::string Evaluate(const std::vector<std::string>& parameters,
- cmGeneratorExpressionContext* /*context*/,
- const GeneratorExpressionContent* /*content*/,
+ cmGeneratorExpressionContext* context,
+ const GeneratorExpressionContent* content,
cmGeneratorExpressionDAGChecker* dagChecker) const
CM_OVERRIDE
{
+ if (!dagChecker) {
+ reportError(context, content->GetOriginalExpression(),
+ "$<LINK_ONLY:...> may only be used for linking");
+ return std::string();
+ }
if (!dagChecker->GetTransitivePropertiesOnly()) {
return parameters.front();
}
- return "";
+ return std::string();
}
} linkOnlyNode;
diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt
new file mode 100644
index 0000000..cded130
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt
@@ -0,0 +1,8 @@
+CMake Error at LINK_ONLY-not-linking.cmake:1 \(add_custom_target\):
+ Error evaluating generator expression:
+
+ \$<LINK_ONLY:something>
+
+ \$<LINK_ONLY:...> may only be used for linking
+Call Stack \(most recent call first\):
+ CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake
new file mode 100644
index 0000000..16db0a2
--- /dev/null
+++ b/Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake
@@ -0,0 +1 @@
+add_custom_target(Custom ALL COMMAND ${CMAKE_COMMAND} -E echo $<LINK_ONLY:something>)
diff --git a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
index 625bab2..f5584d5 100644
--- a/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
+++ b/Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake
@@ -29,6 +29,7 @@ run_cmake(COMPILE_LANGUAGE-unknown-lang)
run_cmake(TARGET_FILE-recursion)
run_cmake(OUTPUT_NAME-recursion)
run_cmake(TARGET_PROPERTY-LOCATION)
+run_cmake(LINK_ONLY-not-linking)
run_cmake(ImportedTarget-TARGET_PDB_FILE)
if(LINKER_SUPPORTS_PDB)
-----------------------------------------------------------------------
Summary of changes:
Source/CMakeVersion.cmake | 2 +-
Source/cmGeneratorExpressionNode.cxx | 11 ++++++++---
.../LINK_ONLY-not-linking-result.txt} | 0
.../GeneratorExpression/LINK_ONLY-not-linking-stderr.txt | 8 ++++++++
.../GeneratorExpression/LINK_ONLY-not-linking.cmake | 1 +
Tests/RunCMake/GeneratorExpression/RunCMakeTest.cmake | 1 +
6 files changed, 19 insertions(+), 4 deletions(-)
copy Tests/RunCMake/{Android/BadSYSROOT-result.txt => GeneratorExpression/LINK_ONLY-not-linking-result.txt} (100%)
create mode 100644 Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking-stderr.txt
create mode 100644 Tests/RunCMake/GeneratorExpression/LINK_ONLY-not-linking.cmake
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list