[CMake] Cmake link trouble in Windows

Vyacheslav Karamov ubuntulist at yandex.ru
Tue Oct 23 10:55:18 EDT 2012


Hi!

1. I don't understand what did you mean, but I guess
you want to create library test

ADD_LIBRARY(test SHARED ${FAN_SRC})

then you wanted to specify in which directory some libraries should be 
searched

LINK_DIRECTORIES(${ACE_LIB_DIR})

and then you tried to link library ACE with your target (which is 
probably created by code which was not provided) fan.


23.10.2012 16:59, 张峰 пишет:
> hello:
> 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 ?
> Waiting for your letter.
> With Best Wishes !!
>
>
>
>
>
> --
>
> 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



More information about the CMake mailing list