Skip to content

Commit 148a910

Browse files
committed
[nfc] Add documentation to default macros
Adding documentation on the behavior of the `defaulted_option` and `defaulted_set` macros.
1 parent 9185606 commit 148a910

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Runtimes/Core/cmake/modules/DefaultSettings.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# that configuring a build for a given platform is likely to build
33
# out-of-the-box without customization. This does not mean that it is the only
44
# way that will work, or that it represents a shipping configuration.
5+
# User-specified configurations should be done through cache files or by setting
6+
# the variable with `-DSwiftCore_*` on the commandline.
57

68
set(SwiftCore_ENABLE_BACKTRACING_default OFF) # TODO: enable this by default
79
set(SwiftCore_ENABLE_COMMANDLINE_SUPPORT_default OFF) # TODO: enable this by default
@@ -10,13 +12,19 @@ set(SwiftCore_ENABLE_TYPE_PRINTING_default ON)
1012

1113
set(SwiftCore_BACKTRACER_PATH_default "")
1214

15+
# Provide a boolean option that a user can optionally enable.
16+
# Variables are defaulted based on the value of `<variable>_default`.
17+
# If no such default variable exists, the option is defaults to `OFF`.
1318
macro(defaulted_option variable helptext)
1419
if(NOT DEFINED ${variable}_default)
1520
set(${variable}_default OFF)
1621
endif()
1722
option(${variable} ${helptext} ${${variable}_default})
1823
endmacro()
1924

25+
# Create a defaulted cache entry
26+
# Entries are defaulted on the value of `<variable>_default`.
27+
# If no such default variable exists, the variable is not created.
2028
macro(defaulted_set variable type helptext)
2129
if(DEFINED ${variable}_default)
2230
set(${variable} ${variable}_default CACHE ${type} ${helptext})

0 commit comments

Comments
 (0)