[CMake] Using find_program() command to search in only one given directory
Nicholas Kinar
n.kinar at usask.ca
Wed Sep 1 16:58:36 EDT 2010
Hello,
Suppose that I have a program (named "my-config") that is on the *NIX
system path, and I have another version of the program (also named
"my-config") in a sub-folder of the HOME directory.
How would I use the find_program() command to determine if the program
exists, given the search directory? In other words, given a variable
with the path to the program (CONFIG_EXECUTABLE_PATH), how do I force
the find_program() command to search only in the path specified by that
particular variable?
I've been trying to use the find_program() command with the
NO_DEFAULT_PATH modifier, but this does not seem to be working, since
cmake will only find the program on the *NIX system path:
find_program(CONFIG_EXECUTABLE NAMES my-config PATHS
${CONFIG_EXECUTABLE_PATH} NO_DEFAULT_PATH)
Alternately, must I simply set the path to the program using the
following command?
set(CONFIG_EXECUTABLE, ${CONFIG_EXECUTABLE_PATH}/my-config)
Nicholas
More information about the CMake
mailing list