未知的 CMake 命令 "add_py_modules"

Unknown CMake command "add_py_modules"

我正在准备构建 openage,它是 AoE2 精灵引擎的克隆版。我的 cmake 命令没有被处理。 "add_py_modules"这里不可以吗?

这是 windows10,使用 vcpkg。使用的命令:

cmake -DCMAKE_TOOLCHAIN_FILE=C:\Software\vcpkg/scripts/buildsystems/vcpkg.cmake ..

CMakeLists.txt:

# python module configurations

# python config file is created in libopenage
# in order to get options from libopenage
cmake_minimum_required(VERSION 3.15)
project(openage)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
add_py_modules(
__init__.py
__main__.py
assets.py
${CMAKE_CURRENT_BINARY_DIR}/config.py
default_dirs.py
    NOINSTALL devmode.py
)
add_cython_modules(
cython_check.pyx
)

add_subdirectory(cabextract)
add_subdirectory(codegen)
add_subdirectory(convert)
add_subdirectory(cppinterface)
add_subdirectory(cvar)
add_subdirectory(event)
add_subdirectory(game)
add_subdirectory(log)
add_subdirectory(util)
add_subdirectory(renderer)
add_subdirectory(testing)

输出:

-- Building for: Visual Studio 16 2019
CMake Warning at C:/Software/vcpkg/scripts/buildsystems/vcpkg.cmake:107 
(message):
There are no libraries installed for the Vcpkg triplet x64-windows.
Call Stack (most recent call first):
  C:/Software/cmake-3.15.0-rc2-win64-x64/share/cmake-3.15/Modules/CMakeDetermineSystem.cmake:93 (include)
  CMakeLists.txt:7 (project)

-- The C compiler identification is MSVC 19.21.27702.2
-- The CXX compiler identification is MSVC 19.21.27702.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe -- 
works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual 
Studio/2019/Community/VC/Tools/MSVC/14.21.27702/bin/Hostx64/x64/cl.exe -- 
works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at CMakeLists.txt:10 (add_py_modules):
Unknown CMake command "add_py_modules".
-- Configuring incomplete, errors occurred!
See also 
"C:/Users/kafon/Desktop/openage/openage/build/CMakeFiles/CMakeOutput.log".
PS C:\Users\kafon\Desktop\openage\openage\build>

得到

Unknown CMake command

配置别人的项目时出错通常意味着,选择了错误的源目录

在您的情况下,正确的源目录是存储库 中的top-level 目录,但您使用它的openage 子目录。这就是您收到错误的原因。