[CMake] find_library setting search path order
vivek goel
goelvivek2011 at gmail.com
Wed Jun 6 15:15:58 EDT 2012
aha.
Thanks
The command
find_library(PCRE_LIBRARY pcre
PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib
)
is working perfectly issue was that it was reading the variable value from
the cache after deleting cache it is finding library
at {CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib
regards
Vivek Goel
On Thu, Jun 7, 2012 at 12:12 AM, David Cole <david.cole at kitware.com> wrote:
> Please cc the list so others may benefit from the discussion.
>
> Then you need two find_library calls. One to find it in your custom
> directory with NO_DEFAULT_PATH, and then if it's not there, the same call
> again without the NO_DEFAULT_PATH.
>
>
> HTH,
> David
>
>
> On Wed, Jun 6, 2012 at 2:25 PM, vivek goel <goelvivek2011 at gmail.com>wrote:
>
>> on some system library will be there at given path and on some system it
>> will not.
>>
>> The reason for which I want use find_library is that:
>> If library file is there at given location use it
>> otherwise use system library.
>>
>> Which can't be possible by hard coding the path.
>>
>>
>> regards
>> Vivek Goel
>>
>>
>>
>> On Wed, Jun 6, 2012 at 11:51 PM, David Cole <david.cole at kitware.com>wrote:
>>
>>> Try reading the documentation and using the "NO_DEFAULT_PATH" keyword
>>> if you don't want to look in the default places.
>>>
>>> On the other hand, if you know exactly where the library is, why are you
>>> doing a find_library operation? Why not simply set the variable to the
>>> value you know?
>>>
>>>
>>> On Wed, Jun 6, 2012 at 1:36 PM, vivek goel <goelvivek2011 at gmail.com>wrote:
>>>
>>>>
>>>> regards
>>>> Vivek Goel
>>>>
>>>>
>>>>
>>>> On Wed, Jun 6, 2012 at 11:05 PM, vivek goel <goelvivek2011 at gmail.com>wrote:
>>>>
>>>>> sorry for typo it was path.
>>>>>
>>>> path=paths :)
>>>>
>>>>> but still it doesn't work
>>>>> find_library(PCRE_LIBRARY pcre
>>>>> HINTS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib
>>>>> PATHS ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib
>>>>> )
>>>>>
>>>>> again output is /usr/lib/x86_64-linux-gnu/libpcre.so
>>>>>
>>>>> regards
>>>>> Vivek Goel
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jun 6, 2012 at 10:52 PM, Andreas Pakulat <apaku at gmx.de> wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> On Wed, Jun 6, 2012 at 5:40 PM, vivek goel <goelvivek2011 at gmail.com>wrote:
>>>>>>
>>>>>>> I am using following command to find pcre library
>>>>>>>
>>>>>>> SET(CMAKE_LIBRARY_PATH
>>>>>>> "${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib")
>>>>>>> All compiled library are located in
>>>>>>> ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib
>>>>>>>
>>>>>>> find_library(PCRE_LIBRARY
>>>>>>> pcre
>>>>>>> PATH
>>>>>>> ${CMAKE_SOURCE_DIR}/lib/linux/gcc/${BIT}/lib}
>>>>>>>
>>>>>>> But every-time it is searching at
>>>>>>> /usr/lib/x86_64-linux-gnu/libpcre.so. How can I change order for library
>>>>>>> search path ?
>>>>>>>
>>>>>>
>>>>>> See the documentation for the function:
>>>>>> http://cmake.org/cmake/help/v2.8.8/cmake.html#command:find_library
>>>>>>
>>>>>> As you can see 'PATH' is an unknown parameter for the function
>>>>>> anyway. You probably want to provide HINTS. The exact logic of finding the
>>>>>> libraries is explained there too.
>>>>>>
>>>>>> Andreas
>>>>>>
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> regards
>>>>>>> Vivek Goel
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> Powered by www.kitware.com
>>>>>>>
>>>>>>> Visit other Kitware open-source projects at
>>>>>>> http://www.kitware.com/opensource/opensource.html
>>>>>>>
>>>>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>>>>
>>>>>>> Follow this link to subscribe/unsubscribe:
>>>>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>>
>>>> Powered by www.kitware.com
>>>>
>>>> Visit other Kitware open-source projects at
>>>> http://www.kitware.com/opensource/opensource.html
>>>>
>>>> Please keep messages on-topic and check the CMake FAQ at:
>>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>>
>>>> Follow this link to subscribe/unsubscribe:
>>>> http://www.cmake.org/mailman/listinfo/cmake
>>>>
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120607/bf921168/attachment.htm>
More information about the CMake
mailing list