Recently CMP0109 was added to find_program to clarify sensible file permissions required for find_program() to stop and declare a program as found.
What is the official behavior regarding file permissions required for: find_path(), find_file(), find_library()?
I believe this behavior should be documented. For example, should simply existence be enough, even if the file is not readable or executable?
I would not expect anything other than existence to be relevant for find_path()
, find_file()
, or find_library()
. CMake has no idea what you want to do with the thing you’re finding with those commands. The find_program()
case is special because the primary reason for using it is to find a program you want to execute, and for that to be useful, the program must be executable. For any other use case, you should probably use find_file()
instead.
I don’t think any change to the docs is needed. We don’t normally document things a command doesn’t do, unless it goes against conventions or other such cases. If the docs don’t mention any requirements around permissions for find_path()
, find_file()
, or find_library()
, then you can reasonably expect there are no such requirements.
I did an experiment that shows on Unix-like file systems (e.g. Linux) read permission is required for find_library, etc. to find the file.
I plan to make a Help MR to document this.