I'm writing a simple lib, using cmake to do package management. Recently I come across a problem when link the lib to a test program. Here is a minimal cmake file.
PROJECT(hello)
add_library(hello SHARED hello.cpp)
add_executable(hello_test hello_test.cpp)
target_link_libraries(hello_test hello)
when building the hello_test target, the hello_test tries to link hello.lib instead of hello.dll. But the hello target is shared, which doesn't generate hello.lib.
So my question is how to force the hello_test to link against hello.dll?