为什么不是命令"cmake".生成一个makefile? [英] Why isn't the command "cmake ." generating a makefile?

查看:405
本文介绍了为什么不是命令"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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