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

Brad Aisa Brad.Aisa at Colorado.EDU
Tue Dec 16 15:58:04 EST 2008


> From: "Ladanyi, Akos" <ladanyi at tmit.bme.hu>
> Subject: [CMake] running executables linked to a dll in the build
> 	directory
> 
> 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?

YIKES! Some of those other answers were very complicated. Your suggestion 
is the best approach -- Windows automatically looks in the current folder 
for dlls (unlike Unix which has no default), so this is by far the easiest way.
  See also the CMAKE_RUNTIME_OUTPUT_DIRECTORY (I think that is what it is 
called) that you can set once, which then sets the RUNTIME_... 
automatically for your targets.

-- 
Brad Aisa
Department of Psychology
University of Colorado - Boulder


More information about the CMake mailing list