[cmake-developers] CMake "find_package" command on a package that is not installed is unexpectedly successful

Timothy Wrona tjwrona1992 at gmail.com
Tue Feb 5 14:37:48 EST 2019


I am working my way through the "CMake Cookbook" by Radovan Bast and
Roberto Di Remigio and got to an example that required the Eigen C++
libraries. (chapter-02/recipe-06)

I downloaded the ".zip" for the Eigen libraries and unzipped it to an
arbitrary location. Then I ran CMake on it (but I did not build or install
it). After doing this, magically the example code was able to find it and
the example built successfully even though I never told it where to look
for the Eigen libraries.

A detailed description of my experience is in this stack overflow post:
https://stackoverflow.com/questions/54541261/cmake-find-package-command-on-a-package-that-was-not-installed-is-unexpectedly?noredirect=1#comment95884208_54541261

Can anyone explain to me how "find_package" is able to find the Eigen
libraries even though they are just pasted into some arbitrary location
that I never told the example project about?

As far as I can tell from the documentation on "find_package" it should not
work.

Thanks,
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20190205/e8fe91c2/attachment.html>


More information about the cmake-developers mailing list