[CMake] Fwd: TARGET_LINK_LIBRARIES not working for MSVC

Eric Noulard eric.noulard at gmail.com
Sat Jan 8 11:34:59 EST 2011


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


More information about the CMake mailing list