[CMake] How to specify that a target link library is shared ?

Andy Lego andy at legoandy.com
Tue Oct 7 12:16:38 EDT 2008


Hello,

The problem is that you are not exporting any symbols in your library.

On Windows even with shared libraries you have a .lib file that describes
all the exported symbols.

Andy

On Tue, Oct 7, 2008 at 9:05 AM, Andrea Borsic
<Andrea.Borsic at dartmouth.edu>wrote:

> Dear All,
>
> I am a recent user of CMake, and I cannot figure out how to tell CMake that
> a TARGET_LINK_LIBRARY is shared. I am working under Windows Xp with MS
> VisualStudio 2008, and the following is my CMakeLists file:
>
> PROJECT(Triangle)
>
> ADD_LIBRARY(triangle_lib SHARED triangle.c)
>
> ADD_EXECUTABLE(tricall tricall.c)
>
> TARGET_LINK_LIBRARIES(tricall triangle_lib)
>
> With the first target I am building a shared library 'triangle_lib.dll' and
> with the second target I'd like to build an executable 'tricall' that links
> to such library.
>
> Linking fails, as VS 2008 is looking for the static library
> 'triangle_lib.lib'. I have been searching the forums, and came across an
> example: TARGET_LINK_LIBRARIES(tricall SHARED triangle_lib), but then the
> linker looks for SHARED.lib, so 'SHARED' in not interpreted as a keyword but
> as the name of a library.
>
> Does anybody know how I should specify that I am linking against a shared
> library ?
>
> Thanks in advance for your advice,
>
> Best Regards,
>
> Andrea
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
Lets bike the world together
http://legoandy.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081007/04cd2ae2/attachment.htm>


More information about the CMake mailing list