Re: [CMake] Path vs. name preference during search.

2014-02-14 Thread Marcel Loose
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

For more discussion on the search order of PATHS and NAMES used by the
different Find_* commands see, e.g.:

http://www.cmake.org/pipermail/cmake/2009-October/032565.html
http://www.cmake.org/pipermail/cmake/2010-March/035889.html
http://public.kitware.com/Bug/view.php?id=10718

The current CMake behaviour is not likely to change. IIRC, Bill
Hoffman once explained that the NAMES option was introduced to specify
name *aliases* like 'gtk' 'gtk12' in FindGTK.cmake. It was *not* meant
to specify a list of names for *different* entities.

Best regards,
Marcel Loose.

op 14-02-14 09:02, Jakub Zakrzewski schreef:
> Hi,
> 
> what about searching multiple times, each time giving only the path
> you want (in order of prefference)? If I'm correct, once the
> library is found, next attempts to find it againg will be a no-op.
> 
> 
> 
> --
> 
> Gruesse,
> 
> Jakub
> 
> 
> 
> 
> 
> *From:*CMake [mailto:cmake-boun...@cmake.org] *On Behalf Of *Rob
> McDonald *Sent:* Donnerstag, 13. Februar 2014 19:21 *To:*
> Jean-Christophe Fillion-Robin *Cc:* CMake ML *Subject:* Re: [CMake]
> Path vs. name preference during search.
> 
> 
> 
> Jc,
> 
> 
> 
> That is an approach I have thought about.  I even think I have
> looked at Slicer for how you work your CMake system.
> 
> 
> 
> I prefer to use project-supplied FindLIB.cmake (or a slightly
> modified version thereof) because some of them do more than just
> setting LIBRARY, INCLUDE_DIR, and FOUND variables.
> 
> 
> 
> Rather than duplicate everything done in the FindLIB.cmake script
> (which can have platform-dependent logic), I have gone the path of
> encouraging the FindLIB.cmake to find the one I want.
> 
> 
> 
> Rob
> 
> 
> 
> 
> 
> On Thu, Feb 13, 2014 at 10:09 AM, Jean-Christophe Fillion-Robin 
> mailto:jchris.filli...@kitware.com>>
> wrote:
> 
> Hi Rob,
> 
> Do address the use case you described, I usually explicitly set the
> path the library when built as an external project and rely only on
> the find_* command for the use_system case.
> 
> See 
> https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16
>
>  Hth
> 
> Jc
> 
> 
> 
> On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald
> mailto:rob.a.mcdon...@gmail.com>>
> wrote:
> 
> When I search for a given library, specifying multiple possible 
> names and multiple hints for paths...
> 
> 
> 
> FIND_LIBRARY( FINDME_LIB
> 
> NAMES name1 name2 name3
> 
> HINTS path1 path2 path3
> 
> DOC "Library to find")
> 
> 
> 
> CMake seems to have a preference for name1, and it first searches 
> all HINTS for name1.  If it doesn't find name1, it moves to name2 
> and then searches all HINTS for name2, etc.
> 
> 
> 
> I would prefer to have a preference for path1, no matter the name. 
> Try for all names in path1, then move to path2, etc.
> 
> 
> 
> Is there a way to toggle this behavior?
> 
> 
> 
> Rob
> 
> 
> 
> 
> 
> Background...  Basically, I am using ExternalProject_Add to build
> a library.  However, to make it possible to use the system-library 
> instead, this is optional.  I use a FindThelib.cmake so the main 
> project works seamlessly either way.
> 
> 
> 
> I'm targeting the case where a version of this library is
> installed on the system, but I want to use my own copy.
> 
> 
> 
> The name of the library depends on build options and platform, so 
> controlling on the name is a little fragile.  However, I have 
> explicitly built it in a known directory, so having preference for 
> the known directory is desirable.
> 
> 
> 
> --
> 
> Powered by www.kitware.com <http://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://www.cmake.org/mailman/listinfo/cmake
> 
> 
> 
> 
> -- +1 919 869 8849 
> 
> 
> 
> 
> 

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJS/eiR

