[CMake] ExternalProject and Installing with sudo

Pritchett-Sheats, Lori lpritch at lanl.gov
Wed Jul 24 18:06:25 EDT 2013


I have a CMake project that builds and installs several external libraries and tools using the ExternalProject_Add. Works very well, however I would like to add the capability to install the external projects in a directory that requires sudo without forcing the user to also build, config, etc. as sudo. I discovered that if I have the INSTALL_DIR parameter in the ExternalProject_Add command set to a directory that requires sudo to create, cmake fails because it attempts to  create the directory and of course it can't without 'sudo cmake ... '

Has anyone done this? I'm not sure where to start. I have set the EP_STEP_TARGETS property to define targets for each step and I wanted to do something like this, 'make eproj-download eproj-config eproj-build; sudo make eproj-install', but the error with INSTALL_DIR has prevented that solution. I could remove the INSTALL_DIR definition and rely on the INSTALL_COMMAND to create these directories, but I'm reluctant to do that.



Lori A. Pritchett-Sheats
Los Alamos National Laboratory
CCS-2, Computational Physics
505-665-6675
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130724/ce2ba18e/attachment.htm>


More information about the CMake mailing list