[CMake] find_package and lib/cmake/Foo

Biddiscombe, John A. biddisco at cscs.ch
Tue Jul 21 09:43:10 EDT 2015


Just to follow up my own question. I have found the answer
export Foo_DIR=/my/path/prefix
followed by cmake ... will correctly locate the package

unfortunately,
cmake -DFoo_DIR=/my/path/prefix <rest of options>
will not.

Is there a reason why the cmake variable is not searched, whereas the env var is?

thanks

JB


From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Biddiscombe, John A.
Sent: 21 July 2015 14:54
To: cmake at cmake.org
Subject: [CMake] find_package and lib/cmake/Foo

I've asked this before, but never resolved it...

if I stall package Foo into
CMAKE_INSTALL_PREFIX=/my/path/prefix
and generate
/my/path/prefix/lib/cmake/Foo/FooConfig.cmake
etc

then with
Foo_DIR=/my/path/prefix
Foo_ROOT=/my/path/prefix
find_package(Foo)
does not find package Foo

One needs to set
Foo_DIR=/my/path/prefix/lib/cmake/Foo
or
Foo_ROOT=/my/path/prefix/lib/cmake/Foo

but it specifically states in the documentation http://www.cmake.org/cmake/help/v3.2/manual/cmake-packages.7.html "One place it looks is: <prefix>/lib/cmake/Foo*/ where Foo* is a case-insensitive globbing expression"

if I
set(CMAKE_FIND_DEBUG_MODE 1)
then I do not see it searching in my prefix with any extra /lib/cmake/ paths.

Is the documentation wrong, or have I missed something?

thanks

JB


--
John Biddiscombe,                        email:biddisco @.at.@ cscs.ch
http://www.cscs.ch/
CSCS, Swiss National Supercomputing Centre  | Tel:  +41 (91) 610.82.07
Via Trevano 131, 6900 Lugano, Switzerland   | Fax:  +41 (91) 610.82.82

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150721/75f64707/attachment.html>


More information about the CMake mailing list