Is there any shortcut or something like this to add, e.g. documentation of a function or class (similar to "///"
in Visual Studio and C#)?
Thanks!
You can use /** <Enter>
.
I have found a way to do it. I personally use Doxygen for documentation.
CLion plans to integrate it.
You have to write all of it at this time. But when you have documented your code, you can build it with CMake (and then it appears in your build target on CLion).
Here's an example:
cmake_minimum_required(VERSION 3.2)
project(doxygen_test)
find_package(Doxygen)
set(SOURCE_FILES main.cc)
if(DOXYGEN_FOUND)
set(DOXYGEN_INPUT ${SOURCE_FILES})
set(DOXYGEN_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_command(
OUTPUT ${DOXYGEN_OUTPUT}
COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${DOXYGEN_INPUT}
)
add_custom_target(apidoc ALL DEPENDS ${DOXYGEN_OUTPUT})
add_custom_target(apidoc_forced
COMMAND ${CMAKE_COMMAND} -E echo_append "Building API Documentation..."
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_INPUT}
COMMAND ${CMAKE_COMMAND} -E echo "Done."
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif(DOXYGEN_FOUND)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_executable(doxygen_test ${SOURCE_FILES})
Sources:
Starting from 2016.2 EAP CLion supports Doxygen (http://blog.jetbrains.com/clion/2016/05/keep-your-code-documented/). Start with typing “/**” or “/*!” and then press Enter. In case your function has parameters, returns a value or throws an exception, you’ll get a stub to fill with the documentation text
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With