[CMake] Import library not generated under Visual Studio

Werner Smekal smekal at iap.tuwien.ac.at
Thu Jun 5 04:28:22 EDT 2008


Hi,

On 05.06.2008, at 10:18, Christian Ehrlicher wrote:

>> Von: Martin Apel
>> Hi all,
>>
>> I am trying to port a project using CMake 2.6 from Linux to  
>> Windows. The
>> project build works without problems under Linux. However when  
>> trying to
>> build the project inside Visual Studio 8 after having generated the
>> project files using CMake, no import libraries are generated.
>> The library build step is specified by using
>>  ADD_LIBRARY(Base SHARED EXCLUDE_FROM_ALL ${LocalSrc})
>> which I would expect to generate rules to create the DLL AND the
>> corresponding import library. The DLL is built, but the import  
>> library
>> is missing. Looking at the build log file in Visual Studio, there  
>> is no
>> call to lib.exe, which I would expect.
>> I am not a Windows specialist, so I may be missing something simple
>> completely.
>>
>> Any help would be appreciated.
>>
> cmake itself does not do anything to create an import lib. This is  
> all done by the linker. If it finds symbols which are exported, it  
> automatically creates the import lib.
> So it looks like you don't export any symbols.

Here is a link:

http://msdn.microsoft.com/en-us/library/a90k134d(VS.80).aspx

while gcc exports everything by default, visualc++ needs  
__declspec(dllexport) keyword. Or you need a .def file, but this is  
also explained in the link above.

Werner


More information about the CMake mailing list