diff options
author | Brad King <brad.king@kitware.com> | 2015-04-30 14:31:59 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-04-30 14:31:59 (GMT) |
commit | e2f72ebdbeb3bf1318aaedbf2e024c8431f3e635 (patch) | |
tree | 0d0557b9dd42741a87a9e5d7fbb66cbb3393b8b5 /Help | |
parent | e14b65cc174a4a3891e9ee86c1c85daa096b74fd (diff) | |
parent | 9535b86d3c0d0c124d8ed29a6b3cdb45c150098b (diff) | |
download | CMake-e2f72ebdbeb3bf1318aaedbf2e024c8431f3e635.zip CMake-e2f72ebdbeb3bf1318aaedbf2e024c8431f3e635.tar.gz CMake-e2f72ebdbeb3bf1318aaedbf2e024c8431f3e635.tar.bz2 |
Merge topic 'doc-CMP0054-example'
9535b86d Help: Replace CMP0054 example to show when it makes a difference
Diffstat (limited to 'Help')
-rw-r--r-- | Help/policy/CMP0054.rst | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Help/policy/CMP0054.rst b/Help/policy/CMP0054.rst index 39f0c40..3754fda 100644 --- a/Help/policy/CMP0054.rst +++ b/Help/policy/CMP0054.rst @@ -16,29 +16,33 @@ Given the following partial example: :: - set(MONKEY 1) - set(ANIMAL MONKEY) + set(A E) + set(E "") - if("${ANIMAL}" STREQUAL "MONKEY") + if("${A}" STREQUAL "") + message("Result is TRUE before CMake 3.1 or when CMP0054 is OLD") + else() + message("Result is FALSE in CMake 3.1 and above if CMP0054 is NEW") + endif() After explicit expansion of variables this gives: :: - if("MONKEY" STREQUAL "MONKEY") + if("E" STREQUAL "") With the policy set to ``OLD`` implicit expansion reduces this semantically to: :: - if("1" STREQUAL "1") + if("" STREQUAL "") With the policy set to ``NEW`` the quoted arguments will not be further dereferenced: :: - if("MONKEY" STREQUAL "MONKEY") + if("E" STREQUAL "") This policy was introduced in CMake version 3.1. CMake version |release| warns when the policy is not set and uses |