[CMake] CheckLibraryExists behaviour with different compilers
Nils Gladitz
nilsgladitz at gmail.com
Mon Apr 20 09:06:26 EDT 2015
On 04/20/2015 02:54 PM, victor sv wrote:
> Hello again,
>
> Sometimes we don't have control on external libraries compilation and we
> don't know which compiler was used to generate external libraries
>
> now my questions is,Is there a CMake-standard-way to proceed in these cases?
Proper shared libraries record their own load dependencies but with
static libraries there is no generic way to record or retrieve the
required link information.
The build process of the library might export that information in some
form through e.g. pkg-config (.pc) files, custom configuration scripts
(e.g. foo-config), libtool library files (.la) or cmake target exports
with package configuration files.
If the library does not happen to provide a (working) cmake package
configuration file the next best thing is probably writing a (or using
an existing) cmake find module.
The find module could then try to guess static library dependencies
based on information provided elsewhere (e.g. by querying pkg-config or
parsing configuration files) or by falling back to manual user input.
Nils
More information about the CMake
mailing list