[CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

Martin O'Brien martin.matthew.obrien at gmail.com
Sat Jan 8 15:46:16 EST 2011


Glad I could help.

 

mm

 

From: Avanindra Singh [mailto:avanindra.singh at gmail.com] 
Sent: Saturday, January 08, 2011 3:45 PM
To: Martin O'Brien
Cc: CMake mailing list
Subject: Re: [CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

 

Hi Martin,

 

You are right. I messed up between shared and static libraries. There is a
jpeg lib, which I was initially building as static lib and linking to the
main project and I don't know why

it was not getting linked. I built it as SHARED lib  and the whole project
compiled successfully.

 

Thanks A lot.

 

Hi Eric,

 

Thanks for the  <http://www.cmake.org/Wiki/BuildingWinDLL> BuildingWinDLL
link. It was very helpful.

 

 I compiled the lib as SHARED (the library which was not found by the
linker) and project compiled sucessfully.

Though I still don't understand why was it not getting linked when I
compiled it as STATIC library? 

 

Thanks a lot for replying my questions.

 

Regards

Avanindra  

 

On Sat, Jan 8, 2011 at 10:27 PM, Martin O'Brien
<martin.matthew.obrien at gmail.com> wrote:

If you're seeing a 'Librarian' tab instead of a 'Linker' tab, then you're
building a static library, not a dll.

I'm not sure which you are expecting.

Could you post the results of the build?  Seeing the actual errors would
help.


mm


-----Original Message-----
From: cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] On Behalf Of

Eric Noulard
Sent: Saturday, January 08, 2011 11:35 AM
To: Avanindra Singh
Cc: CMake mailing list

Subject: Re: [CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

2011/1/8 Avanindra Singh <avanindra.singh at gmail.com>:
> Hi Eric,
> Thanks for the reply. It was very useful. I incorporated the changes you
> mentioned. I removed all the link_libraries macros
> from the projects. Also I changed camke_minimum_version to 2.6 . I have
> CMake 2.8 in both windows as well as Linux. Though
> I am still getting the same errors.I would strip the project down to one
or
> two lib and I would get back with the results.
> Though one point I would like to mention, the linker problem is coming for
> all the libraries in project added through
> ADD_LIBRARY macro.

Do you handle the visibility of symbols in libraries properly?
On Linux the [usual] default is to have all symbol exported whereas
it's the converse on Windows (no symbol exported unless specified).

You have to use
__declspec(dllexport)
__declspec(dllimport)
statement in the Windows case.

See:
http://www.cmake.org/Wiki/BuildingWinDLL

--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110108/53a98650/attachment.htm>


More information about the CMake mailing list