summaryrefslogtreecommitdiffstats
path: root/Source/cmIfCommand.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2009-10-27 13:07:39 (GMT)
committerBrad King <brad.king@kitware.com>2009-10-27 13:07:39 (GMT)
commitcb185d93d29d27eaafd321f657f4ba12d9beaeb8 (patch)
treecaba9c82f1ce3f68a16a577dfff0deb4eda7506a /Source/cmIfCommand.h
parent9f43fa602d53d131adffd1a3bb8188b549a96a01 (diff)
downloadCMake-cb185d93d29d27eaafd321f657f4ba12d9beaeb8.zip
CMake-cb185d93d29d27eaafd321f657f4ba12d9beaeb8.tar.gz
CMake-cb185d93d29d27eaafd321f657f4ba12d9beaeb8.tar.bz2
Fix if() command and CMP0012 OLD/NEW behavior
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.
Diffstat (limited to 'Source/cmIfCommand.h')
-rw-r--r--Source/cmIfCommand.h28
1 files changed, 18 insertions, 10 deletions
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index f480220..107a892 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -121,16 +121,24 @@ public:
"Then any EQUAL, LESS, GREATER, STRLESS, STRGREATER, STREQUAL, MATCHES "
"will be evaluated. Then NOT operators and finally AND, OR operators "
"will be evaluated. Possible expressions are:\n"
- " if(variable)\n"
- "True if the variable's value is not empty, 0, N, NO, OFF, FALSE, "
- "NOTFOUND, or <variable>-NOTFOUND.\n"
- " if(NOT variable)\n"
- "True if the variable's value is empty, 0, N, NO, OFF, FALSE, "
- "NOTFOUND, or <variable>-NOTFOUND.\n"
- " if(variable1 AND variable2)\n"
- "True if both variables would be considered true individually.\n"
- " if(variable1 OR variable2)\n"
- "True if either variable would be considered true individually.\n"
+ " if(<constant>)\n"
+ "True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. "
+ "False if the constant is 0, OFF, NO, FALSE, N, IGNORE, \"\", "
+ "or ends in the suffix '-NOTFOUND'. "
+ "Named boolean constants are case-insensitive."
+ "\n"
+ " if(<variable>)\n"
+ "True if the variable's value is not a false constant."
+ "\n"
+ " if(NOT <expression>)\n"
+ "True if the expression is not true."
+ "\n"
+ " if(<expr1> AND <expr2>)\n"
+ "True if both expressions would be considered true individually."
+ "\n"
+ " if(<expr1> OR <expr2>)\n"
+ "True if either expression would be considered true individually."
+ "\n"
" if(COMMAND command-name)\n"
"True if the given name is a command, macro or function that can be "
"invoked.\n"