mehrdad
mehrdad

Reputation: 193

Run generated makefile without CMake installed

I want to compile my program on our university HCP server, I created it as a CMake project on my laptop but the server does not have CMake installed and I can not install it (limited storage).

How do I compile the project on the server without CMake and only make?

I ran cmake command on my laptop and then transferred the sources and generated Makfile to the server, but when I execute make on the server it complains about cmake missing:

make: /usr/local/bin/cmake: Command not found
make: *** [cmake_check_build_system] Error 127

Is it possible to generate a Makefile that can run only make and does not need CMake installed?

Upvotes: 0

Views: 534

Answers (1)

ComicSansMS
ComicSansMS

Reputation: 54737

This is not possible, for two major reasons:

  • As pointed out in the comments, the generated Makefiles will again attempt to call CMake during the build.
  • Besides that, Makefiles generated by CMake are not supposed to be portable. A Makefile generated on one machine is likely to break when copied to another.

Note that CMake has no mandatory external dependencies, so you should be able to quickly build a local copy from source on the server and use that to build your project. If that is for whatever reason not feasible, you cannot use CMake and will have to rely on a different method for building, like writing your own ad-hoc Makefile from scratch.

Upvotes: 2

Related Questions