[CMake] running executables linked to a dll in the build directory

Alexander Neundorf a.neundorf-work at gmx.net
Mon Dec 15 16:56:07 EST 2008


On Monday 15 December 2008, Ladanyi, Akos wrote:
> Hi,
>
> My source tree consists of a library, and some test programs for the
> library. The library is built as a dll, and the test programs link
> against the import library of this dll. When I try to run the test
> programs (in the build tree), they fail, because they can not find the
> dll. What is the proper way of solving this with CMake?
>
> The only solution I found in the archives is setting
> RUNTIME_OUTPUT_DIRECTORY so that the dll and the executables end up in
> the same folder. Is there a better way?

Not really.
Uaing add_custom_command() you could add a PRE_LINK step which writes a batch 
file which sets PATH and then executes the executable.
Not very nice, but also a way to make it work.

Alex


More information about the CMake mailing list