[CMake] DLL Question

Werner Smekal smekal at iap.tuwien.ac.at
Wed Jan 21 10:34:45 EST 2009


Hi,

> I am building a program with CMake and compiling it with visual
> studio 2005 (VC 8). The program needs some .dll files which do not
> exist in the output directory in which the output executable file is  
> written.
> So when I run the program, I get the message that a dll file is  
> missing etc.
> My question is: can I tell the program in CMake where the dll files  
> are?

CMake has not much to do with this, you could write a custom command  
to copy the dlls into the same directory where the executable is. But  
there is no need for that. You just must make sure, that the dlls are  
found. Read this:

http://msdn.microsoft.com/en-us/library/7d83bc18(VS.80).aspx

So either add the directory of the dlls to the PATH environment  
variable, either system wide or only for the application, or put it in  
the Windows directory (wouldn't do that ;).

> Or can I force the program to link these dlls at linking-time so that
> they are not needed at runtime?

For this you would need static libraries not shared ones. It's the  
purpose of the shared libraries not to be linked in into the program.

Regards,
Werner

>
> Many thanks,
> Zein
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake

--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: smekal at iap.tuwien.ac.at
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499



More information about the CMake mailing list