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

时间:2016-02-27 16:37:34

标签: c++ 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.

有什么想法吗?

3 个答案:

答案 0 :(得分:8)

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

install: (anything there)

线。如果没有,就没有这样的目标,所以make是正确的。可能你应该只使用" make"命令编译然后按原样使用它或手动安装。

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

答案 1 :(得分:3)

我收到了同样的错误消息,我的问题是在运行命令make install时我没有进入正确的目录。当我更改到具有我的makefile的目录时,它工作了。

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

答案 2 :(得分:0)

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

  1. 在Cmake中清理已加载库的缓存。
  2. 配置库。
  3. 生成Unix文件。
  4. 如果你错过了第3步:

      

    ***没有规则来制作目标`install'。停止。

    会发生错误。

相关问题