Skip to content

Commit 3ce3de4

Browse files
committed
docs: add docstrings for functions
1 parent 6fad68e commit 3ce3de4

9 files changed

Lines changed: 21 additions & 5 deletions

src/Conan.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Run Conan for dependency management
12
macro(run_conan)
23
# Download automatically, you can also just copy the conan.cmake file
34
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")

src/DynamicProjectOptions.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
# * ENABLE_CLANG_TIDY: ON for Ninja/Makefiles
55
# * ENABLE_SANITIZER_UNDEFINED: ON for Compilers that support it
66
# * ENABLE_CPPCHECK: ON for Ninja/Makefiles
7-
7+
#
88
# For non-developer builds
99
# -DENABLE_DEVELOPER_MODE:BOOL=OFF
1010
# Is recommended
11-
11+
#
1212
# In developer mode, all features have options that show up in the CMake GUI tools
13-
13+
#
1414
# dynamic_project_options() macro enables all recommended defaults with appropriately
1515
# applied options from the GUI which are set
16-
16+
#
1717
# Any default can be overridden
1818
# set(<feature_name>_DEFAULT <value>) - set default for both user and developer modes
1919
# set(<feature_name>_DEVELOPER_DEFAULT <value>) - set default for developer mode
2020
# set(<feature_name>_USER_DEFAULT <value>) - set default for user mode
21-
21+
#
2222
macro(dynamic_project_options)
2323
option(ENABLE_DEVELOPER_MODE "Set up defaults for a developer of the project, and let developer change options" OFF)
2424
if(NOT ${ENABLE_DEVELOPER_MODE})

src/Linker.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# TODO use function arguments instead of CMake cache variables and options
2+
3+
# Set the linker to use for the linking phase
14
macro(configure_linker project_name)
25
include(CheckCXXCompilerFlag)
36

src/PackageProject.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Uses ycm (permissive BSD-3-Clause license) and ForwardArguments (permissive MIT license)
22

3+
# A function that packages the project for external usage (e.g. from vcpkg, Conan, etc).
4+
# See the [README.md] for more details
35
function(package_project)
46
cmake_policy(SET CMP0103 NEW) # disallow multiple calls with the same NAME
57

src/Standards.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Set the default copmiler standards if not specified
12
macro(set_standards)
23

34
# if the default CMAKE_CXX_STANDARD is not set, detect the latest CXX standard supported by the compiler and use it.

src/StaticAnalyzers.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Enable static analysis with Cppcheck
12
macro(enable_cppcheck CPPCHECK_OPTIONS)
23
find_program(CPPCHECK cppcheck)
34
if(CPPCHECK)
@@ -52,6 +53,7 @@ macro(enable_cppcheck CPPCHECK_OPTIONS)
5253
endif()
5354
endmacro()
5455

56+
# Enable static analysis with clang-tidy
5557
macro(enable_clang_tidy)
5658
find_program(CLANGTIDY clang-tidy)
5759
if(CLANGTIDY)
@@ -115,6 +117,7 @@ macro(enable_clang_tidy)
115117
endif()
116118
endmacro()
117119

120+
# Enable static analysis with include-what-you-use
118121
macro(enable_include_what_you_use)
119122
find_program(INCLUDE_WHAT_YOU_USE include-what-you-use)
120123
if(INCLUDE_WHAT_YOU_USE)

src/Tests.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Enable coverage reporting for gcc/clang
12
function(enable_coverage project_name)
23
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
34
target_compile_options(${project_name} INTERFACE --coverage -O0 -g)

src/Utilities.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ function(set_env_from_string env_string)
8383
endforeach()
8484
endfunction()
8585

86+
# Get all the CMake targets
8687
function(get_all_targets var)
8788
set(targets)
8889
get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR})
@@ -91,6 +92,7 @@ function(get_all_targets var)
9192
PARENT_SCOPE)
9293
endfunction()
9394

95+
# Get all the installable CMake targets
9496
function(get_all_installable_targets var)
9597
set(targets)
9698
get_all_targets(targets)
@@ -108,6 +110,7 @@ function(get_all_installable_targets var)
108110
PARENT_SCOPE)
109111
endfunction()
110112

113+
# Get all the CMake targets in the given directory
111114
macro(get_all_targets_recursive targets dir)
112115
get_property(
113116
subdirectories
@@ -124,6 +127,7 @@ macro(get_all_targets_recursive targets dir)
124127
list(APPEND ${targets} ${current_targets})
125128
endmacro()
126129

130+
# Is CMake verbose?
127131
function(is_verbose var)
128132
if("CMAKE_MESSAGE_LOG_LEVEL" STREQUAL "VERBOSE"
129133
OR "CMAKE_MESSAGE_LOG_LEVEL" STREQUAL "DEBUG"

src/Vcpkg.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
include(FetchContent)
22

3+
# Install vcpkg and vcpkg dependencies: - should be called before defining project()
34
macro(run_vcpkg)
45
# named boolean ENABLE_VCPKG_UPDATE argument
56
set(options ENABLE_VCPKG_UPDATE)

0 commit comments

Comments
 (0)