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) 
   message(STATUS "GETTEXT_MSGMERGE_EXECUTABLE = 
${GETTEXT_MSGMERGE_EXECUTABLE}") 
   add_executable(hello hello.c) 

This outputs: 

   $ cmake -G "Unix Makefiles" ~/src/hello 
   -- GETTEXT_MSGMERGE_EXECUTABLE = GETTEXT_MSGMERGE_EXECUTABLE-NOTFOUND 
   -- Configuring done 
   -- Generating done 
   -- Build files have been written to: /home/mcdanb/build/hello 
   $ which msgmerge 
   /usr/bin/msgmerge 

I am using CMake 3.14.5. 

Have I misunderstood the documentation on this point?
 
-- 
Braden McDaniel <[email protected]>

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to