Skip to content

WIP:Add debug logging to find_library

Chris Wilson requested to merge qris/cmake:find_library_debug into master

find_library is quite difficult to use, because its behaviour is complex. People often ask how to see what paths it is really searching, when it doesn't find their libraries. For example:

These questions are not directly answered because find_library does no logging at all. This is a first attempt to fix that.

I should probably call some debug-logging function instead of cmSystemTools::Message, but I'm not familiar with the code base, so I don't know what would be preferred. Probably something that writes to CMakeOutput.log, or else can be enabled with a new option to find_library to enable debugging?

It's not very obvious from the documentation that FIND_LIBRARY_USE_LIB64_PATHS (which is enabled by default on many platforms) results in all the paths being silently modified. I think this is appropriate for system paths (GUESSes?) but not for user-supplied paths, so this might be a bug. Alternatively, the documentation might mention that CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX overrides (disables) this behaviour.

Merge request reports