|
1 | 1 | include(CMakePackageConfigHelpers) |
2 | 2 |
|
3 | | -# Checks that each argument name is defined and non-empty. Requires a prior call to |
4 | | -# `cmake_parse_arguments` with `ARG` as the prefix to access the values of the arguments in |
5 | | -# `REQUIRED_ARG_NAMES`. |
| 3 | +# Checks that each argument name in `REQUIRED_ARG_NAMES` is defined and non-empty. Assumes the |
| 4 | +# arguments are stored in variables prefixed with `ARG_<NAME>`. |
6 | 5 | # |
7 | 6 | # @param {string[]} REQUIRED_ARG_NAMES |
8 | 7 | macro(require_argument_values REQUIRED_ARG_NAMES) |
9 | 8 | set(_REQUIRED_ARGS "${REQUIRED_ARG_NAMES}") |
10 | 9 | foreach(_REQUIRED_ARG IN LISTS _REQUIRED_ARGS) |
11 | 10 | if(NOT DEFINED ARG_${_REQUIRED_ARG} OR ARG_${_REQUIRED_ARG} STREQUAL "") |
12 | | - message(FATAL_ERROR "Non-empty value for argument: '${_REQUIRED_ARG}'") |
| 11 | + message(FATAL_ERROR "Empty value for argument: '${_REQUIRED_ARG}'") |
13 | 12 | endif() |
14 | 13 | endforeach() |
15 | 14 | endmacro() |
16 | 15 |
|
17 | | -# @param {string[]} SOURCE_LIST The list of source files to check. |
18 | | -# @param {bool} IS_HEADER_ONLY Returns TRUE if list only contains header files, FALSE otherwise. |
| 16 | +# Checks if `SOURCE_LIST` contains only header files. |
| 17 | +# |
| 18 | +# @param {string[]} SOURCE_LIST |
| 19 | +# @param {bool} IS_HEADER_ONLY Returns whether the list contains only header files. |
19 | 20 | # @param {string} NON_HEADER_FILE Returns the name of the first, if any, non-header file. |
20 | 21 | function(check_if_header_only SOURCE_LIST IS_HEADER_ONLY NON_HEADER_FILE) |
21 | 22 | set(LOCAL_SOURCE_LIST "${${SOURCE_LIST}}") |
22 | 23 | foreach(SRC_FILE IN LISTS LOCAL_SOURCE_LIST) |
23 | | - if(NOT ${SRC_FILE} MATCHES ".*\\.(h|hpp)") |
| 24 | + if(NOT "${SRC_FILE}" MATCHES ".*\\.(h|hpp)") |
24 | 25 | set(${IS_HEADER_ONLY} FALSE PARENT_SCOPE) |
25 | | - set(${NON_HEADER_FILE} ${SRC_FILE} PARENT_SCOPE) |
| 26 | + set(${NON_HEADER_FILE} "${SRC_FILE}" PARENT_SCOPE) |
26 | 27 | return() |
27 | 28 | endif() |
28 | 29 | endforeach() |
@@ -113,15 +114,15 @@ function(add_cpp_library) |
113 | 114 | ) |
114 | 115 | endfunction() |
115 | 116 |
|
116 | | -# Adds a C++ 20 test executable named unit-test-NAME that will be built with SOURCES and linked with |
117 | | -# LINK_LIBRARIES, in addition to Catch2. |
| 117 | +# Adds a C++ 20 test executable named `unit-test-NAME` that will be built with `SOURCES` and linked |
| 118 | +# with `LINK_LIBRARIES`, in addition to Catch2. |
118 | 119 | # |
119 | 120 | # @param {string} NAME |
120 | 121 | # @param {string} NAMESPACE |
121 | 122 | # @param {string[]} SOURCES |
122 | 123 | # @param {string[]} [LINK_LIBRARIES] |
123 | | -# @param {string} [UNIFIED_TEST_TARGET] If set, SOURCES and LINK_LIBRARIES are also added to |
124 | | -# UNIFIED_TEST_TARGET. |
| 124 | +# @param {string} [UNIFIED_TEST_TARGET] If set, `SOURCES` and `LINK_LIBRARIES` are also added to |
| 125 | +# `UNIFIED_TEST_TARGET`. |
125 | 126 | function(add_catch2_tests) |
126 | 127 | set(SINGLE_VALUE_ARGS |
127 | 128 | NAME |
@@ -177,11 +178,11 @@ endfunction() |
177 | 178 | # @param {string} NAME |
178 | 179 | # @param {string} NAMESPACE |
179 | 180 | # @param {string} [CONFIG_DEST_DIR] Destination to install the generated config file |
180 | | -# (NAME-config.cmake). |
181 | | -# @param {string} [CONFIG_INPUT_DIR] configure_package_config_file input file |
182 | | -# (NAME-config.cmake.in). |
183 | | -# @param {string} [CONFIG_OUTPUT_DIR] configure_package_config_file output file |
184 | | -# (NAME-config.cmake). |
| 181 | +# (`NAME-config.cmake`). |
| 182 | +# @param {string} [CONFIG_INPUT_DIR] `configure_package_config_file` input file |
| 183 | +# (`NAME-config.cmake.in`). |
| 184 | +# @param {string} [CONFIG_OUTPUT_DIR] `configure_package_config_file` output file |
| 185 | +# (`NAME-config.cmake`). |
185 | 186 | function(install_library) |
186 | 187 | set(SINGLE_VALUE_ARGS |
187 | 188 | NAME |
|
0 commit comments