[CMake] CMAKE_SHARED_LIBRARY_PREFIX is blank on msvc?

Bill Hoffman bill.hoffman at kitware.com
Sun Nov 15 12:18:40 EST 2009


Tyler Roscoe wrote:
> On Sat, Nov 14, 2009 at 07:01:23PM -0500, David Manura wrote:
>> CMAKE_SHARED_LIBRARY_PREFIX is blank on MSVC, unlike on most platforms
>> (MinGW included):
> 
> I don't know how to solve your problem but none of the Windows libraries
> I've seen use the convention of putting "lib" at the beginning of
> library names. CMake is simply doing what most VS developers would
> expect.
> 
So, on linux/unix systems lib goes in front of the library so that it 
can be used with -l.  For example libfoo.a or libfoo.so can be linked 
with -lfoo.  However on windows there is no implied prefix with linking, 
to link library foo you put foo.lib on the link line.  That will link to 
foo.lib which might be a static library or an import library for 
foo.dll.   So, by adding lib to foo.lib on windows libfoo.lib, you have 
changed the name of the library from foo to libfoo.

-Bill


More information about the CMake mailing list