Re: [CMake] Path vs. name preference during search.

2014-02-14 Thread Jakub Zakrzewski
Hi,
what about searching multiple times, each time giving only the path you want 
(in order of prefference)? If I'm correct, once the library is found, next 
attempts to find it againg will be a no-op.

--
Gruesse,
Jakub


From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Rob McDonald
Sent: Donnerstag, 13. Februar 2014 19:21
To: Jean-Christophe Fillion-Robin
Cc: CMake ML
Subject: Re: [CMake] Path vs. name preference during search.

Jc,

That is an approach I have thought about.  I even think I have looked at Slicer 
for how you work your CMake system.

I prefer to use project-supplied FindLIB.cmake (or a slightly modified version 
thereof) because some of them do more than just setting LIBRARY, INCLUDE_DIR, 
and FOUND variables.

Rather than duplicate everything done in the FindLIB.cmake script (which can 
have platform-dependent logic), I have gone the path of encouraging the 
FindLIB.cmake to find the one I want.

Rob


On Thu, Feb 13, 2014 at 10:09 AM, Jean-Christophe Fillion-Robin 
mailto:jchris.filli...@kitware.com>> wrote:
Hi Rob,
Do address the use case you described, I usually explicitly set the path the 
library when built as an external project and rely only on the find_* command 
for the use_system case.

See 
https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16
Hth
Jc

On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald 
mailto:rob.a.mcdon...@gmail.com>> wrote:
When I search for a given library, specifying multiple possible names and 
multiple hints for paths...

FIND_LIBRARY( FINDME_LIB
NAMES name1 name2 name3
HINTS path1 path2 path3
DOC "Library to find")

CMake seems to have a preference for name1, and it first searches all HINTS for 
name1.  If it doesn't find name1, it moves to name2 and then searches all HINTS 
for name2, etc.

I would prefer to have a preference for path1, no matter the name.  Try for all 
names in path1, then move to path2, etc.

Is there a way to toggle this behavior?

Rob


Background...  Basically, I am using ExternalProject_Add to build a library.  
However, to make it possible to use the system-library instead, this is 
optional.  I use a FindThelib.cmake so the main project works seamlessly either 
way.

I'm targeting the case where a version of this library is installed on the 
system, but I want to use my own copy.

The name of the library depends on build options and platform, so controlling 
on the name is a little fragile.  However, I have explicitly built it in a 
known directory, so having preference for the known directory is desirable.

--

Powered by www.kitware.com<http://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://www.cmake.org/mailman/listinfo/cmake



--
+1 919 869 8849

-- 

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Path vs. name preference during search.

2014-02-13 Thread Rob McDonald
Jc,

That is an approach I have thought about.  I even think I have looked at
Slicer for how you work your CMake system.

I prefer to use project-supplied FindLIB.cmake (or a slightly modified
version thereof) because some of them do more than just setting LIBRARY,
INCLUDE_DIR, and FOUND variables.

Rather than duplicate everything done in the FindLIB.cmake script (which
can have platform-dependent logic), I have gone the path of encouraging the
FindLIB.cmake to find the one I want.

Rob



On Thu, Feb 13, 2014 at 10:09 AM, Jean-Christophe Fillion-Robin <
jchris.filli...@kitware.com> wrote:

