1) When using cmake, is there a standard way to make the binaries be put in /usr/local/bin
?
I'm trying to better understand cmake, especially the major phases, which I think are configure, make, and install.
I want to better understand which directories are used by default and why, for these:
- source - code and other source files,
- build - scratch pad or working directory
- binary - for newly created binaries
- other - for things like man pages
I'm pretty new to Linux and started by making a fresh version of cmake, (which I need to use for another project), as follows:
Download cmake's source file:
cmake-3.6.2.tar.gz
from here.Put it's contents into
/usr/local/src/cmake-3.6.2
, (Debian Jessie).Then run
sudo ./configure
,sudo make
and finallysudo make install
.
By default it seemed to:
Read source from the place you explicitly tell it, e.g.
cd /usr/local/src/project; cmake .
Use
/usr/local/src/cmake-3.6.2
as it's working build directory, (perhaps because it was the current directory in step 1), creating many new directories and files there, andCreate its new executables in:
/usr/local/src/cmake-3.6.2/bin
So I'm confused. I would have thought that by default a sudo install
would have installed cmake in such a way into my system as to make it generally visible anywhere.
??? I'm not sure, but think the best way to make system resources visible is to either 1) locate the binaries, or 2) soft links to them, in folders somewhere in the standard PATH
. In other words, don't extend PATH with each and every new set of binaries.
Is it possible to have cmake put the binaries in /usr/local/bin
by default?
Yes I can make manual bin links:
I'm not asking this question because making these links is hard, but because I think I might be missing something that just does this without me having to. Also bin files are just one of the outputs. There are also things like man pages and how do those get hooked up?
My standard path is
.:/home/<myusername>/bin:/usr/local/bin:/usr/bin:/bin
.So I created links in
/usr/local/bin
pointing to these executables (usingcd /usr/local/bin; ln -s ../src/cmake-3.6.2/bin/*
).Now I can run
cmake --version
from anywhere.
I can also see that cmake uses two main directories
I noticing that cmake had not, by default, built the gui tool, so I found instructions (ref page) and built the gui tool, (and as above created a link to use it from within my standard path).
Then I opened the GUI tool and tried to re-make cmake.
- It asks you for a source and "build" directory:
But this is confusing because the "..build the binaries.." directory you give can:
1) Overlap the source directory in which case it merges lots of new files and folders into it, or
2) If set to something like /usr/local/bin
fills that with a bunch of junk which includes a secondary /bin
with the actual binaries, or
3) If set to some other location like possibly /usr/local/projectname/output
, still does not put the output binaries where they can automatically be used.
Is there a standard way to make the binaries be put in /usr/local/bin
?, (i.e. that my PATH will automatically pick up) or failing that, is the any simple and direct way to do this?
Tip:
- This is a good talk introducing cmake.