Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
136 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...