CMP0012.rst 1.3 KB

1234567891011121314151617181920212223242526272829
  1. CMP0012
  2. -------
  3. .. |REMOVED_IN_CMAKE_VERSION| replace:: 4.0
  4. .. include:: REMOVED_PROLOGUE.txt
  5. :command:`if` recognizes numbers and boolean constants.
  6. In CMake versions 2.6.4 and lower the :command:`if` command implicitly
  7. dereferenced arguments corresponding to variables, even those named
  8. like numbers or boolean constants, except for ``0`` and ``1``. Numbers and
  9. boolean constants such as ``true``, ``false``, ``yes``, ``no``, ``on``,
  10. ``off``, ``y``, ``n``, ``notfound``, ``ignore`` (all case insensitive)
  11. were recognized in some cases but not all. For example, the code ``if(TRUE)``
  12. might have evaluated as ``false``.
  13. Numbers such as 2 were recognized only in boolean expressions
  14. like ``if(NOT 2)`` (leading to ``false``) but not as a single-argument like
  15. ``if(2)`` (also leading to ``false``). Later versions of CMake prefer to
  16. treat numbers and boolean constants literally, so they should not be
  17. used as variable names.
  18. The ``OLD`` behavior for this policy is to implicitly dereference
  19. variables named like numbers and boolean constants. The ``NEW`` behavior
  20. for this policy is to recognize numbers and boolean constants without
  21. dereferencing variables with such names.
  22. .. |INTRODUCED_IN_CMAKE_VERSION| replace:: 2.8.0
  23. .. |WARNED_OR_DID_NOT_WARN| replace:: warned
  24. .. include:: REMOVED_EPILOGUE.txt