[CMake] Using find_program() command to search in only one given directory

Nicholas Kinar n.kinar at usask.ca
Thu Sep 2 12:57:20 EDT 2010


>> 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
>

Thanks, Alex; at least for me, the second option (i.e. using the set 
command) appears to be more intuitive, so I will use that particular 
option when writing my script.  It is interesting to know about the 
if(EXISTS ...) option as well.

Nicholas




More information about the CMake mailing list