build - Cmake 不尊重 CMAKE_INSTALL_PREFIX 的值

标签 build cmake installation gnu-make awesome-wm

我正在尝试从源代码安装很棒的 wm。所以我创建了一个构建目录并执行了以下命令:

cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX

但是 make install 尝试将一些程序文件放入 /usr/local/share 中,这不是我想要的位置:

> make install
[  3%] Built target generated_sources
[  6%] Built target test-gravity
[  9%] Built target lgi-check
[  9%] Built target version_stamp
[ 29%] Built target generated_icons
[ 31%] Checking for LGI...
Building for Lua 5.3.
Found lgi 0.9.2.
[ 31%] Built target lgi-check-run
[ 35%] Built target generate_awesomerc
[100%] Built target awesome
Install the project...
-- Install configuration: ""
-- Up-to-date: /home/user/.local/bin/awesome
-- Up-to-date: /home/user/.local/bin/awesome-client
-- Installing: /usr/local/share/awesome/lib
CMake Error at cmake_install.cmake:69 (file):
  file INSTALL cannot make directory "/usr/local/share/awesome/lib": No such
  file or directory


make: *** [Makefile:107: install] Error 1

是否有一些类似于 CMAKE_INSTALL_PREFIXCMAKE_INSTALL_LIBDIR 的 cmake 变量需要为共享数据指定?

最佳答案

使用 cmake 模块时,您将拥有用于共享CMAKE_INSTALL_DATADIR:include( GNUInstallDirs )

注意:使用cmake --build build --target install -- DESTDIR=foo时 请阅读 CMAKE_INSTALL_PREFIX 文档

On UNIX one can use the DESTDIR mechanism in order to relocate the whole installation. DESTDIR means DESTination DIRectory.

WARNING: DESTDIR may not be used on Windows because installation prefix usually contains a drive letter like in C:/Program Files which cannot be prepended with some other prefix.

源代码:https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html#variable:CMAKE_INSTALL_PREFIX

关于build - Cmake 不尊重 CMAKE_INSTALL_PREFIX 的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49552896/

相关文章:

ios - Xcode 生成错误 : Signing for AWSCore requires a development team

android - Android:如果不卸载以前的版本就无法安装自己的版本:INSTALL_FAILED_UPDATE_INCOMPATIBLE

c++ - 如何安装opencv4nodejs模块

ruby - 如何使用 ruby​​ 和命令行工具在 mavericks 中正确安装 cocoapod?

android - 在 Release模式下构建失败

c++ - 如何构建boost序列化库

c++ - 如何将静态 Stasm 库链接到我的程序?

c++ - 通过 CMake 将外部库包含到 CLion 项目中

node.js - npm install 给出未经授权的名称或密码错误

linux - 使用共享对象和符号链接(symbolic link)构建安装包