<html><body><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><div data-marker="__QUOTED_TEXT__"><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br>Hello,<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">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,<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">and with the NO_DEFAULT_PATH to not find it first in system directories.<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">find_package (HMAT REQUIRED NO_MODULE PATHS <hmat-prefix>/lib/cmake/hmat NO_DEFAULT_PATH)<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">So far so good. Now I want to cross-compile with the usual toolchain file:<br></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"> set (CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)<br>set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)<br>set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)<br>set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)</div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">...<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">This works wonderfully too.<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">But now I add CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to ONLY in my toolchain file to prevent detecting native libraries <br>set (CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">And now find_package fails to find my package!<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">I'm puzzled as I did not find in the doc something that explains why the PATHS is ignored (step #8 in find_package):<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">https://cmake.org/cmake/help/v3.5/command/find_package.html#command:find_package</div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">Do you think it's a bug ?<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000">Regards,<br data-mce-bogus="1"></div><div style="font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000"><br><div>-- <br></div><div>Julien Schueller<br>Phimeca Engineering<br>www.phimeca.com</div></div></div></div><br></div></div></body></html>