[CMake] The Windows equivalent of RPATH?

Arjen Markus arjen.markus at wldelft.nl
Fri Sep 22 03:18:05 EDT 2006


Hello,

in the PLplot project we have run into an issue that is peculiar
to Windows:

When you build the various libraries that PLplot consists of, they
end up in different directories (at least before installation).
On UNIX and Linux these directories are taken care of via the
RPATH mechanism, so that the example/test programs "know" where
to find them, without actual installation.

On installation again the RPATH mechanism makes sure the
directories where the shared libraries live are known.

On Windows, however, there is as far as I know, no such mechanism.
We need to rely on the search path for the DLLs to be found. And
currently that means that we need to copy the DLLs into the directories
holding the example/test programs (there are different directories
for all the programming languages we support). Otherwise the
example/test programs can not be run.

My question is: what is the best way to solve this problem?

I can see a couple of solutions:
- Copy the various DLLs via a custom target - now we do it manually
- Expand the path just before running the example/test programs
- (A brute force method would be to copy the DLLs into the system
  directory, but that is not acceptable to many people: pollution
  of the system directory, on many Windows machines this is not
  even allowed without special permissions etc.)

Is there a better solution?

Regards,

Arjen





More information about the CMake mailing list