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

Sea*_*ean 7 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.
Run Code Online (Sandbox Code Playgroud)

CMakeLists.txt中的第27行是

Boost_LIBRARY_DIR_DEBUG:PATH=/usr/local/lib
Run Code Online (Sandbox Code Playgroud)

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

make: *** No rule to make target `install'.  Stop.
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

Jam*_*mie 11

我收到了相同的错误消息,我的问题是运行命令时我不在正确的目录中make install。当我切换到包含我的 makefile 的目录时,它可以工作。

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


小智 9

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

install: (anything there)
Run Code Online (Sandbox Code Playgroud)

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

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

  • 经验不足的提示:使用`cat Makefile | grep install:`执行此检查 (5认同)