[cmake-developers] [PATCH] New module FindLibDl

Roger Leigh rleigh at codelibre.net
Tue Nov 25 13:14:22 EST 2014


On Tue, Nov 25, 2014 at 11:41:46AM -0500, Brad King wrote:
> On 11/21/2014 02:59 PM, Chuck Atkins wrote:
> > dlopen defined in dlfcn.h is part of POSIX so generally if you're
> > on a *nix system then you can rely on it being there.  The associated
> > library, however, is a different story, hence CMAKE_DL_LIBS.
> 
> My initial reaction to Roger's post was to say that CMAKE_DL_LIBS was
> created very early in CMake and I think a module like FindLibDl would
> supersede it.  However, Chuck raises a valid point.  The dlfcn.h header
> may be in a toolchain-defined path so "finding" it ourselves may get
> the wrong one.  We don't have find modules for "unistd.h" for example.
> 
> Perhaps it is simplest to update the documentation of CMAKE_DL_LIBS
> to explain this.

I don't have a problem with using CMAKE_DL_LIBS, but I am reluctant to
use it unconditionally.  While it's true that most current unix systems
support it, looking at POSIX.1-2001 it's in XSI as an optional interface
so isn't strictly guaranteed to be present.  It would be really nice to
have an an accompanying variable e.g. CMAKE_DL_FOUND which confirms that
it's safe to use, since I can't infer this from an empty CMAKE_DL_LIBS
when it's part of the standard library.

It would be equally nice to know if common-but-nonstandard extensions
such as dladdr(3) were safe to use.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux    http://people.debian.org/~rleigh/
 `. `'   schroot and sbuild  http://alioth.debian.org/projects/buildd-tools
   `-    GPG Public Key      F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800


More information about the cmake-developers mailing list