[CMake] implib option for linker on Win32
dohadwala, moiz
dohadwala_moiz at emc.com
Thu Aug 4 14:31:33 EDT 2005
David,
I have tried adding the the .def file to the sources but that did not add
the /implib Linker option to the link command in the make file.
Wbat does work is the following:
IF (${CMAKE_SYSTEM_NAME} EQUAL WINDOWS)
SET ( ELM_LINK_FLAGS "/implib:elm.lib /def:filename.def" )
SET_TARGET_PROPERTIES( elm PROPERTIES LINK_FLAGS "${ELM_LINK_FLAGS}"
)
ENDIF (${CMAKE_SYSTEM_NAME} EQUAL WINDOWS)
-Moiz
-----Original Message-----
From: David Cole [mailto:david.cole at kitware.com]
Sent: Thursday, August 04, 2005 5:22 AM
To: dohadwala, moiz
Cc: 'Brad King'; cmake at cmake.org
Subject: Re: [CMake] implib option for linker on Win32
Actually, I'm pretty sure that CMake supports both "options 2 and 3"
from the Microsoft article you referenced.
Option 2 is "using a def file" - CMake supports this: simply add the .def
file as a source to your target (as you would a .c or .cxx/.cpp file).
Option 3 is passing "/EXPORT:entryname[, at ordinal[,NONAME]][,DATA]" to the
linker on the linker command line. This is Microsoft linker specific, of
course, but you can instruct CMake to use such a linker option by using a
construct like this:
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS}
/EXPORT:MyExportedFunction")
Hope this helps,
David
dohadwala, moiz wrote:
>Brad,
>
>Actually, __declspec(dllexport) tags are not necessary to export
>symbols, these can be specified in an external .def file.
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore
>/html
>/_core_.2f.implib.asp explains this.
>
>Cmake does not support options 2 or 3. I think it should and I believe
>it shouldn't be to hard to do it. But it is easier for me to say ;-).
>
>-Moiz
>
>-----Original Message-----
>From: Brad King [mailto:brad.king at kitware.com]
>Sent: Monday, August 01, 2005 6:24 AM
>To: dohadwala, moiz
>Cc: cmake at cmake.org
>Subject: Re: [CMake] implib option for linker on Win32
>
>dohadwala, moiz wrote:
>
>
>>I am trying to create a shared library on windows. The cmake project
>>creates the dll, but it does not create the import library. What
>>options/commands should I provide to get the import library to be
>>
>>
>generated?
>
>You need to put __declspec(dllexport) tags in your source code to tell
>the compiler/linker what symbols to export from the dll. By default
>nothing is exported. This is not a CMake issue, it is just standard
Windows DLL stuff.
>
>-Brad
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake
>
>
>
>
More information about the CMake
mailing list