[CMake] Executable project creating an import library
Stefan Buschmann
s_buschmann at gmx.de
Sat Jan 24 12:16:18 EST 2009
Robert Dailey schrieb:
> I've specified a very complex CMake script that generates an
> executable project. When I use this CMake script to generate a Visual
> Studio 2008 project, the "Import Library" property located in Project
> Settings >> Linker >> Advanced property page in Visual Studio 2008 has
> a value, specifically the absolute path to the LIB file that will be
> generated. I have no idea why this value is being filled in when I
> specifically called CMake's add_executable() on this project.
It is possible to create an executable and export symbols from it, which
can be convenient e.g. to export an API from an application to a plugin.
In this case you have an .EXE and can link to it the same way you would
do it with a DLL, using an import library (.LIB). So if you get a .LIB
from your executable, I would guess that you are accidentally exporting
symbols in you project (especially if it's a complex project as you
said). Do you use any EXPORT macros that evaluate to
__declspec(dllexport)? If yes, check that those macros are undefined
when you compile your executable, so that no symbols are exported. If no
symbols are exported from your project, no .LIB file will be created.
That said: Is that .LIB-file actually generated during the build? If not
(if you are not exporting any symbols), you can safely ignore that
setting in the project. I guess that CMake enters this option
automatically for every project, because it can not know at generation
time if this project will export any symbols or not. But if no symbols
are exported, there is also no .LIB file generated.
Stefan
More information about the CMake
mailing list