Some options in cmake have become stinky and long. Now a feature article records some common commands and options
Installation steps of common software
$ cd /path/to/soft
$ mkdir _build
$ cd _build
$ cmake ..
$ make
$ make install
Then in this folder you can see that a lot of files
are generated. Generally, the installation path of cmake will be written in the cmake_install.cmake file, and the default should be in /usr/lcoal
Commonly used options
-DCMAKE_INSTALL_PREFIX= Specify the installation path, equivalent to --prefix=
-DCMAKE_C_COMPILER= Specify C compiler, equivalent to CC=
-DCMAKE_CXX_COMPILER=Specify CXX compiler, equivalent to CXX=
It can be seen that -Dxxxx is to create variables. Some software may create some special variables that affect compilation.
In make, we can add VERBOSE=1 to view specific compile-time commands for debugging
2020-12-11 update
If there is no FindBoost.cmake file in the software, you can use -DBOOST_ROOT=/path/to/boost to replace the boost library in the system
You can see the variable names of some libraries needed by the software in the software root directory/cmake_support/Findxxxx.cmake file, and you can manually specify the location when compiling
For example, in a software /cmake_support/FindEIGEN.cmake, you can see that the software uses EIGEN3_INCLUDE_DIR when searching for Eigen library files in cmake, so we can add -DEIGEN3_INCLUDE_DIR=/path/to/eigen3 in cmake