/src/CMake/Source/cmBreakCommand.cxx
Line | Count | Source |
1 | | /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying |
2 | | file LICENSE.rst or https://cmake.org/licensing for details. */ |
3 | | #include "cmBreakCommand.h" |
4 | | |
5 | | #include "cmExecutionStatus.h" |
6 | | #include "cmMakefile.h" |
7 | | #include "cmMessageType.h" |
8 | | |
9 | | // cmBreakCommand |
10 | | bool cmBreakCommand(std::vector<std::string> const& args, |
11 | | cmExecutionStatus& status) |
12 | 0 | { |
13 | 0 | if (!status.GetMakefile().IsLoopBlock()) { |
14 | 0 | status.GetMakefile().IssueMessage( |
15 | 0 | MessageType::FATAL_ERROR, |
16 | 0 | "A BREAK command was found outside of a proper " |
17 | 0 | "FOREACH or WHILE loop scope."); |
18 | 0 | return false; |
19 | 0 | } |
20 | | |
21 | 0 | status.SetBreakInvoked(); |
22 | |
|
23 | 0 | if (!args.empty()) { |
24 | 0 | status.GetMakefile().IssueMessage( |
25 | 0 | MessageType::FATAL_ERROR, |
26 | 0 | "The BREAK command does not accept any arguments."); |
27 | 0 | return false; |
28 | 0 | } |
29 | | |
30 | 0 | return true; |
31 | 0 | } |