Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of cmake command lines

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:

  1. What does "../.." after cmake do or mean?
  2. What is the significance of the dot after make?
  3. what will 'make installpyplusplus && cmake .' ?
like image 691
boon Avatar asked Apr 22 '15 09:04

boon


People also ask

What is CMake command line?

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.

What is the use of CMake command?

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.

How do I run a command in CMake?

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.

What is the CMake command in Linux?

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.


1 Answers

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 :)

like image 160
gbuzogany Avatar answered Oct 17 '22 01:10

gbuzogany