I am trying to build a software following some instructions on line.
cd app
mkdir -p build/Release
cd build/Release
cmake ../..
make installpyplusplus && cmake .
make .
My questions:
cmake
do or mean?make
?The “cmake” executable is the CMake command-line interface. It may be used to configure projects in scripts. Project configuration settings may be specified on the command line with the -D option. CMake is a cross-platform build system generator.
CMake can generate a native build environment that will compile source code, create libraries, generate wrappers and build executables in arbitrary combinations. CMake supports in-place and out-of-place builds, and can therefore support multiple builds from a single source tree.
From the command line, cmake can be run as an interactive question and answer session or as a non-interactive program. To run in interactive mode, just pass the option “-i” to cmake. This will cause cmake to ask you to enter a value for each value in the cache file for the project.
CMake is an open-source, cross-platform tool that uses compiler and platform independent configuration files to generate native build tool files specific to your compiler and platform. The CMake Tools extension integrates Visual Studio Code and CMake to make it easy to configure, build, and debug your C++ project.
The cmake
application looks for one file in special, called CMakeLists.txt
.
So by running:
cmake ../..
It's like saying to cmake
that the CMakeLists.txt
is two directories below, like described by MERose.
The cmake
command creates many files at your current working directory (CWD, the directory you ran the command from), and among them is a file called Makefile
, which has rules about which files to compile/build/copy/write/whatever and how to do it.
So when you run:
make .
You are telling the make
application that the Makefile
file is at your CWD. It's the same as running:
make
That looks for the Makefile
file at your CWD.
Concluding, .
is the CWD, and ..
is one level below.
EX: If your CWD is /Users/yourname/
.
represents /Users/yourname/
..
represents /Users/
../.
represents /Users/
../..
represents /
And so on...
what will 'make installpyplusplus && cmake .' ?
When you use &&
the commands will be executed sequentially if the first command returns true (exit status zero). So, in the case you said, make installpyplusplus
will be run, and after it's done (it can create a CMakeLists.txt
, I don't know what you are running), if it returns true, the command cmake .
will be run, and if the CMakeLists.txt
is there, it will run properly.
BONUS:
If you run:
make -j4
You will separate the build process in 4 instances (you can change 4 by anything you want)! Multi-threading magic will make it build faster if you have more than one processor core available :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With