On Wednesday 01 September 2010, Nicholas Kinar wrote:
> 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)
Looks good, should work.
>
> Alternately, must I simply set the path to the program using the
> following command?
>
> set(CONFIG_EXECUTABLE, ${CONFIG_EXECUTABLE_PATH}/my-config)
You can do that too.
You can also check via
if(EXISTS ...)
Alex
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake