[cmake-developers] [CMake] FIND_PROGRAM fails to find file without 'r' bit set

Brad King brad.king at kitware.com
Mon Jan 25 09:19:56 EST 2016


On 01/25/2016 08:27 AM, Ben Boeckel wrote:
> It's both :) . FileExists is implemented using access() rather than
> something like lstat(), so that would indeed be not a "program" since
> the file doesn't "exist".
> 
> It was on my list to fix, but the backwards compatibility argument
> (IIRC) made it near impossible to change.

There are related issues here:

 https://cmake.org/Bug/view.php?id=14022
 https://cmake.org/Bug/view.php?id=10468

The main compatibility concern is not about find_program, but just about
other uses of FileExists.  Each time this has come up before we've
determined the full solution requires a non-trivial audit of all uses
of FileExists.  That lost sight of the immediate find_program problem,
so instead we could look at fixing just that.

Since then we've gained the cmSystemTools::TestFileAccess() function.
One could look at porting find_program to use it with TEST_FILE_EXECUTE.
The Tests/RunCMake/find_program test could be extended to cover this
once it is fixed.

-Brad



More information about the cmake-developers mailing list