iQChange:
You can disable linking of test.cpp. It is not recommended to do it this way, because this is not the way the build system is designed to work.
You are abusing it. So it is better to have two targets one for the dll and one for the executable as stahta01 suggested.