Re: [cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

2016-07-01 Thread Julien Schueller
> De: "Nils Gladitz" <nilsglad...@gmail.com>
> À: "Julien Schueller" <schuel...@phimeca.com>, "cmake-developers"
> <cmake-developers@cmake.org>
> Envoyé: Vendredi 1 Juillet 2016 14:19:25
> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

> On 07/01/2016 02:08 PM, Julien Schueller wrote:

>>> De: "Nils Gladitz" <nilsglad...@gmail.com>
>>> À: "Julien Schueller" <schuel...@phimeca.com> , "cmake-developers"
>>> <cmake-developers@cmake.org>
>>> Envoyé: Vendredi 1 Juillet 2016 13:57:40
>>> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
>>> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

>>> On 07/01/2016 01:44 PM, Julien Schueller wrote:

>>>>> De: "Nils Gladitz" <nilsglad...@gmail.com>
>>>>> À: "Julien Schueller" <schuel...@phimeca.com> , "cmake-developers"
>>>>> <cmake-developers@cmake.org>
>>>>> Envoyé: Vendredi 1 Juillet 2016 12:37:47
>>>>> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
>>>>> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

>>>>> On 07/01/2016 11:13 AM, Julien Schueller wrote:

>>>>>> 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 /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

>>>>> The given path "/lib/cmake/hmat" is prefixed by the paths in
>>>>> CMAKE_FIND_ROOT_PATH.
>>>>> Which means that (given ONLY) cmake only looks for the package in
>>>>> "/usr/i686-w64-mingw32//lib/cmake/hmat".

>>>>> You might want to e.g. add  to CMAKE_FIND_ROOT_PATH and use 
>>>>> PATHS /
>>>>> instead.

>>>>> Nils

>>>> Thanks,

>>>> In my case  has the same value as CMAKE_FIND_ROOT_PATH, and 
>>>> even if
>>>> I modify the PATHS option value to be relative (PATHS lib/cmake/hmat) the
>>>> detection fails.
>>>> (They're not actually set to /usr/i686-w64-mingw32 but some absolute 
>>>> location in
>>>> my home where I unzip a mingw toolchain, but I can reproduce the issue on
>>>> another box where the toolchain is natively /usr/i686-w64-mingw32).

>>> I don't think behavior for relative paths is defined.

>>> Use absolute paths like "/lib/cmake/hmat", just "/" probably works as well
>>> (since the path in the prefix matches
>>> "/(lib/|lib|share)/cmake/*/").

>>> Nils

>> Yes, if I use just "/lib/cmake/hmat" it works. Couldn't cmake see that that 
>> my
>> absolute path begins with CMAKE_FIND_ROOT_PATH and hence should be treated as
>> valid according to CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ?

> CMake could do a lot of things but as-is the defined (documented) behavior is
> that when you tell cmake to only look in the prefixes provided by
> CMAKE_FIND_ROOT_PATH then all search locations are re-rooted to those 
> prefixes.

> e.g. a given path "/usr" can exist under your regular filesystem root and as
> /usr/i686-w64-mingw32/usr.
> Still you would not want cmake to look in your native /usr directory in this
> case even though it is "valid" (exists).

> Nils

I see your point. 
Thank you so much for the quick response. 

-- 
Julien Schueller 
Phimeca Engineering 
www.phimeca.com 
-- 

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-developers

Re: [cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

2016-07-01 Thread Nils Gladitz



On 07/01/2016 02:08 PM, Julien Schueller wrote:





*De: *"Nils Gladitz" <nilsglad...@gmail.com>
*À: *"Julien Schueller" <schuel...@phimeca.com>,
"cmake-developers" <cmake-developers@cmake.org>
*Envoyé: *Vendredi 1 Juillet 2016 13:57:40
    *Objet: *Re: [cmake-developers] PATHS guess in find_package
ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE



On 07/01/2016 01:44 PM, Julien Schueller wrote:





*De: *"Nils Gladitz" <nilsglad...@gmail.com>
*À: *"Julien Schueller" <schuel...@phimeca.com>,
"cmake-developers" <cmake-developers@cmake.org>
    *Envoyé: *Vendredi 1 Juillet 2016 12:37:47
*Objet: *Re: [cmake-developers] PATHS guess in
    find_package ignored with NO_DEFAULT_PATH &
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

On 07/01/2016 11:13 AM, Julien Schueller wrote:


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
/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


The given path "/lib/cmake/hmat" is prefixed
by the paths in CMAKE_FIND_ROOT_PATH.
Which means that (given ONLY) cmake only looks for the
package in
"/usr/i686-w64-mingw32//lib/cmake/hmat".

You might want to e.g. add  to
CMAKE_FIND_ROOT_PATH and use PATHS / instead.

Nils


Thanks,

In my case  has the same value as
CMAKE_FIND_ROOT_PATH, and even if I modify the PATHS option
value to be relative (PATHS lib/cmake/hmat) the detection fails.
(They're not actually set to /usr/i686-w64-mingw32 but some
absolute location in my home where I unzip a mingw toolchain,
but I can reproduce the issue on another box where the
toolchain is natively /usr/i686-w64-mingw32).


I don't think behavior for relative paths is defined.

Use absolute paths like "/lib/cmake/hmat", just "/" probably works
as well (since the path in the prefix matches
"/(lib/|lib|share)/cmake/*/").

Nils


Yes, if I use just "/lib/cmake/hmat" it works. Couldn't cmake see that 
that my absolute path begins with CMAKE_FIND_ROOT_PATH and hence 
should be treated as valid according 
to CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ?


CMake could do a lot of things but as-is the defined (documented) 
behavior is that when you tell cmake to only look in the prefixes 
provided by CMAKE_FIND_ROOT_PATH then all search locations are re-rooted 
to those prefixes.


e.g. a given path "/usr" can exist under your regular filesystem root 
and as /usr/i686-w64-mingw32/usr.
Still you would not want cmake to look in your native /usr directory in 
this case even though it is "valid" (exists).


Nils
-- 

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-developers

Re: [cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

2016-07-01 Thread Julien Schueller
> De: "Nils Gladitz" <nilsglad...@gmail.com>
> À: "Julien Schueller" <schuel...@phimeca.com>, "cmake-developers"
> <cmake-developers@cmake.org>
> Envoyé: Vendredi 1 Juillet 2016 13:57:40
> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

> On 07/01/2016 01:44 PM, Julien Schueller wrote:

>>> De: "Nils Gladitz" <nilsglad...@gmail.com>
>>> À: "Julien Schueller" <schuel...@phimeca.com> , "cmake-developers"
>>> <cmake-developers@cmake.org>
>>> Envoyé: Vendredi 1 Juillet 2016 12:37:47
>>> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
>>> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

>>> On 07/01/2016 11:13 AM, Julien Schueller wrote:

>>>> 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 /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

>>> The given path "/lib/cmake/hmat" is prefixed by the paths in
>>> CMAKE_FIND_ROOT_PATH.
>>> Which means that (given ONLY) cmake only looks for the package in
>>> "/usr/i686-w64-mingw32//lib/cmake/hmat".

>>> You might want to e.g. add  to CMAKE_FIND_ROOT_PATH and use 
>>> PATHS /
>>> instead.

>>> Nils

>> Thanks,

>> In my case  has the same value as CMAKE_FIND_ROOT_PATH, and 
>> even if
>> I modify the PATHS option value to be relative (PATHS lib/cmake/hmat) the
>> detection fails.
>> (They're not actually set to /usr/i686-w64-mingw32 but some absolute 
>> location in
>> my home where I unzip a mingw toolchain, but I can reproduce the issue on
>> another box where the toolchain is natively /usr/i686-w64-mingw32).

> I don't think behavior for relative paths is defined.

> Use absolute paths like "/lib/cmake/hmat", just "/" probably works as well
> (since the path in the prefix matches
> "/(lib/|lib|share)/cmake/*/").

> Nils

Yes, if I use just "/lib/cmake/hmat" it works. Couldn't cmake see that that my 
absolute path begins with CMAKE_FIND_ROOT_PATH and hence should be treated as 
valid according to CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ? 

-- 
Julien Schueller 
Phimeca Engineering 
www.phimeca.com 
-- 

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-developers

Re: [cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

2016-07-01 Thread Julien Schueller
> De: "Nils Gladitz" <nilsglad...@gmail.com>
> À: "Julien Schueller" <schuel...@phimeca.com>, "cmake-developers"
> <cmake-developers@cmake.org>
> Envoyé: Vendredi 1 Juillet 2016 12:37:47
> Objet: Re: [cmake-developers] PATHS guess in find_package ignored with
> NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

> On 07/01/2016 11:13 AM, Julien Schueller wrote:

>> 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 /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

> The given path "/lib/cmake/hmat" is prefixed by the paths in
> CMAKE_FIND_ROOT_PATH.
> Which means that (given ONLY) cmake only looks for the package in
> "/usr/i686-w64-mingw32//lib/cmake/hmat".

> You might want to e.g. add  to CMAKE_FIND_ROOT_PATH and use 
> PATHS /
> instead.

> Nils

Thanks, 

In my case  has the same value as CMAKE_FIND_ROOT_PATH, and even 
if I modify the PATHS option value to be relative (PATHS lib/cmake/hmat) the 
detection fails. 
(They're not actually set to /usr/i686-w64-mingw32 but some absolute location 
in my home where I unzip a mingw toolchain, but I can reproduce the issue on 
another box where the toolchain is natively /usr/i686-w64-mingw32). 

-- 
Julien Schueller 
Phimeca Engineering 
www.phimeca.com 
-- 

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-developers

Re: [cmake-developers] PATHS guess in find_package ignored with NO_DEFAULT_PATH & CMAKE_FIND_ROOT_PATH_MODE_PACKAGE

2016-07-01 Thread Nils Gladitz

On 07/01/2016 11:13 AM, Julien Schueller wrote:


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 
/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



The given path "/lib/cmake/hmat" is prefixed by the paths 
in CMAKE_FIND_ROOT_PATH.
Which means that (given ONLY) cmake only looks for the package in 
"/usr/i686-w64-mingw32//lib/cmake/hmat".


You might want to e.g. add  to CMAKE_FIND_ROOT_PATH and use 
PATHS / instead.


Nils
-- 

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-developers