[CMake] Cmake link trouble in Windows
John Drescher
drescherjm at gmail.com
Tue Oct 23 10:52:59 EDT 2012
> Thanks for your help。 but now i am in another trouble.
> In Windows,i am trying to build a shard library,It needs to link dynamic
> library and static library。
> when i want to link a dynamic library,it comes:
> (fatal error U1073:does not know how to generate "ACE.lib")
>
> AUX_SOURCE_DIRECTORY(. SRC)
> ADD_LIBRARY(test SHARED ${FAN_SRC})
> LINK_DIRECTORIES(${ACE_LIB_DIR})
> TARGET_LINK_LIBRARIES(fan ACE)
>
> 1. Actually, "test" should link "ACE.dll",how to make test link to ACE.dll ?
>
> 2.if i use LINK_LIBRARIES() instead of TARGET_LINK_LIBRARIES(),this may
> work,why ??
>
> AUX_SOURCE_DIRECTORY(. SRC)
> LINK_DIRECTORIES(${ACE_LIB_DIR})
> LINK_LIBRARIES(ACE)
> ADD_LIBRARY(test SHARED ${FAN_SRC})
>
> 3.Seems Windows will give priority to link static library,but i need to
> link dynamic library in my projects ,how could i do ??
>
> 4.how do TARGET_LINK_LIBRARIES() and LINK_LIBRARIES() determine what kind of
> library to link ? DO i need to use LINK_LIBRARIES(ACE.dll) instead of
> LINK_LIBRARIES(ACE) in Windows ?
>
You do not link to DLLs on windows. You link to import libraries when
using dlls. During the dll creation it should create a .lib along with
the .dll.
John
More information about the CMake
mailing list