为什么我在 cmake 生成构建文件夹时缺少一些文件? (玛雅 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)
我完全按照 API 帮助中的说明创建了 visual studio 项目:
The CMakeLists.txt File guide
但是我得到了这个错误:
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 项目应该 always 至少有一个 project()
命令,因为它用于初始化一些非常重要的变量,以及 CMake 文件中使用的语言等等。来自 CMake 文档:
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()
命令:
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()
我完全按照 API 帮助中的说明创建了 visual studio 项目: The CMakeLists.txt File guide
但是我得到了这个错误:
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 项目应该 always 至少有一个 project()
命令,因为它用于初始化一些非常重要的变量,以及 CMake 文件中使用的语言等等。来自 CMake 文档:
The top-level
CMakeLists.txt
file for a project must contain a literal, direct call to theproject()
command; loading one through theinclude()
command is not sufficient. If no such call exists, CMake will issue a warning and pretend there is aproject(Project)
at the top to enable the default languages (C
andCXX
).
使用 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()