使用默认安装位置进行编译安装,在卸载时会比较麻烦,因此选择设置制定的安装位置方便管理。
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr/xxx/yyy ..
make
sudo make install
当用cmake安装其他库的时候,可能会出现类似下面的warning
Could not find a package configuration file provided by "fmt" with any of
the following names:
fmtConfig.cmake
fmt-config.cmake
Add the installation prefix of "fmt" to CMAKE_PREFIX_PATH or set "fmt_DIR"
to a directory containing one of the above files. If "fmt" provides a
separate development package or SDK, be sure it has been installed.
如果确定已经安装过这个库(fmt),那么打开现在正在安装的CMakeLists.txt,在里面增加下面这一行(path为包含 fmtConfig.cmake 或 fmt-config.cmake 的路径)
set(fmt_DIR /path)
然后就不会有这个warning了。