CMake Multiple line comments - Block Comment
CmakeCmake Problem Overview
Is there any way to comment a block in CMake in notepad++ editor?
I have tried searching on Google, but couldn't find much.
Help is needed! Thanks,
Cmake Solutions
Solution 1 - Cmake
As of CMake 3.0 there is a special syntax for block comments which start with #[[
and ends with ]]
at the end of block comment. See CMake documentation for further explanation. Some editors and IDEs do not support it yet.
Solution 2 - Cmake
if(FALSE) # fake a block comment
endif()
Solution 3 - Cmake
Since CMake version 3.0 there are block comments.
Example from the CMake manual:
#[[This is a bracket comment.
It runs until the close bracket.]]
message("First Argument\n" #[[Bracket Comment]] "Second Argument")
Solution 4 - Cmake
There is no notion of a block comment in CMake syntax. However, to comment several lines at once, select the required lines and hit CTRL+Q.
If the file is a .txt file (e.g. CMakeLists.txt), you can either set Notepad++ to always treat .txt files as CMake files (in Settings -> Style configurator select CMakeFile and add " txt" to "User ext.") or for just that file you can set the Language to CMake.