[cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
Julien Schueller
schueller at phimeca.com
Fri Jul 1 05:13:47 EDT 2016
Hello,
I'm using find_package in no-module mode with the PATHS option to provide a hard-coded guess to a path where a sublibrary 'hmat' was previously found,
and with the NO_DEFAULT_PATH to not find it first in system directories.
find_package (HMAT REQUIRED NO_MODULE PATHS <hmat-prefix>/lib/cmake/hmat NO_DEFAULT_PATH)
So far so good. Now I want to cross-compile with the usual toolchain file:
set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
...
This works wonderfully too.
But now I add CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY in my toolchain file to prevent detecting native libraries
set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
And now find_package fails to find my package!
I'm puzzled as I did not find in the doc something that explains why the PATHS is ignored (step #8 in find_package):
https://cmake.org/cmake/help/v3.5/command/find_package.html#command:find_package
Do you think it's a bug ?
Regards,
--
Julien Schueller
Phimeca Engineering
www.phimeca.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160701/aef2b202/attachment.html>
More information about the cmake-developers
mailing list