[Cmake] Symbolic pathname translation

Amitha Perera perera at cs.rpi.edu
Sun Jan 6 15:13:37 EST 2002


Hi all

I've just committed a change that allows the pathnames generated by
CMake to maintain symbolic links. If cmake is invoked with two
paths--the first to the source directory, the second to the output
directory--those paths will be used "as is" to refer to the roots of the
source and output trees. I call this pathname translation, and is only
enabled with this special two directory invocation. It shouldn't break
cmake for anyone. If it does, please let me know and I'll try fix it.

To illustrate further: suppose your source and output directories are
/my/src and /my/bin, and on your machine (my.machine), these are
symbolic links to a locally mounted disk:

   my.machine:  /my/src   links to /localdisk/src
   my.machine:  /my/bin   links to /localdisk/bin

If you run CMake as normal

   cd /my/bin; cmake /my/src

all the paths will refer to /localdisk/src and /localdisk/bin. Suppose
these disks are network mounted on a different machine (other.machine)
as

   other.machine:  /my/src  links to  /nfs/my.machine/src
   other.machine:  /my/bin  links to  /nfs/my.machine/bin

Then, attempting to compile the source or to run dynamically linked
executables on other.machine will fail because all references to
/localdisk are invalid.

If, my.machine, you run CMake with pathname translation

   cd /localdisk/bin;  cmake /my/src /my/bin

Then CMake will automatically replace all references to /localdisk/src
with /my/src and to /localdisk/bin with /my/bin. Assuming /my/src and
/my/bin are valid aliases network-wide, then all is well on
other.machine.

For pathname translation to be enabled, the symbolic source and output
directories must be absolute paths, and the output directory must
refer to the current directory. (I.e. cmake must be run from the
output directory.)

Amitha.



More information about the CMake mailing list