[CMake] CMake: using dlopen

J Decker d3ck0r at gmail.com
Sat Jan 6 12:01:01 EST 2018


CMake/shared/modules will define the CMAKE_DL_LIBS  which a very high
percentage of the time will just be library 'dl' .

Pretty much any man page on dlopen defines 'dl'

http://man7.org/linux/man-pages/man3/dlopen.3.html

 Link with *-ldl*.

specifying just the library name adds it as a -L<libname> option to be
searched with standard library functions.

On Sat, Jan 6, 2018 at 8:41 AM, Franck Houssen <franck.houssen at inria.fr>
wrote:

>
> ------------------------------
>
> *De: *"J Decker" <d3ck0r at gmail.com>
> *À: *"Franck Houssen" <franck.houssen at inria.fr>
> *Cc: *"CMake Mail List" <cmake at cmake.org>
> *Envoyé: *Samedi 6 Janvier 2018 16:19:33
> *Objet: *Re: [CMake] CMake: using dlopen
>
> probably just need target_link_libraries( <target> dl )
>
>
> But so, who defined the dl target ?
>
>
> On Sat, Jan 6, 2018 at 6:34 AM, Franck Houssen <franck.houssen at inria.fr>
> wrote:
>
>> Hello,
>>
>> I have an executable that needs dlopen.
>>
>> Googled this a bit: seems (surprisingly) there is no FindDLUtils ?!..
>> Correct ? If so, why is this ?
>> My understanding is that I need to go:
>> ~BUILD> cmake -DCMAKE_LD_LIBS="-ldl -L/path/to/dl" ..
>> which is, basically, telling to CMake where dl is (although this is the
>> job of a build system, no ?!)
>>
>> Did I understand correctly ? Did I miss something ?
>>
>> Franck
>>
>> --
>>
>> 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:
>> https://cmake.org/mailman/listinfo/cmake
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180106/d62101b2/attachment.html>


More information about the CMake mailing list