[CMake] Dealing with dll PATH on Windows

KSpam keesling_spam at cox.net
Fri May 23 12:07:41 EDT 2008


Arjen,

On Thursday 22 May 2008 23:35:33 Arjen Markus wrote:
> Having CMake set the necessary registry entries would not help with
> binary distributions of your product. I do not whether that is relevant
> to you, but in general that would be a problem:
> - Your clients may have the libraries installed in a different place
> - They may have different versions
> - They may lack the permissions to install libraries

My concern is not for binary distributions.  For binary distributions, I 
create a NSIS installer that automatically sets PATH (we put all of our dlls 
in a single directory for distributions).

I am trying to make PATH easier to deal with for developers.  Our project 
keeps all dependency third party libraries in a single external directory.  
Developers will sometimes work with different versions of a library.  For 
instance, some developers will build with QT-4.3.3, and others will build 
with QT-4.4.0.  This is easy to handle on the build side with CMake.  The 
problem I run into is that two different versions of QT require different 
dlls, and I have to ensure that the path is set properly to find the correct 
version of the QT dlls.  I know exactly what the PATH needs to be from my 
CMake configuration variables.  I simply want to be able to apply that 
knowledge to set PATH automatically for users.

Using the add-in mentioned in my previous post would allow me to do this:

http://workspacewhiz.com/OtherAddins.html#SolutionBuildEnvironment
http://www.workspacewhiz.com/SolutionBuildEnvironmentReadme.html

In order to use the add in, I would need to generate a simple 
(one-line) .slnenv file for each .sln file generated.  I was enquiring as to 
the best way to add generation support for creating the .slnenv files.  I am 
guessing that I would actually have to modify the Visual Studio generator., 
but I am hoping for a less-intrusive solution.

Another possible solution would be to write out environment variables to the 
registry from CMake; however, it seems that writing to the registry is not 
currently possible.

Thanks,
Justin


More information about the CMake mailing list