[cmake-developers] [PATCH] Help: Fix elseif/endif contradictions
Juuso Linda Lapinlampi
linda at lindalap.fi
Mon Feb 11 14:06:02 EST 2019
From: "Juuso \"Linda\" Lapinlampi" <linda at lindalap.fi>
In CMake 3.13.x, we had this evaluation for if() conditions:
if(a) elseif(b) else(a) endif(a)
Since CMake 3.14.0-rc1 (commit c2efb3efcd083523a73a2a9721b7101fbfc0fe0f
specifically), the sensible intention was:
> "endif", "endfunction" etc: Explain that the argument is optional and
> maintained for compatibility only
Instead of "endif", it ended up being written to the documentation as
"elseif" by the commit author (oops) to if()'s page.
if(a) elseif(a!?) else() endif(a?)
Truthfully, endif()'s parameter should be an optional verbatim repeat
and not elseif()'s. If it wasn't, elseif() would be described to be the
same as if(). The rightful intended description is:
if(a) elseif(b) else() endif()
This commit fixes that error.
---
Help/command/if.rst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Help/command/if.rst b/Help/command/if.rst
index a682c83b1a..a48a0faac6 100644
--- a/Help/command/if.rst
+++ b/Help/command/if.rst
@@ -23,7 +23,7 @@ Otherwise, optional ``elseif`` blocks are processed in the same way.
Finally, if no ``condition`` is true, ``commands`` in the optional ``else``
block are executed.
-Per legacy, the :command:`else` and :command:`elseif` commands admit
+Per legacy, the :command:`else` and :command:`endif` commands admit
an optional ``<condition>`` argument.
If used, it must be a verbatim
repeat of the argument of the opening
--
2.20.1
More information about the cmake-developers
mailing list