[CMake] cmake 2.6 : Issue in renaming the cmake executable on Linux

Michael Wild themiwi at gmail.com
Fri Jan 8 04:15:15 EST 2010


On 8. Jan, 2010, at 9:54 , Mahendra Ladhe wrote:

> Hi,
>    I've a Ubuntu 8.04.1 Linux machine and cmake version 2.4-patch 7 in /usr/bin/
> Due to project requirement, I installed cmake version 2.6-patch 4 under /usr/local/
> 
> I want to make sure that when I or other users execute cmake, by default it's always the 2.4 version in /usr/bin/cmake irrespective of PATH env var settings. Those who want
> to invoke cmake version 2.6 should explicitly use the full path.
> To ensure this I renamed the cmake 2.6 executable under /usr/local/bin/cmake to
> /usr/local/bin/cmake-2.6
> 
> But this renaming is causing problems as follows.
> 
> root at linux:/usr/local/bin#  ./cmake-2.6 --version
> CMake Error: CMake executable cannot be found at /usr/local/bin/cmake
> Segmentation fault
> 
> mladhe at linux:~/bld] /usr/local/bin/cmake-2.6 ..
> CMake Error: CMake executable cannot be found at /usr/local/bin/cmake
> CMake Error: Error executing cmake::LoadCache(). Aborting.
> 
> I did the renaming so that plain 'cmake' always refers to version 2.4 under /usr/bin
> irrespective of PATH setting.
> 
> What could be the reason for choosing above behaviour by cmake implementors ?
> 
> Thank you,
> Mahendra
> 

Well, that's because the name "cmake" is hard-coded in cmake.cxx. If you really want to force users to use the full path, you shouldn't put it in /usr/local/bin anyways. I suggest you put it in e.g. /opt/software/cmake-2.6.4 without any renaming. You might also want to have a look into http://modules.sf.net in order to manage heterogeneous environments, where you have multiple versions of the same software installed and want to make them available to the user with as little fuzz as possible. If you set it up correctly, a user can just type "module add cmake/2.6" and the environment will be set up to use this installation instead of the default one...


Michael



More information about the CMake mailing list