[CMake] relocatable build directory: howto?

Dave Abrahams dave at boostpro.com
Sat May 5 01:25:47 EDT 2012


I need to preserve the built-but-not-yet-installed state of some
projects, and the tool I'm driving CMake with moves the result of every
build step from a read-write build directory into a readonly cache.  The
result is that the generated cmake_install.cmake files no longer work,
because they are full of absolute paths.  I wrote a simple program to
adjust the paths in the cmake_install.cmake files as a postprocessing
step, replacing $CWD, where it is found, with a cmake variable.  The
only problem: on my Mac, /tmp is a symlink to /private/tmp, and in some
scenarios the absolute path in cmake_install.cmake is the short one
wheras while $CWD is the long one.  No match :(

I started to write some code to address this problem, but it's getting
complex to the point where it seems like "there must be a better way."
So I ask: is there?

Thanks in advance,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com




More information about the CMake mailing list