[cmake-developers] Proper way to find 64-bit version of a library (or specifically OSG)
Brad King
brad.king at kitware.com
Wed May 13 08:27:01 EDT 2015
On 05/12/2015 04:24 PM, Mattias Helsing wrote:
> I'm wondering what the proper way is to go about finding 64-bit
> versions of a library.
The find_library command automatically adds "64" to "lib" directories
if the FIND_LIBRARY_USE_LIB64_PATHS global property is set and the
target architecture is 64-bit:
http://www.cmake.org/cmake/help/v3.2/command/find_library.html
http://www.cmake.org/cmake/help/v3.2/prop_gbl/FIND_LIBRARY_USE_LIB64_PATHS.html
The global property is normally set automatically for the current
operating system. Note that Debian-based distros do not use lib64
in their packages so it is not enabled there. On such distros
hand-built packages should also be configured to avoid lib64 paths.
> My situation is that I have built
> OpenSceneGraph 64-bit and installed it. The libraries end up in
> /usr/whatever/lib64. But to be able to find the libraries I needed to
> modify Modules/FindOpenThreads.cmake and
> Modules/Findosg_functions.cmake to also search lib64 suffixes
> (modified PATH_SUFFIXES).
CMake's find modules for OSG were created long ago, but ideally OSG
should distribute cmake package configuration files as documented here:
http://www.cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html
That way only a single find_package call is needed and CMake does not
have to find individual library files.
-Brad
More information about the cmake-developers
mailing list