Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why isn't the command "cmake ." generating a makefile? [closed]

I run cmake . in terminal and it says it generated something, then I run make and it says

make: *** No targets specified and no makefile found.  Stop.

I'm guessing I've missed something else that I need to do but I can't figure out what. It should have created a make file that I can then build and then install.

If I'm being too vague please let me know what more I can add to this question.

* edit *

$ cmake .
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run               "cmake
 --help-policy CMP0042" for policy details.  Use the cmake_policy command to
 set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

  freeglut

This warning is for project developers.  Use -Wno-dev to suppress it.

 -- Generating done
 -- Build files have been written to:     /Users/nicholasl/Downloads/freeglut-3.0.0

**** contents of build directory ****

$ ls
AUTHORS             android
Build               android_toolchain.cmake
CMakeCache.txt          blackberry.toolchain.cmake
CMakeFiles          cmake_install.cmake
CMakeLists.txt          config.h
CMakeScripts            config.h.in
COPYING             doc
ChangeLog           freeglut.pc
README              freeglut.pc.in
README.android          freeglut.rc.in
README.blackberry       freeglut.xcodeproj
README.cmake            include
README.cygwin_mingw     mingw_cross_toolchain.cmake
README.mingw_cross      progs
README.win32            src
like image 390
Nicholas L. Avatar asked May 20 '16 02:05

Nicholas L.


People also ask

Does CMake generate a Makefile?

CMake generates a Unix makefile by default when run from the command line in a Unix-like environment. Of course, you can generate makefiles explicitly using the -G option. When generating a makefile, you should also define the CMAKE_BUILD_TYPE variable.

Is CMake and Makefile the same?

Make (or rather a Makefile) is a buildsystem - it drives the compiler and other build tools to build your code. CMake is a generator of buildsystems. It can produce Makefiles, it can produce Ninja build files, it can produce KDEvelop or Xcode projects, it can produce Visual Studio solutions.

How does CMake command work?

CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.

How use CMake command line?

Running CMake from the command line From the command line, cmake can be run as an interactive question and answer session or as a non-interactive program. To run in interactive mode, just pass the option “-i” to cmake. This will cause cmake to ask you to enter a value for each value in the cache file for the project.


1 Answers

It seems CMake defaults to generating an XCode project on Mac. CMake generated freeglut.xcodeproj along with all supporting files.

You are better off running cmake from an empty directory, so you can see what it actually does when it is run.

To generate a makefile (and create a build directory), do

mkdir -p cmake-build && cd cmake-build
cmake .. -G"Unix Makefiles"

Then it should generate a Makefile.

like image 153
rubenvb Avatar answered Sep 21 '22 09:09

rubenvb