summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/if
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Factor out RunCMake helper to get UNIX user idBrad King2023-11-301-12/+3
|
* Tests: Avoid leaving behind non-readable directoriesBrad King2023-11-291-0/+24
| | | | | | | | Since commit 337bc5662c (if(): add operators IS_READABLE, IS_WRITABLE and IS_EXECUTABLE., 2023-10-21) we create some non-readable directories. CMake 3.28 and below do not know how to delete them, so some nightly builds fail ctest_empty_binary_directory. Add read permission to those directories when we are finished with them.
* Tests: Avoid creating world-writable pathsBrad King2023-11-291-2/+2
| | | | | | These were added by commit 337bc5662c (if(): add operators IS_READABLE, IS_WRITABLE and IS_EXECUTABLE., 2023-10-21) but are not actually necessary.
* Tests: Fix directory removal in RunCMake.if testBrad King2023-11-291-3/+5
|
* if(): add operators IS_READABLE, IS_WRITABLE and IS_EXECUTABLE.Marc Chevrier2023-11-012-0/+170
| | | | Offers possibility to check for file or directory permissions.
* Tests/RunCMake: Update cmake_minimum_required versionsBrad King2023-02-111-1/+1
| | | | | | | | For policy-specific tests, use the version before the policy was introduced. Otherwise, use 3.5 where possible. Also, remove `cmake_minimum_required()` and `project()` calls from individual cases where they are handled by `CMakeLists.txt`.
* Help: Document behavior of if(EXISTS,IS_DIRECTORY) for empty pathsscivision2023-01-243-0/+7
| | | | | | | | | | Document and add explicit tests for empty string input: `if(EXISTS "")` and `if(IS_DIRECTORY "")` are always false. This avoids need for users to do extra checks due to CMake non-short-circuit logic as below: if("${p}") if(EXISTS "${p}")
* Merge topic 'while-bug-compatibility'Brad King2022-03-042-8/+5
|\ | | | | | | | | | | | | | | | | da2361ffb3 while: Restore tolerance of condition error 47d197745a Tests: Simplify RunCMake.{if,while} unbalanced parenthesis cases Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7041
| * Tests: Simplify RunCMake.{if,while} unbalanced parenthesis casesBrad King2022-03-032-8/+5
| |
* | Help: Clarify precedence of AND and OR in 'if' conditionsBrad King2022-02-093-0/+9
|/ | | | | | | | | | | | The wording update in commit b74819e4fe (Help: Format 'if' command documentation, 2013-12-18, v3.0.0-rc1~227^2~1) incorrectly implied that `AND` has higher precedence than `OR`. Although this is common in many languages, it has never been true in CMake's implementation. Revise the wording to clarify the precedence. Add a test case demonstrating the order. Fixes: #23207
* Fix: Regression in the `cmConditionEvaluator::HandleLevel0`Alex Turbov2021-08-094-0/+19
| | | | | | | | As reported in the BUG #22524, mismatched parenthesis reported differently for `while()` and `if()`. The problem was in the double loop (over "handlers" and the arguments), where the outer loop didn't check the result of the running handler.
* Refactor: Introduce `cmArgumentList` container classAlex Turbov2021-08-036-0/+53
| | | | | | | | | | | | | | | | | The `cmArgumentList` has been turned into a class (forward declared in the header). It inherits from the `std::list` (yeah, but we don't intend to store polymorphic classes in it). In addition to the standard methods, now it's possible to move `HandlePredicate` (renamed to `ReduceOneArg`) and `HandleBinaryOp` (renamed to `ReduceTwoArgs`) as its members. Additionally, iterators managements (`IncrementArguments`) have been refactored into two separate classes mimicking iterators. This also allows having a uniform `for` loop and concentrates the logic of iterators advancing in it instead of the loop's body. The arguments processing algorithms operate with "windows" over a collection of arguments. Hence there are two kinds of "iteration windows" -- allowing to observe 2 or 3 elements per loop iteration. These iteration "windows" also passed to reducers.
* cmListFileCache: Enforce proper nesting of flow control statementsKyle Edwards2020-10-224-12/+12
| | | | Fixes: #19153
* Tests/RunCMake: Update cmake_minimum_required versionsBrad King2020-06-181-1/+1
| | | | Use 3.3 or 2.8.12 where possible.
* cmIfCommand: Reject duplicate else() and misplaced elseif()Gregor Jasny2017-03-2213-0/+44
| | | | Closes: #14335
* Use string(APPEND) in TestsDaniel Pfeifer2016-07-271-1/+1
| | | | | | | Automate with: find Tests -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
* cmConditionEvaluator: Fix matching of `CMAKE_MATCH_*` values (#15944)Brad King2016-02-012-0/+6
| | | | | | | | | | | While evaluating `if(MATCHES)` we get a `const char*` pointer to the string to be matched. On code like if(CMAKE_MATCH_COUNT MATCHES "Y") the string to be matched may be owned by our own result variables. We must move the value to our own buffer before clearing them. Otherwise we risk reading freed storage.
* if: Add "TEST <test>" conditionMatt McCormick2015-08-035-0/+18
| | | | | | | | if(TEST TestNameThatExists) will return true if a test with the name TestNameThatExists has been added with add_test. The syntax is similar to if(TARGET TargetName). Since use of "TEST" as an argument to if() could previously be interpreted as a non-keyword argument, add policy CMP0064 to treat it as a keyword as NEW behavior.
* Tests: Move command failure cases into RunCMake infrastructureBrad King2015-07-144-0/+12
| | | | | | | Move failure cases from the CMake.{If,List,While,GetProperty} tests over to the RunCMake.{if,list,while,get_property} tests to use the more modern infrastructure. This also avoids using REGEX_ESCAPE_STRING to try to regex-match full paths.
* if(): Test the effect of cmMakefileCall use in elseif() handling.Stephen Kelly2015-05-184-0/+14
|
* Cygwin: Avoid legacy warnings in RunCMake.* testsBrad King2013-08-131-1/+1
| | | | | | Set the minimum required version of CMake high enough to avoid the warning for CMAKE_LEGACY_CYGWIN_WIN32. The warning appears on stderr and breaks the expected output matching.
* if: Add test for IS_DIRECTORYBrad King2013-05-286-0/+24
Add a RunCMake.if test to cover if() command behavior. Start with a test for IS_DIRECTORY cases with an existing directory and a long path, both with a trailing slash.