Skip to content

Conversation

godbyk
Copy link

@godbyk godbyk commented Jun 25, 2017

CMake has the following end-wise pairings:

  • foreach() / endforeach()
  • function() / endfunction()
  • if() / endif()
  • macro() / endmacro()
  • while() / endwhile()

The end forms can take an optional argument, though the argument is ignored. This code leaves that argument empty.

CMake's commands are case-insensitive (e.g., function(), Function(), FUNCTION(), and fUnCtIoN() are all equivalent). This code will maintain the case of the opening command and prefix END if and only if the command is written in ALL CAPS. In all other cases (i.e., the command is written in lowercase or mixed case), end will be prefixed.

Examples:

if(SOME_CONDITION)
    # ...
endif()

Function(MyFunction)
    # ...
endFunction()

WHILE(TRUE)
    # ...
ENDWHILE()

godbyk and others added 2 commits June 25, 2017 15:12
CMake has the following end-wise pairings:

 * `foreach()` / `endforeach()`
 * `function()` / `endfunction()`
 * `if()` / `endif()`
 * `macro()` / `endmacro()`
 * `while()` / `endwhile()`

The `end` forms can take an optional argument, though the argument is ignored. This code leaves that argument empty.

CMake's commands are case-insensitive (e.g., `function()`, `Function()`, `FUNCTION()`, and `fUnCtIoN()` are all equivalent). This code will maintain the case of the opening command and prefix `END` if any only if the command is written in ALL CAPS. In all other cases (i.e., the command is written in lowercase or mixed case), `end` will be prefixed.

Examples:

```cmake
if(SOME_CONDITION)
    # ...
endif()

Function(MyFunction)
    # ...
endFunction()

WHILE(TRUE)
    # ...
ENDWHILE()
```
thetic added a commit to thetic/vim-cmake-syntax that referenced this pull request Oct 12, 2019
Derived from (seemingly dead) PR: tpope/vim-endwise#97
yous added a commit to yous/dotfiles that referenced this pull request Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant