Re: [CMake] Cmake link trouble in Windows
On 10/23/2012 10:55 AM, Vyacheslav Karamov wrote: 1. I don't understand what did you mean, but I guess you want to create library test CMake will link to the right thing. The trick is symbols are not exported by default on windows. So, if you do not change your code, no symbols are exported, and the .lib is not created. See this: http://www.cmake.org/Wiki/BuildingWinDLL -- Bill Hoffman Kitware, Inc. 28 Corporate Drive Clifton Park, NY 12065 bill.hoff...@kitware.com http://www.kitware.com 518 881-4905 (Direct) 518 371-3971 x105 Fax (518) 371-4573 -- 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
Re: [CMake] Cmake link trouble in Windows
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 -- 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
Re: [CMake] Cmake link trouble in Windows
> 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 -- 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
[CMake] Cmake link trouble in Windows
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.SeemsWindowswill give priority tolinkstatic 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