[CMake] CMake: using dlopen

Franck Houssen franck.houssen at inria.fr
Sun Jan 7 08:58:21 EST 2018


----- Mail original -----
> De: "Roger Leigh" <rleigh at codelibre.net>
> À: cmake at cmake.org
> Envoyé: Samedi 6 Janvier 2018 18:42:11
> Objet: Re: [CMake] CMake: using dlopen
> 
> On 06/01/18 17:01, J Decker wrote:
> > CMake/shared/modules will define the CMAKE_DL_LIBS  which a very high
> > percentage of the time will just be library 'dl' .

OK. I didn't know that. But if so, why don't you see CMAKE_DL_LIBS when you run "cmake -LA ." and/or when you toggle adanced mode in ccmake ? What's the correct way to see all variables ?

> > 
> > Pretty much any man page on dlopen defines 'dl'
> 
> On Linux.  On MaxOSX and FreeBSD not at all, where the dl functions are
> in libSystem and libc, respectively.  Using CMAKE_DL_LIBS does the right
> thing on all platforms (though I wish it was an imported target to make
> exports a bit nicer).

OK, thanks. So, I go with: target_link_libraries(main PUBLIC ... ${CMAKE_DL_LIBS})

> 
> 
> Regards,
> Roger
> --
> 
> 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
> 


More information about the CMake mailing list