Why isn't the command “cmake .” generating a m

2020-02-01 08:25发布

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

1条回答
女痞
2楼-- · 2020-02-01 08:49

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.

查看更多
登录 后发表回答