mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-31 02:39:48 -06:00
Prior to the existence of the if(DEFINED) condition, many of our Check
modules implemented the condition with a hack that takes advantage of
the auto-dereference behavior of the if() command to detect if a
variable is defined. The hack has the form:
if("${VAR} MATCHES "^${VAR}$")
where "${VAR}" is a macro argument reference. However, this does not
work when the variable named in the macro argument contains characters
that have special meaning in regular expressions, such as '+'. Run the
command
git grep -E 'if\("\$\{.*\}" MATCHES "\^\$\{.*\}\$"\)' -- Modules/Check*
to identify lines with this problem. Use if(NOT DEFINED) instead.
See the "Find Modules" section of the cmake-developer(7) manual page. For more information about how to contribute modules to CMake, see this page: http://www.cmake.org/Wiki/CMake:Module_Maintainers