summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* Retire std::auto_ptr and its macro CM_AUTO_PTRMatthias Maennich2017-09-251-2/+4
| | | | Signed-off-by: Matthias Maennich <matthias@maennich.net>
* Meta: modernize old-fashioned loops to range-based `for`.Pavel Solodovnikov2017-09-121-21/+17
| | | | | | Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
* cmExecutionStatus: Remove arguments from settersDaniel Pfeifer2017-05-091-3/+3
| | | | | The setters are only used to set boolean values. The values are never reset individually.
* cmIfCommand: Reject duplicate else() and misplaced elseif()Gregor Jasny2017-03-221-0/+20
| | | | Closes: #14335
* Include necessary headers in commandsDaniel Pfeifer2016-10-261-7/+6
|
* Separate compilation for commands included in cmBootstrapCommands2Daniel Pfeifer2016-10-211-0/+1
|
* Simplify CMake per-source license noticesBrad King2016-09-271-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Per-source copyright/license notice headers that spell out copyright holder names and years are hard to maintain and often out-of-date or plain wrong. Precise contributor information is already maintained automatically by the version control tool. Ultimately it is the receiver of a file who is responsible for determining its licensing status, and per-source notices are merely a convenience. Therefore it is simpler and more accurate for each source to have a generic notice of the license name and references to more detailed information on copyright holders and full license terms. Our `Copyright.txt` file now contains a list of Contributors whose names appeared source-level copyright notices. It also references version control history for more precise information. Therefore we no longer need to spell out the list of Contributors in each source file notice. Replace CMake per-source copyright/license notice headers with a short description of the license and links to `Copyright.txt` and online information available from "https://cmake.org/licensing". The online URL also handles cases of modules being copied out of our source into other projects, so we can drop our notices about replacing links with full license text. Run the `Utilities/Scripts/filter-notices.bash` script to perform the majority of the replacements mechanically. Manually fix up shebang lines and trailing newlines in a few files. Manually update the notices in a few files that the script does not handle.
* Avoid else after returnDaniel Pfeifer2016-09-161-2/+1
|
* Avoid using KWSys auto_ptr by adopting it ourselvesBrad King2016-06-291-2/+1
| | | | | | | | | | | | Replace use of cmsys::auto_ptr with a CM_AUTO_PTR macro that maps to our own implementation adopted from the KWSys auto_ptr implementation. Later we may be able to map CM_AUTO_PTR to std::auto_ptr on compilers that do not warn about it. Automate the client site conversions: git grep -l auto_ptr -- Source/ | grep -v Source/kwsys/ | xargs sed -i \ 's|cmsys::auto_ptr|CM_AUTO_PTR|;s|cmsys/auto_ptr.hxx|cm_auto_ptr.hxx|'
* cmIfCommand: Don't rely on NestedError logic to issue messagesStephen Kelly2016-06-131-3/+3
|
* Revise C++ coding style using clang-formatKitware Robot2016-05-161-97/+64
| | | | | | | | | | | | | Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
* Format include directive blocks and ordering with clang-formatBrad King2016-04-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sort include directives within each block (separated by a blank line) in lexicographic order (except to prioritize `sys/types.h` first). First run `clang-format` with the config file: --- SortIncludes: false ... Commit the result temporarily. Then run `clang-format` again with: --- SortIncludes: true IncludeCategories: - Regex: 'sys/types.h' Priority: -1 ... Commit the result temporarily. Start a new branch and cherry-pick the second commit. Manually resolve conflicts to preserve indentation of re-ordered includes. This cleans up the include ordering without changing any other style. Use the following command to run `clang-format`: $ git ls-files -z -- \ '*.c' '*.cc' '*.cpp' '*.cxx' '*.h' '*.hh' '*.hpp' '*.hxx' | egrep -z -v '(Lexer|Parser|ParserHelper)\.' | egrep -z -v '^Source/cm_sha2' | egrep -z -v '^Source/(kwsys|CursesDialog/form)/' | egrep -z -v '^Utilities/(KW|cm).*/' | egrep -z -v '^Tests/Module/GenerateExportHeader' | egrep -z -v '^Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h' | xargs -0 clang-format -i This selects source files that do not come from a third-party. Inspired-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
* Source: Stabilize include orderBrad King2016-04-291-0/+1
| | | | | Each source file has a logical first include file. Include it in an isolated block so that tools that sort includes do not move them.
* cmIfCommand: Simplify execution context constructionBrad King2016-04-151-8/+2
|
* cmConditionEvaluator: Remove GetConditionContext methodBrad King2016-03-291-4/+4
| | | | | All it does is call cmListFileContext::FromCommandContext, so move this to the call sites.
* Merge topic 'fix-CMP0054-elseif-warning'Brad King2015-10-211-2/+18
|\ | | | | | | | | d6a03b47 cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)
| * cmIfCommand: Issue CMP0054 warning with appropriate context. (#15802)Stephen Kelly2015-10-201-2/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit v3.4.0-rc1~494^2~4 (cmMakefile: Add API for elseif to create backtrace., 2015-05-29) removed the use of cmMakefileCall to push/pop execution context in favor of a new way to create backtraces. However, a call to cmMakefile::GetExecutionContext is still invoked to issue a contextual CMP0054 warning through cmConditionEvaluator. As the elseif is not part of the call stack, this resulted in trying to access an empty vector. Avoid the attempt at getting execution context when evaluating elseif by constructing a context and backtrace on behalf of the cmConditionEvaluator in all cases.
* | Add cmOutputConverter include where needed.Stephen Kelly2015-10-051-0/+1
|/
* Port static calls from cmLocalGenerator to cmOutputConverter.Stephen Kelly2015-06-061-1/+1
|
* cmMakefile: Add API for elseif to create backtrace.Stephen Kelly2015-06-021-5/+2
|
* Don't use a cmLocalGenerator instance to call static methods.Stephen Kelly2015-05-141-5/+4
|
* if(): avoid one needless string compare for all if() statementsRolf Eike Beer2015-02-221-1/+1
| | | | If it's known that it is an "if" it can't be an "elseif".
* Replace foo.size() pattern with !foo.empty().Stephen Kelly2015-01-181-2/+2
|
* Replace 'foo.size() == 0' pattern with foo.empty().Stephen Kelly2015-01-181-1/+1
|
* continue: Add a new CMake language command for loop continuation (#14013)Gregor Jasny2014-12-011-0/+5
| | | | | Inspired-by: Doug Barbieri Signed-off-by: Gregor Jasny <gjasny@googlemail.com>
* If: Introduce policy CMP0054 - don't dereference quoted variables in if()Nils Gladitz2014-09-111-5/+5
|
* If: Extract cmConditionEvaluator from if() implementationNils Gladitz2014-09-111-701/+12
|
* ClearMatches: Only clear matches which were actually setBen Boeckel2014-04-291-2/+2
| | | | | | | ClearMatches was clearing many variables which were never set in the first place. Instead, store how many matches were made last time and only clear those. It is moved to the cmMakefile class since it is a common utility used by multiple commands.
* Remove some c_str() calls.Stephen Kelly2014-03-111-6/+6
| | | | | | Use the clang RemoveCStrCalls tool to automatically migrate the code. This was only run on linux, so does not have any positive or negative effect on other platforms.
* stringapi: Use strings for variable namesBen Boeckel2014-03-081-9/+9
| | | | Variable names are always generated by CMake and should never be NULL.
* cmMakefile: make some methods take const std::string& instead of const char*Rolf Eike Beer2014-01-161-1/+1
| | | | | | | | Most callers already have a std::string, on which they called c_str() to pass it into these methods, which internally converted it back to std::string. Pass a std::string directly to these methods now, avoiding all these conversions. Those methods that only pass in a const char* will get the conversion to std::string now only once.
* De-duplicate version comparison code.Stephen Kelly2013-06-121-36/+4
| | | | | Extend the VersionCompare in cmSystemTools to handle 8 components, and port the if command to use that.
* if: Compare up to 8 components in VERSION testsBrad King2012-09-111-6/+10
| | | | | | | | | | Extend the number of components tested by if(... VERSION_LESS ...) if(... VERSION_EQUAL ...) if(... VERSION_GREATER ...) from 4 to 8. The latter is a more extreme maximum.
* Print any evaluated 'elseif'/'else' commands in trace mode (#13220)Brian Helba2012-05-161-0/+13
| | | | | | In trace mode ('--trace'), any 'elseif' or 'else' commands that are evaluated as part of a conditional block will be printed. Previously, only the opening 'if' command of a conditional block was printed.
* fix uninitialized var in if(NOT foo bar STREQUAL "foo bar")Rolf Eike Beer2012-01-221-0/+1
| | | | Also adds test to verify this.
* Remove unreachable code in cmIfCommandBrad King2009-10-281-1/+0
| | | | | The commit "Fix if() command and CMP0012 OLD/NEW behavior" introduced an unreachable 'break' after 'return' in a switch statement. We remove it.
* Fix if() command and CMP0012 OLD/NEW behaviorBrad King2009-10-271-73/+93
| | | | | | | | | | | | | | The commit "modified the if command to address bug 9123 some" changed the if() command behavior with respect to named boolean constants. It introduced policy CMP0012 to provide compatibility. However, it also changed behavior with respect to numbers (like '2') but did not cover the change with the policy. Also, the behavior it created for numbers is confusing ('2' is false). This commit teaches if() to recognize numbers again, and treats them like the C language does in terms of boolean conversion. We also fix the CMP0012 check to trigger in all cases where the result of boolean coersion differs from that produced by CMake 2.6.4.
* Report expanded arguments in if() command errorsBrad King2009-10-271-20/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The if() command reports its arguments at the beginning of some error messages. Originally it reported the un-expanded form of the arguments because in ancient CMake versions no context information was available. Now it is more useful to see the real arguments, which may be mentioned in the main error message. Since full context information is now available, users can refer back to the source if they need to see the unexpanded form of the arguments. For example, the code set(regex "++") if("x" MATCHES "${regex}") endif() now produces the message if given arguments: "x" "MATCHES" "++" Regular expression "++" cannot compile instead of if given arguments "x" MATCHES "${regex}" Regular expression "++" cannot compile
* Add IS_SYMLINK test to if commandBrad King2009-10-211-0/+7
|
* Clarify documentation and message for CMP0012Brad King2009-10-021-6/+4
| | | | | | | This commit re-words the warning message produced for CMP0012 to avoid the word 'you' since often the person reading the message is not the author of the code. We also add an example of the bad OLD behavior to the policy documentation.
* Convert CMake to OSI-approved BSD LicenseBrad King2009-09-281-14/+9
| | | | | | | This converts the CMake license to a pure 3-clause OSI-approved BSD License. We drop the previous license clause requiring modified versions to be plainly marked. We also update the CMake copyright to cover the full development time range.
* ENH: Improve format of if() command messagesBrad King2009-06-171-6/+4
| | | | | | | Errors and warnings from the if() command always display the argument list given to the command followed by an explanation of the problem. This moves the argument list into a pre-formatted block and follows it with a paragraph-form explanation. The result looks cleaner.
* ENH: warning fixKen Martin2009-06-121-4/+4
|
* ENH: modified the if command to address bug 9123 someKen Martin2009-06-121-111/+233
|
* ENH: Better handling of mismatched blocksBrad King2009-01-211-1/+2
| | | | | | | | | | | | | | | | If a logical block terminates with mismatching arguments we previously failed to remove the function blocker but replayed the commands anyway, which led to cases in which we failed to report the mismatch (return shortly after the ending command). The recent refactoring of function blocker deletion changed this behavior to produce an error on the ending line by not blocking the command. Furthermore, the function blocker would stay in place and complain at the end of every equal-level block of the same type. This teaches CMake to treat the begin/end commands (if/endif, etc.) as correct and just warns when the arguments mismatch. The change allows cases in which CMake 2.6.2 silently ignored a mismatch to run as before but with a warning.
* ENH: Better error message for unclosed blocksBrad King2009-01-211-18/+0
| | | | | | This centralizes construction of the error message for an unclosed logical block (if, foreach, etc.). We record the line at which each block is opened so it can be reported in the error message.
* ENH: Refactor function blocker deletionBrad King2009-01-201-12/+4
| | | | | | | | | When a function blocker decides to remove itself we previously removed it at every return point from the C++ scope in which its removal is needed. This teaches function blockers to transfer ownership of themselves from cmMakefile to an automatic variable for deletion on return. Since this removes blockers before they replay their commands, we no longer need to avoid running blockers on their own commands.
* ENH: Improve response to bad if or elseifBrad King2009-01-201-2/+9
| | | | | | | Previously bad arguments to an if() or elseif() would cause some subsequent statements in the corresponding block to execute. This teaches CMake to stop processing commands with a fatal error. It also provides context to bad elseif() error messages.
* STYLE: fix line length stuff for KWStyleBill Hoffman2008-10-011-1/+2
|
* ENH: Add version comparison to if() commandBrad King2008-09-101-0/+48
| | | | | | Provide VERSION_LESS, VERSION_EQUAL, and VERSION_GREATER operators in the if() command. This simplifies component-wise comparison of version numbers in the form "major[.minor[.patch[.tweak]]]".