On 5. Feb, 2010, at 14:37 , Surya Kiran Gullapalli wrote:

> Hello all,
> I'm using CMake-2.8 on winxp with Visual Studio 2005 generator.
> 
> lets say I've a dll created (A.dll) from some cxx files and a static library
> static.lib
> 
> So I call Link_Directories to specify the directory where the static library
> is located.
> Now A.dll is built fine.
> 
> Now I want B.dll built from some cxx sources, A.lib (the import lib of
> A.dll)
> 
> Now when I say Target_Link_Libraries for (B A), the project file is created
> with static.lib also as a dependency.
> Now B has two dependencies A and static.lib. But I'm not adding the
> directory of static.lib to Link_Directories for B and my build fails.
> 
> I do not think B needs to know about static.lib
> 
> Any Ideas how to avoid this ?
> 
> Thanks in advance,
> Surya
> 

B might need to know about static.lib due to the nature of static linking. 
CMake can't detect that and thus always assumes that a static library is part 
of the link-interface. If, however, you know that static.lib is an 
implementation detail of A, then you can use the LINK_INTERFACE_LIBRARIES 
target property of A to explicitly specify its transitive link dependencies.


And please, don't use LINK_DIRECTORIES anymore. It is much better to specify 
the full path to static.lib in the TARGET_LINK_LIBRARIES call.


Michael
_______________________________________________
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

Reply via email to