Linux has RPATH, so the shared library is found using that mechanism. There is no equivalent under Windows, so you must make sure the exe has access to the DLL when starting:
- either place the DLL into the same directory as the exe,
- or modify
PATH
when launching exe so that the directory with the DLL is in thePATH
This is not directly related to CMake, this applies to DLLs on Windows in general.