I faced a problem when i migrated a project from Linux to windows for the visual studio seem can not use dll lib directly. I look through a number of materials and known i seem should use IMPORTED in add_library(...), but i can not find a practical example about how to use it and i used it like this:
add_library(hello_lib SHARED hello.c) add_library(hello_lib SHARED IMPORTED) And a ERROR happened
CMake Error at sub_haha/CMakeLists.txt:6 (add_library): add_library cannot create imported target "haha_lib" because another target with the same name already exists. Could you please give me one or some? BTW the dll lib seem could be used in Mingw makefile on windows.
target_link_librariescommand should used, as usual. Do not understand your problem.