summaryrefslogtreecommitdiffstats
path: root/Help/command
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2022-06-11 14:25:45 (GMT)
committerBrad King <brad.king@kitware.com>2022-06-14 20:17:46 (GMT)
commitf3b5a7d6df02d5c714a848e9709c563b9555af71 (patch)
treebb0aeb6168fd43afaaaa64df4fb70f7d5233e8d9 /Help/command
parentb78624fd29b91f748f3edcdaeea997a52691b647 (diff)
downloadCMake-f3b5a7d6df02d5c714a848e9709c563b9555af71.zip
CMake-f3b5a7d6df02d5c714a848e9709c563b9555af71.tar.gz
CMake-f3b5a7d6df02d5c714a848e9709c563b9555af71.tar.bz2
find_(program,library,file,path): add validation function
Fixes: #23603
Diffstat (limited to 'Help/command')
-rw-r--r--Help/command/FIND_XXX.txt21
1 files changed, 21 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.