On Sun, Nov 15, 2009 at 09:37:31PM +0800, Cheng Zhigao wrote: > The project name is TEST, i put the external library in a folder named > ${TEST_SOURCE_DIR}/epanet/ which contains the epanet2.h epanet2.lib > and epanet2.dll files. I use the Include_directories and > link_directories to point to the /epanet/ folder. And i use > TARGET_LINK_LIBRARIES to link the library. However, i still have to > put the full path like ${TEST_SOURCE_DIR}/epanet2/epanet2.lib to link > to the library including file extension. And I do not know how to link
link_directories() + target_link_libraries() should work. Maybe the problem has to do with your confusion on this issue: > to the epanet2.dll file. I have to manually copy the dll file in order > to make the code to work otherwise it will complain cannot find the > .dll file. How can i do that in cmake so that both the .lib file and > .dll file will be linked without manual actions? Thanks. You don't link against a dll. You link against the import library (.lib) and then the DLL must be available to your application at runtime. There's a page in the CMake wiki with more details about building libraries on Windows. tyler _______________________________________________ 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