“没有规则使目标'安装'”......但是 Makefile 存在

新手上路,请多包涵

我在安装 C++ 库时遇到问题。 CMake 命令成功并生成 Makefile,但它给出了警告:

 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.

CMakeLists.txt 中的第 27 行是

Boost_LIBRARY_DIR_DEBUG:PATH=/usr/local/lib

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

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

有任何想法吗?

原文由 Sean 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.1k
2 个回答

你能提供一个完整的makefile吗?但现在我可以告诉你——你应该检查“安装”目标是否已经存在。因此,检查 Makefile 是否包含

install: (anything there)

线。如果没有,则没有这样的目标,因此 make 是正确的。可能您应该只使用“make”命令进行编译,然后按原样使用它或手动安装。

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

原文由 Tomir Rogi Szawok 发布,翻译遵循 CC BY-SA 3.0 许可协议

我收到了同样的错误消息,我的问题是运行命令 make install 时我不在正确的目录中。当我更改为包含我的 makefile 的目录时,它起作用了。

因此,您可能不在正确的目录中。

原文由 Jamie 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题