summaryrefslogtreecommitdiffstats
path: root/Help
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2022-06-15 13:59:04 (GMT)
committerKitware Robot <kwrobot@kitware.com>2022-06-15 13:59:12 (GMT)
commit85dc7c763a12366d49ac2dddc53f65d52d675c00 (patch)
treebc7282a2dc100b83f43a09d1d31faa2a182f8c9a /Help
parentc6e027cd5fab5b0986cd75ba7c7ad6f6a9cfe334 (diff)
parentf3b5a7d6df02d5c714a848e9709c563b9555af71 (diff)
downloadCMake-85dc7c763a12366d49ac2dddc53f65d52d675c00.zip
CMake-85dc7c763a12366d49ac2dddc53f65d52d675c00.tar.gz
CMake-85dc7c763a12366d49ac2dddc53f65d52d675c00.tar.bz2
Merge topic 'find_item-validation-function'
f3b5a7d6df find_(program,library,file,path): add validation function Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !7364
Diffstat (limited to 'Help')
-rw-r--r--Help/command/FIND_XXX.txt21
-rw-r--r--Help/release/dev/find_item-VALIDATOR.rst6
2 files changed, 27 insertions, 0 deletions
diff --git a/Help/command/FIND_XXX.txt b/Help/command/FIND_XXX.txt
index 6683edb..e5e7496 100644
--- a/Help/command/FIND_XXX.txt
+++ b/Help/command/FIND_XXX.txt
@@ -15,6 +15,7 @@ The general signature is:
[PATHS [path | ENV var]... ]
[REGISTRY_VIEW (64|32|64_32|32_64|HOST|TARGET|BOTH)]
[PATH_SUFFIXES suffix1 [suffix2 ...]]
+ [VALIDATOR function]
[DOC "cache documentation string"]
[NO_CACHE]
[REQUIRED]
@@ -66,6 +67,26 @@ Options include:
Specify additional subdirectories to check below each directory
location otherwise considered.
+``VALIDATOR``
+ .. versionadded:: 3.25
+
+ Specify a :command:`function` (a :command:`macro` is not an acceptable
+ choice) which will be called for each found item. The search ends when
+ the validation function returns a successful status.
+
+ The validation function expects two arguments: output variable name and item
+ value. By default, the output variable name already holds a ``TRUE`` value.
+
+ .. parsed-literal::
+
+ function (MY_CHECK output_status item)
+ if (NOT item MATCHES ...)
+ set(${output_status} FALSE PARENT_SCOPE)
+ endif()
+ endfunction()
+
+ |FIND_XXX| (result NAMES ... VALIDATOR my_check)
+
``DOC``
Specify the documentation string for the ``<VAR>`` cache entry.
diff --git a/Help/release/dev/find_item-VALIDATOR.rst b/Help/release/dev/find_item-VALIDATOR.rst
new file mode 100644
index 0000000..2cda421
--- /dev/null
+++ b/Help/release/dev/find_item-VALIDATOR.rst
@@ -0,0 +1,6 @@
+find_item-VALIDATOR
+-------------------
+
+* :command:`find_file`, :command:`find_path`, :command:`find_library`, and
+ :command:`find_program` commands gain the capability to specify a function
+ which will be called for each found item to validate it.