[CMake] CMake with MinGW = .def and lib files

Eric Noulard eric.noulard at gmail.com
Wed Sep 26 09:51:23 EDT 2007


Hi All,

I'm using CMake on Windows with a mingw compiler.
I wanted to produce .def (and .lib) files corresponding to my DLL
in order to be enable my user using MSVC to use the DLL
as explained here:
http://www.mingw.org/mingwfaq.shtml#faq-msvcdll

For now I have added line likes this:

ADD_LIBRARY(GHA <list-of-sources>)

IF (MINGW)
    SET_TARGET_PROPERTIES(GHA PROPERTIES LINK_FLAGS
"-Wl,--output-def,${LIBRARY_OUTPUT_PATH}/libGHA.def")
    INSTALL(FILES ${LIBRARY_OUTPUT_PATH}/libGHA.def
            DESTINATION lib)
ENDIF (MINGW)

I have added this for each lib I build which is just a pain
(even if I do not have too much lib)

would'nt it be possible to add such feature "globally" for all
(shared) libs I create using MinGW?

Does any of you did this before?
If yes How may I do that?
If no is it worth a feature request?

One last question which may be out of "cmake" subject
Do I need to build the .lib files with MSVC LIB tool or
is there a way to use MSVC directly with .def files?

-- 
Erk


More information about the CMake mailing list