summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/find_path/VALIDATOR.cmake
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 /Tests/RunCMake/find_path/VALIDATOR.cmake
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 'Tests/RunCMake/find_path/VALIDATOR.cmake')
-rw-r--r--Tests/RunCMake/find_path/VALIDATOR.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/RunCMake/find_path/VALIDATOR.cmake b/Tests/RunCMake/find_path/VALIDATOR.cmake
new file mode 100644
index 0000000..1e01250
--- /dev/null
+++ b/Tests/RunCMake/find_path/VALIDATOR.cmake
@@ -0,0 +1,39 @@
+
+function(CHECK_DEFAULT result filename)
+ message("CHECK='${filename}'")
+endfunction()
+
+function(CHECK_OK result filename)
+ message("CHECK='${filename}'")
+ set(${result} TRUE PARENT_SCOPE)
+endfunction()
+
+function(CHECK_KO result filename)
+ message("CHECK='${filename}'")
+ set(${result} FALSE PARENT_SCOPE)
+endfunction()
+
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_default
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ok
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)
+
+find_path(DIR
+ NAMES PrefixInPATH.h
+ HINTS ${CMAKE_CURRENT_SOURCE_DIR}/include
+ VALIDATOR check_ko
+ )
+message(STATUS "DIR='${DIR}'")
+unset(DIR CACHE)