[英]why i have some missing files when cmake generate build folder ? (Maya 2020 - CMake 3.16.4 - VS 2017)
我完全按照 API 帮助中的说明创建 Visual Studio 项目: CMakeLists.txt 文件指南
但我收到了这个错误:
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
仅供参考:我使用 Cmake 3.16.4 和 Visual Studio 2017
该教程不完整,因为它缺少project()
命令。 您的 CMake 项目应始终至少有一个project()
命令,因为它用于初始化一些非常重要的变量,以及 CMake 文件中使用的语言等。 从 CMake 文档:
项目的顶级
CMakeLists.txt
文件必须包含对project()
命令的直接调用; 通过include()
命令加载一个是不够的。 如果不存在这样的调用,CMake 将发出警告并假装顶部有一个project(Project)
来启用默认语言(C
和CXX
)。
使用set()
命令初始化PROJECT_NAME
是不好的做法,因为project()
调用也会为您执行此操作。 我建议修改 CMake 文件以包含project()
命令:
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()
这是正确的 CMakeLists.txt :
cmake_minimum_required(VERSION 2.8)
project(test)
set(PROJECT_NAME test)
include($ENV{DEVKIT_LOCATION}/cmake/pluginEntry.cmake)
set(RESOURCES_FILES myResource.xpm)
set(MEL_FILES
test.mel)
set(SOURCE_FILES
test.cpp
${MEL_FILES}
)
set(LIBRARIES
OpenMaya Foundation
)
build_plugin()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.