[cmake-developers] The lib64 case

Brad King brad.king at kitware.com
Mon Mar 26 08:22:22 EDT 2012


On 3/24/2012 12:41 AM, Rolf Eike Beer wrote:
> I have seen a strange behaviour on my (openSUSE) Linux host running on AMD64.
> Sometimes during my Find* module tests libraries in /usr/lib64 were not found.
> It took me a while until I noticed what was going on there:
> FIND_LIBRARY_USE_LIB64_PATHS is not set when I used project(... NONE). While
> this sounds logical maybe the find_library() documentation should be updated to
> say that some language needs to be enabled for it to properly work.

Sure.  Please add a reference to the find_library documentation that
points at the FIND_LIBRARY_USE_LIB64_PATHS global property.  Then
update the documentation of that property to indicate it is set
automatically when C, CXX, or Fortran is enabled.

> While searching the reason of this behaviour I of course did a "git grep
> lib64" and found a bunch of Find* modules that manually specify lib64 as suffix.
> Also most of them also specified "lib" as a path suffix, which is according to my
> understanding totally unneeded as find_library() will automatically add this
> suffix. Am I correct? Then I would go in the next days and throw them both out.

The find_library command automatically searches "lib" under each path
in CMAKE_SYSTEM_PREFIX_PATH and CMAKE_PREFIX_PATH.  Any path that has
"lib" in it will first be transformed to "lib64" when the above property
is ON.  Using "PATH_SUFFIXES lib64 lib" is not necessary to get lib64
to be searched.

> Is same is true for find_path() and include suffix?

There is no automatic translation to "include64".  However the command
will search "include" under each prefix as above so one does not need
to write "PATH_SUFFIXES include" to search <prefix>/include with the
find_path command.

Thanks for working on this cleanup.

-Brad



More information about the cmake-developers mailing list