[CMake] find_package and lib/cmake/Foo

Robert Maynard robert.maynard at kitware.com
Tue Jul 21 10:38:16 EDT 2015


Have you tried setting CMAKE_PREFIX_PATH
(http://www.cmake.org/cmake/help/v3.0/variable/CMAKE_PREFIX_PATH.html)
as a -D option on the initial configure?

On Tue, Jul 21, 2015 at 9:43 AM, Biddiscombe, John A. <biddisco at cscs.ch> wrote:
> 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
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list