[CMake] Import library not generated under Visual Studio

Martin Apel martin.apel at simpack.de
Thu Jun 5 04:31:19 EDT 2008


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.
>
>
> Christian
>
>   
Thanks for your help. I found out, that I had written the macro 
containing declspec(export) enclosed by #ifdef WINDOWS instead of #ifdef 
WIN32. As a result no symbols were exported, so no import library was 
generated.

Best Regards,

Martin


More information about the CMake mailing list