mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-19 21:50:39 -06:00
find_program: Optionally consider all names in each directory
When more than one value is given to the NAMES option this command by default will consider one name at a time and search every directory for it. Add a NAMES_PER_DIR option to tell this command to consider one directory at a time and search for all names in it.
This commit is contained in:
1
Tests/RunCMake/find_program/NamesPerDir-stdout.txt
Normal file
1
Tests/RunCMake/find_program/NamesPerDir-stdout.txt
Normal file
@@ -0,0 +1 @@
|
||||
-- PROG='[^']*/Tests/RunCMake/find_program/A/testA'
|
||||
6
Tests/RunCMake/find_program/NamesPerDir.cmake
Normal file
6
Tests/RunCMake/find_program/NamesPerDir.cmake
Normal file
@@ -0,0 +1,6 @@
|
||||
find_program(PROG
|
||||
NAMES testB testA NAMES_PER_DIR
|
||||
PATHS ${CMAKE_CURRENT_SOURCE_DIR}/A ${CMAKE_CURRENT_SOURCE_DIR}/B
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
message(STATUS "PROG='${PROG}'")
|
||||
@@ -1,6 +1,7 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(DirsPerName)
|
||||
run_cmake(NamesPerDir)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN)$")
|
||||
run_cmake(WindowsCom)
|
||||
|
||||
Reference in New Issue
Block a user