为什么当cmake生成构建文件夹时我缺少一些文件? (Maya 2020-CMake 3.16.4-VS 2017) [英] why i have some missing files when cmake generate build folder ? (Maya 2020 - CMake 3.16.4 - VS 2017)

查看:2791
本文介绍了为什么当cmake生成构建文件夹时我缺少一些文件? (Maya 2020-CMake 3.16.4-VS 2017)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我完全按照API帮助中的说明创建了Visual Studio项目: CMakeLists.txt文件指南

I exactly followed the instruction in API help to create visual studio project: The CMakeLists.txt File guide

但是我得到了这个错误:

but I got this error:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

顺便说一句,此错误并没有停止进程,并且CMake为我生成了构建文件夹 但您可以看到它没有创建一些我认为的文件,没有helloworld.vcxproj& helloworld.vcxproj.filters

by the way , this error didn't stop the process and CMake generate the build folder for me but as you can see it didn't create some files i think , there are no helloworld.vcxproj & helloworld.vcxproj.filters

仅供参考:我使用Cmake 3.16.4和Visual Studio 2017

FYI : i use Cmake 3.16.4 and visual studio 2017

推荐答案

由于缺少

The tutorial is incomplete, as it is missing the project() command. Your CMake project should always have at least one project() command, as it is used to initialize some pretty essential variables, and the language used in the CMake file, among other things. From the CMake documentation:

项目的顶级CMakeLists.txt文件必须包含直接直接调用project()命令的内容;通过include()命令加载一个是不够的.如果不存在这样的调用,CMake将发出警告,并假装顶部有一个project(Project)以启用默认语言(CCXX).

The top-level CMakeLists.txt file for a project must contain a literal, direct call to the project() command; loading one through the include() command is not sufficient. If no such call exists, CMake will issue a warning and pretend there is a project(Project) at the top to enable the default languages (C and CXX).

使用set()命令初始化PROJECT_NAME是不好的做法,因为project()调用 也会为您完成此操作.我建议修改CMake文件以改为包含project()命令:

Using the set() command to initialize PROJECT_NAME is bad practice, as the project() call also does this for you. I would suggest modifying the CMake file to include the project() command instead:

cmake_minimum_required(VERSION 2.8)

include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)

# Set the project here.
project(exampleNode)

set(RESOURCES_FILES myResource.xpm)

set(MEL_FILES 
     exampleNode.mel)

set(SOURCE_FILES
     exampleNode.cpp
     ${MEL_FILES}
)

set(LIBRARIES
    OpenMaya Foundation
)

find_package(MtoA)
find_alembic()
build_plugin()

这篇关于为什么当cmake生成构建文件夹时我缺少一些文件? (Maya 2020-CMake 3.16.4-VS 2017)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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