[CMake] Library locations returned by find_package() and find_library()
Andreas Pakulat
apaku at gmx.de
Thu Dec 6 13:45:45 EST 2012
Hi,
On Thu, Dec 6, 2012 at 5:13 PM, Mateusz Loskot <mateusz at loskot.net> wrote:
> The CMake 2.8.10 manual includes the following statement in the paragraph
> about link_directories() command:
>
> "Library locations returned by find_package() and find_library() are
> absolute paths."
>
> Would it be possible to include similar clarification in the sections for
> find_package() and find_library()?
>
> A user of my library asked why
> XXX_INCLUDE_DIR takes directory location, but
> XXX_LIBRARIES takes absolute path to library file(s).
>
> I've found it difficult to explain the rationale really.
> I could not find any back up in the manual.
Thats two unrelated things really. For libraries cmake needs to know
the absolute path if possible to setup proper dependencies in
target_link_libraries and to make sure that the linker links against
exactly that library and not some library with the same name that
happens to be in a directory further in the front of the linker
commandline.
For include directories things are different, since the mechanism for
those is different. In particular the pre-processor does not allow
include files to be listed on the commandline. Instead you give it a
couple of directories where to search. Dependencies of this are
generated by CMake parsing the source files.
More information about the CMake
mailing list