为什么不是命令"cmake".生成一个makefile?

Nic*_* L. 6 c++ makefile cmake

cmake .在终端运行,它说它生成了一些东西,然后我跑了make,它说

make: *** No targets specified and no makefile found.  Stop.
Run Code Online (Sandbox Code Playgroud)

我猜我错过了我需要做的其他事情,但我无法弄清楚是什么.它应该创建一个make文件,然后我可以构建然后安装.

如果我太模糊,请告诉我我还能为这个问题添加更多内容.

*编辑*

$ 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
Run Code Online (Sandbox Code Playgroud)

****构建目录的内容****

$ 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
Run Code Online (Sandbox Code Playgroud)

rub*_*nvb 10

看来CMake默认在Mac上生成一个XCode项目.CMake freeglut.xcodeproj与所有支持文件一起生成.

最好cmake从空目录运行,这样你就可以看到它在运行时的实际功能.

要生成一个makefile(并创建一个构建目录),请执行

mkdir -p cmake-build && cd cmake-build
cmake .. -G"Unix Makefiles"
Run Code Online (Sandbox Code Playgroud)

然后它应该生成一个Makefile.