diff options
author | Alex Turbov <i.zaufi@gmail.com> | 2024-07-06 06:55:02 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-07-18 14:29:47 (GMT) |
commit | 0a0a826b862c320c0af11a55e8fa05b0c393a9aa (patch) | |
tree | 6cc2a988733350de0bc5259c08af00bfd53e467f /Source/cmMakefile.cxx | |
parent | e0294fa310c33da6a072df12a2127b489cd3e1c6 (diff) | |
download | CMake-0a0a826b862c320c0af11a55e8fa05b0c393a9aa.zip CMake-0a0a826b862c320c0af11a55e8fa05b0c393a9aa.tar.gz CMake-0a0a826b862c320c0af11a55e8fa05b0c393a9aa.tar.bz2 |
cmMakefile: Use find_if instead of manual loop
...in the `cmMakefile::ValidateCustomCommand()` as it was a warning
issued by `clang-tidy`.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7c472d3..d496d36 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1131,15 +1131,17 @@ bool cmMakefile::ValidateCustomCommand( const cmCustomCommandLines& commandLines) const { // TODO: More strict? - for (cmCustomCommandLine const& cl : commandLines) { - if (!cl.empty() && !cl[0].empty() && cl[0][0] == '"') { - this->IssueMessage( - MessageType::FATAL_ERROR, - cmStrCat("COMMAND may not contain literal quotes:\n ", cl[0], '\n')); - return false; - } + const auto it = + std::find_if(commandLines.begin(), commandLines.end(), + [](const cmCustomCommandLine& cl) { + return !cl.empty() && !cl[0].empty() && cl[0][0] == '"'; + }); + if (it != commandLines.end()) { + this->IssueMessage( + MessageType::FATAL_ERROR, + cmStrCat("COMMAND may not contain literal quotes:\n ", (*it)[0], '\n')); + return false; } - return true; } |