[CMake] install multiple versions of CMake on your system

Michael Ellery mellery451 at gmail.com
Sun Jun 23 19:58:31 EDT 2019


If you are using the shell archive from cmake.org, it supports a —prefix and —exclude-subdir option, e.g.:

cd /tmp
CM_INSTALLER=cmake-3.14.0-Linux-x86_64.sh
CM_VER_DIR=/opt/local/cmake/3.14
wget https://cmake.org/files/v3.14/$CM_INSTALLER
chmod a+x $CM_INSTALLER
mkdir -p $CM_VER_DIR
./$CM_INSTALLER --prefix=$CM_VER_DIR --exclude-subdir
rm /tmp/$CM_INSTALLER

…or if you use the tar archive, you can similarly unpack it anywhere you like.

If you are building from source, I would assume CMAKE_INSTALL_PREFIX would be the way to go.

-Mike


> On Jun 23, 2019, at 3:26 PM, hex <hex7c3 at gmail.com> wrote:
> 
> hello,
> 
> I'd like to install CMake under /usr/local/cmake/3.15/bin/ or similar.
> 
> Is it possible to add the version number to a build option, like -DCMAKE_INSTALL_PREFIX
> 
> or do I need to modify CMake sources?
> 
> 
> thank you
> 
> -- 
> 
> Powered by www.kitware.com
> 
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
> 
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
> 
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
> 
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
> 
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake



More information about the CMake mailing list