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

Why isn#39;t the command quot;cmake .quot; generating a makefile?(为什么不是命令“cmake.生成makefile?)

本文介绍了为什么不是命令“cmake".生成makefile?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

我想我错过了一些我需要做的事情,但我不知道是什么.它应该创建了一个 make 文件,然后我可以构建并安装该文件.

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.

* 编辑 *

$ 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

推荐答案

似乎 CMake 默认在 Mac 上生成 XCode 项目.CMake 生成 freeglut.xcodeproj 以及所有支持文件.

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

你最好从一个空目录运行 cmake,这样你就可以看到它在运行时实际做了什么.

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

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

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

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

然后它应该生成一个Makefile.

这篇关于为什么不是命令“cmake".生成makefile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:为什么不是命令“cmake".生成makefile?