diff options
author | Stephen Kelly <steveire@gmail.com> | 2016-06-12 16:38:33 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2016-06-12 16:38:33 (GMT) |
commit | 0a4af0735f2aeec74a723dd6af31db585f1b664e (patch) | |
tree | bf4ab5b590350d3f2203de3b797897ffb37b6596 /Tests | |
parent | d6e99fa8345f07a72308b8b33f4a31aa7fe9a0fd (diff) | |
download | CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.zip CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.tar.gz CMake-0a4af0735f2aeec74a723dd6af31db585f1b664e.tar.bz2 |
cmake: Issue message independent of cmMakefile definition
The makefile is only used when called by the cmMessageCommand, so inline
the use of it there. It otherwise creates an undesirable dependency on
cmMakefile for issuing messages in the cmake instance, a violation of
the Interface Segregation Principle.
https://en.wikipedia.org/wiki/Interface_segregation_principle
This also makes it more explicit that the variable definitions only
affect the message() command. If an AUTHOR_WARNING is issued for any
other reason, it is not affected. To affect that, it is necessary to
set the cache variable instead of the regular variable.
This is an unfortunate interface quirk, but one which can't be fixed
easily now.
Diffstat (limited to 'Tests')
5 files changed, 25 insertions, 0 deletions
diff --git a/Tests/RunCMake/message/RunCMakeTest.cmake b/Tests/RunCMake/message/RunCMakeTest.cmake index 9489693..2346c86 100644 --- a/Tests/RunCMake/message/RunCMakeTest.cmake +++ b/Tests/RunCMake/message/RunCMakeTest.cmake @@ -2,6 +2,8 @@ include(RunCMake) run_cmake(defaultmessage) run_cmake(nomessage) +run_cmake(message-internal-warning) +run_cmake(nomessage-internal-warning) run_cmake(warnmessage) # message command sets fatal occurred flag, so check each type of error diff --git a/Tests/RunCMake/message/message-internal-warning-stderr.txt b/Tests/RunCMake/message/message-internal-warning-stderr.txt new file mode 100644 index 0000000..25946e9 --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning-stderr.txt @@ -0,0 +1,13 @@ +^CMake Warning \(dev\) in message-internal-warning.cmake: + A logical block opening on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:4 \(macro\) + + closes on the line + + .*Tests/RunCMake/message/message-internal-warning.cmake:5 \(endmacro\) + + with mis-matching arguments. +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/message/message-internal-warning.cmake b/Tests/RunCMake/message/message-internal-warning.cmake new file mode 100644 index 0000000..33993c7 --- /dev/null +++ b/Tests/RunCMake/message/message-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON) + +macro(mymacro) +endmacro(notmymacro) diff --git a/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt b/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-internal-warning-stderr.txt diff --git a/Tests/RunCMake/message/nomessage-internal-warning.cmake b/Tests/RunCMake/message/nomessage-internal-warning.cmake new file mode 100644 index 0000000..3ec2e28 --- /dev/null +++ b/Tests/RunCMake/message/nomessage-internal-warning.cmake @@ -0,0 +1,5 @@ + +set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS ON CACHE BOOL "") + +macro(mymacro) +endmacro(notmymacro) |