> Hi Rob,
>
> Do address the use case you described, I usually explicitly set the path
> the library when built as an external project and rely only on the find_*
> command for the use_system case.
>
> See
> https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16
>
> Hth
> Jc
>
>
> On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald 
> wrote:
>
>> When I search for a given library, specifying multiple possible names and
>> multiple hints for paths...
>>
>> FIND_LIBRARY( FINDME_LIB
>> NAMES name1 name2 name3
>> HINTS path1 path2 path3
>> DOC "Library to find")
>>
>> CMake seems to have a preference for name1, and it first searches all
>> HINTS for name1.  If it doesn't find name1, it moves to name2 and then
>> searches all HINTS for name2, etc.
>>
>> I would prefer to have a preference for path1, no matter the name.  Try
>> for all names in path1, then move to path2, etc.
>>
>> Is there a way to toggle this behavior?
>>
>>  Rob
>>
>>
>> Background...  Basically, I am using ExternalProject_Add to build a
>> library.  However, to make it possible to use the system-library instead,
>> this is optional.  I use a FindThelib.cmake so the main project works
>> seamlessly either way.
>>
>> I'm targeting the case where a version of this library is installed on
>> the system, but I want to use my own copy.
>>
>> The name of the library depends on build options and platform, so
>> controlling on the name is a little fragile.  However, I have explicitly
>> built it in a known directory, so having preference for the known directory
>> is desirable.
>>
>> --
>>
>> 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://www.cmake.org/mailman/listinfo/cmake
>>
>
>
>
> --
> +1 919 869 8849
>
-- 

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://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Path vs. name preference during search.

2014-02-13 Thread Jean-Christophe Fillion-Robin
Hi Rob,

Do address the use case you described, I usually explicitly set the path
the library when built as an external project and rely only on the find_*
command for the use_system case.

See
https://github.com/Slicer/Slicer/blob/c5a39acf7af28ba82cc0097c84d1ebda89cce3b4/SuperBuild/External_teem.cmake#L13-16

Hth
Jc


On Thu, Feb 13, 2014 at 12:51 PM, Rob McDonald wrote:

> When I search for a given library, specifying multiple possible names and
> multiple hints for paths...
>
> FIND_LIBRARY( FINDME_LIB
> NAMES name1 name2 name3
> HINTS path1 path2 path3
> DOC "Library to find")
>
> CMake seems to have a preference for name1, and it first searches all
> HINTS for name1.  If it doesn't find name1, it moves to name2 and then
> searches all HINTS for name2, etc.
>
> I would prefer to have a preference for path1, no matter the name.  Try
> for all names in path1, then move to path2, etc.
>
> Is there a way to toggle this behavior?
>
>  Rob
>
>
> Background...  Basically, I am using ExternalProject_Add to build a
> library.  However, to make it possible to use the system-library instead,
> this is optional.  I use a FindThelib.cmake so the main project works
> seamlessly either way.
>
> I'm targeting the case where a version of this library is installed on the
> system, but I want to use my own copy.
>
> The name of the library depends on build options and platform, so
> controlling on the name is a little fragile.  However, I have explicitly
> built it in a known directory, so having preference for the known directory
> is desirable.
>
> --
>
> 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://www.cmake.org/mailman/listinfo/cmake
>



-- 
+1 919 869 8849
-- 

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://www.cmake.org/mailman/listinfo/cmake

[CMake] Path vs. name preference during search.

2014-02-13 Thread Rob McDonald
When I search for a given library, specifying multiple possible names and
multiple hints for paths...

FIND_LIBRARY( FINDME_LIB
NAMES name1 name2 name3
HINTS path1 path2 path3
DOC "Library to find")

CMake seems to have a preference for name1, and it first searches all HINTS
for name1.  If it doesn't find name1, it moves to name2 and then searches
all HINTS for name2, etc.

I would prefer to have a preference for path1, no matter the name.  Try for
all names in path1, then move to path2, etc.

Is there a way to toggle this behavior?

Rob


Background...  Basically, I am using ExternalProject_Add to build a
library.  However, to make it possible to use the system-library instead,
this is optional.  I use a FindThelib.cmake so the main project works
seamlessly either way.

I'm targeting the case where a version of this library is installed on the
system, but I want to use my own copy.

The name of the library depends on build options and platform, so
controlling on the name is a little fragile.  However, I have explicitly
built it in a known directory, so having preference for the known directory
is desirable.
-- 

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://www.cmake.org/mailman/listinfo/cmake