28

I am running into issues installing a C++ library. The CMake command is successful and generates the Makefile, but it gives a warning:

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.

Line 27 in CMakeLists.txt is

Boost_LIBRARY_DIR_DEBUG:PATH=/usr/local/lib

I don't see why this warning would cause me any issues. But when I run make install, I get an error:

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

Any ideas?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sean
  • 445
  • 1
  • 5
  • 10

5 Answers5

21

Could you provide a whole makefile? But right now I can tell - you should check that "install" target already exists. So, check Makefile whether it contains a

install: (anything there)

line. If not, there is no such target and so make has right. Probably you should use just "make" command to compile and then use it as is or install yourself, manually.

Install is not any standard of make, it is just a common target, that could exists, but not necessary.

  • 14
    Tip for less experienced: use `cat Makefile | grep install:` to perform this check – XavierStuvw Feb 13 '17 at 18:04
  • While I agree that installation is by no way an "automagic" feature of makefiles, it's been expected for decades that makefiles have an install target. It's CMake's fault if we end up with uninstallable packages, because, contrary to e.g. the autotools, it forgot to cleanly integrate that part into the DSL and left the possibility that package authors wouldn't implement installation. – Johan Boulé Jul 29 '19 at 13:37
19

I was receiving the same error message, and my issue was that I was not in the correct directory when running the command make install. When I changed to the directory that had my makefile it worked.

So possibly you aren't in the right directory.

Jamie
  • 364
  • 2
  • 8
2

I also came across the same error. Here is the fix: If you are using Cmake-GUI:

  1. Clean the cache of the loaded libraries in Cmake-GUI File menu.
  2. Configure the libraries.
  3. Generate the Unix file.

If you missed the 3rd step:

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

error will occur.

FutureJJ
  • 2,368
  • 1
  • 19
  • 30
2

Make sure you have cmake

cmake -DCMAKE_INSTALL_PREFIX=/usr ..
profimedica
  • 2,716
  • 31
  • 41
0

Ensure you're in the same directory as with your Makefile.

Dzhud
  • 45
  • 9