[CMake] find_program doesn't use the PATH

Kornel Benko kornel at lyx.org
Wed Jul 31 14:32:33 EDT 2019


Am Mittwoch, 31. Juli 2019, 12:19:48 CEST schrieb Braden McDaniel:
> I was tempted to go ahead and file a bug on this; but it seems so basic
> that I figure I must be missing something. 
> 
> Per the documentation for find_program: 
> 
>    If NO_DEFAULT_PATH is not specified, the search process is as
>    follows: 
>>    5. Search the standard system environment variables. This can be
>    skipped if NO_SYSTEM_ENVIRONMENT_PATH is an argument. 
>     * PATH
> That indicates to me that for "find_program(PROG_VAR NAME foo)", CMake
> ought to find "foo" if "foo" is in the PATH. That doesn't seem to be
> the case, though. A concrete example: 
> 
>    cmake_minimum_required(VERSION 3.0) 
>    cmake_policy(SET CMP0048 NEW) 
>    project("hello" VERSION 0.1.0 LANGUAGES C) 
>    find_program(GETTEXT_MSGMERGE_EXECUTABLE NAME msgmerge)

The find_program() is searching something like "/usr/bin/NAME". "NAME" should be a placeholder.
What you had in mind was probably the second form
	find_program(GETTEXT_MSGMERGE_EXECUTABLE NAMES msgmerge)
Mark the string "NAMES".


	Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <https://cmake.org/pipermail/cmake/attachments/20190731/07b3afbe/attachment.sig>


More information about the CMake mailing list