how to use cmake that installed in a non-standard path?

自闭症网瘾萝莉.ら 提交于 2019-12-13 23:30:29

问题


I am on Ubuntu 14.04.3 platform. While I was compiling a project it asked cmake version 3.2 which is not present in my system. I compiled the latest version of cmake from source code and installed it into /usr/local/bin directory. When I attempt to compile project again, its cmake detects the cmake in /usr/bin which is lower version. Then cmake ..

process aborts with lower version error. Is there any built-in cmake variable or environment variable for setting path of the cmake?

EDIT: I just found a cmake variable CMAKE_COMMAND that supposedly does what I want. But when I insert CMAKE_COMMAND = /usr/local/bin/cmake line into cmakelist.txt then I go to build directory and issue /usr/local/bin/cmake .. I get :

  Expected a command name, got unquoted argument with text

I searched for it on the net but didn't find a solution.


回答1:


If you have different versions of a software or library installed you may use stow to install and switch between the two. Especially if you want to install a newer version of a software that is not available in one's Linux distribution. So in case the new version is not yet stable you can still switch to the previous one. For example while building cmake 3.2 you can specify the prefix as

./configure --prefix=/usr/local/stow/cmake-3.2/

and then

cd /usr/local/stow
sudo stow cmake-3.2

and if you want to remove the links you can use the following command

sudo stow --delete cmake-3.2

Please keep in mind stow does not delete files. It only makes and deletes links.



来源:https://stackoverflow.com/questions/32828980/how-to-use-cmake-that-installed-in-a-non-standard-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!