View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0009123 | CMake | CMake | public | 2009-06-08 23:43 | 2010-12-14 18:49 | ||||
Reporter | Paul Oppenheim (Poppy Linden) | ||||||||
Assigned To | Ken Martin | ||||||||
Priority | normal | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake-2-6 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0009123: Conditionals do not behave as expected from documentation (IF, ENDIF, ELSE) | ||||||||
Description | Certain conditional statements that the documentation says should be evaluated as true are not. | ||||||||
Additional Information | NOTE: I could just be "doin it wrong" because this seems too big to be unnoticed. http://cmake.org/cmake/help/cmake2.6docs.html#command:if [^] """ if(variable) True if the variable's value is not empty, 0, N, NO, OFF, FALSE, NOTFOUND, or <variable>-NOTFOUND. """ So these should evaluate to true, but do not (assume SET(parent sometarget) ) if (parent) if (TRUE) if (DEFINED parent) This works: if (1) Not sure if this is relevant, but I'm talking about code inside a macro. Here is the conditional I'm talking about (modified for the several examples listed) http://svn.secondlife.com/trac/linden/browser/trunk/indra/cmake/LLAddBuildTest.cmake?rev=2022 [^] See Line 114 - that won't work as written (it's an improper dereference) but should work as if(parent) but doesn't. If I get rid of the conditional the dep is setup correctly. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | ||||||
|
Relationships |
Notes | |
(0016669) Brad King (manager) 2009-06-09 11:45 |
The documentation of macro(): http://www.cmake.org/cmake/help/cmake2.6docs.html#command:macro [^] states that its arguments are not real variables. They are placeholders such that "${arg}" is replaced before evaluation. The if() command says it works with variables. As far as macro() is concerned, the argument "parent" is just a string and is not replaced. |
(0016674) Paul Oppenheim (Poppy Linden) (reporter) 2009-06-09 15:01 |
Right, but if that's the case, then if(1) shouldn't evaluate to true. So which behavior is correct? Consts are evaluated or not? Only numeric constants? Only numeric consts on a monday? |
(0016675) Brad King (manager) 2009-06-09 15:07 |
Ken, can you document in if() how it treats constants, please? Poppy, this is left from VERY early days in CMake when there was no variable dereference syntax (${var}). The if command magically expands variable that are defined when they are specified by name. |
(0016723) Ken Martin (developer) 2009-06-15 12:51 |
Updated the logic of the if command so that variables passed in behave more consistently. Specifically statements like "if (foo)" and "if (${foo})" will resolve to the same result, in the past they did not always do so. Added policy CMP0012 for this as in some very rare case it could change behavior. Also updated the documentation on the if statement to be a bit clearer on how it treats arguments and what constants work. Now for example "if (true)" will evaluate to true. In the original example above "if (parent)" and "if (DEFINED parent)" would still evaluate to false as parent is a macro definition not a variable. The same two statement inside of a function (as opposed to a macro) would work fine. |
(0024097) David Cole (manager) 2010-12-14 18:49 |
Closing bugs that have been resolved for more than 3 months without any further updates. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2009-06-08 23:43 | Paul Oppenheim (Poppy Linden) | New Issue | |
2009-06-09 11:37 | Bill Hoffman | Status | new => assigned |
2009-06-09 11:37 | Bill Hoffman | Assigned To | => Brad King |
2009-06-09 11:45 | Brad King | Note Added: 0016669 | |
2009-06-09 11:45 | Brad King | Status | assigned => closed |
2009-06-09 11:45 | Brad King | Resolution | open => no change required |
2009-06-09 15:01 | Paul Oppenheim (Poppy Linden) | Note Added: 0016674 | |
2009-06-09 15:01 | Paul Oppenheim (Poppy Linden) | Status | closed => feedback |
2009-06-09 15:01 | Paul Oppenheim (Poppy Linden) | Resolution | no change required => reopened |
2009-06-09 15:05 | Brad King | Status | feedback => assigned |
2009-06-09 15:05 | Brad King | Assigned To | Brad King => Ken Martin |
2009-06-09 15:07 | Brad King | Note Added: 0016675 | |
2009-06-15 12:51 | Ken Martin | Note Added: 0016723 | |
2009-06-15 12:51 | Ken Martin | Status | assigned => resolved |
2009-06-15 12:51 | Ken Martin | Resolution | reopened => fixed |
2010-12-14 18:49 | David Cole | Note Added: 0024097 | |
2010-12-14 18:49 | David Cole | Status | resolved => closed |
2011-01-14 17:35 | Brad King | Relationship added | related to 0010773 |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |