"No rule to make target 'install'"......但是Makefile存在



我在安装C++库时遇到问题。CMake 命令成功并生成生成文件,但它会发出警告:

CMake Warning (dev) at CMakeLists.txt:27 (LINK_DIRECTORIES):
This command specifies the relative path
../usr/local/lib
as a link directory.
Policy CMP0015 is not set: link_directories() treats paths relative to the
source dir.  Run "cmake --help-policy CMP0015" for policy details.  Use the
cmake_policy command to set the policy and suppress this warning.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMakeList 中的第 27 行.txt 是

Boost_LIBRARY_DIR_DEBUG:PATH=/usr/local/lib

我不明白为什么这个警告会给我带来任何问题。但是当我运行make install时,我收到一个错误:

make: *** No rule to make target `install'.  Stop.

有什么想法吗?

你能提供一个完整的制作文件吗?但是现在我可以告诉 - 您应该检查"安装"目标是否已存在。因此,请检查 Makefile 是否包含

install: (anything there)

线。如果没有,就没有这样的目标,所以制定是有权利的。可能您应该仅使用"make"命令进行编译,然后按原样使用它或手动安装自己。

安装不是任何标准,它只是一个常见的目标,可能存在,但不是必需的。

我收到相同的错误消息,我的问题是运行命令make install时我不在正确的目录中。当我更改为具有我的makefile的目录时,它可以工作。

所以你可能不在正确的目录中。

我也遇到了同样的错误。这是修复:如果您使用的是 Cmake-GUI

  1. 清理Cmake-GUI文件菜单中加载库的缓存。
  2. 配置库。
  3. 生成 Unix 文件。

如果您错过了第三步:

没有规则使目标"安装"。 停。

将发生错误。

确保你有cmake

cmake -DCMAKE_INSTALL_PREFIX=/usr ..

确保您与Makefile位于同一目录中。

最新更新