How to find dll's on Cygwin?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to find dll's on Cygwin?

Alan W. Irwin
What CMake logic should be used to find the Cygwin dll

/usr/bin/cyggnat-6.dll

?

I don't have access to Cygwin myself, but my PLplot colleague, Arjen
Markus who does have such access has reported to me off-list that

find_library(GNAT_LIB NAMES gnat gnat-${GNAT_VERSION} gnat-${GNAT_MAJOR_VERSION} cyggnat-${GNAT_MAJOR_VERSION})

does not find /usr/bin/cyggnat-6.dll when GNAT_MAJOR_VERSION is 6.
Note that find was a failure even when he included /usr/bin in
CMAKE_LIBRARY_PATH .

To find dll's this way (rather than import libraries) do I have to use
find_file instead, e.g.,

# Take care of non-Cygwin cases:
find_library(GNAT_LIB NAMES gnat gnat-${GNAT_VERSION} gnat-${GNAT_MAJOR_VERSION})
# Take care of Cygwin case. (Note /usr/bin does not have to be added to
# CMAKE_LIBRARY_PATH for this case.)
find_file(GNAT_LIB NAMES cyggnat-${GNAT_MAJOR_VERSION}.dll)

?

Or is there some slick way to accommodate both non-Cygwin and Cygwin
platforms with one call to find_library?

<Aside> For a long time it puzzled Arjen and me that our test_ada
project Ada library could be linked with the above dll by hand when
normally you use an import library for that purpose.  But we were
forced to try that because the Cygwin distribution does not provide an
import library corresponding to /usr/bin/cyggnat-6.dll.  And it worked
by hand so now we have to convince CMake to do the same starting with
finding the dll to be used to link our Ada library.

Note the reason why the dll can be used this way is explained with the
following quote from
<https://stackoverflow.com/questions/3573475/how-does-the-import-library-work-details>:

"If you use the GCC toolchain, incidentally, you don't actually need
import libraries to match your DLLs. The version of the Gnu linker
ported to Windows understands DLLs directly, and can synthesize most
any required stubs on the fly."

</Aside>

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________
--

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://public.kitware.com/mailman/listinfo/cmake