首页 > 解决方案 > CMake:OGREConfig.cmake

问题描述

我有一个奇怪的问题,似乎很少有人使用 Ogre3D,CMake 无法找到(呃,“接受”)OGREConfig.cmake。这是我的控制台输出:

CMake Error at CMakeLists.txt:10 (find_package):
  Could not find a configuration file for package "OGRE" that is compatible
  with requested version "1.12.7".

  The following configuration files were considered but not accepted:

    D:/_lib/ogre/build/sdk/CMake/OGREConfig.cmake, version: 1.12.7 (64bit)

我不知道我是不是傻子还是什么,但我确保在环境变量中设置了 OGRE_DIR ,我什至按照 T 的说明从源代码构建了 Ogre。这是我的 CMakeLists.txt 项目:

cmake_minimum_required(VERSION 3.17.2)

set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)

project(OgreProject1 VERSION 0.0.1 LANGUAGES C CXX)


# specify which version and components you need
find_package(
  OGRE 1.12.7
  COMPONENTS
    Bites
    RTShaderSystem
  REQUIRED
)
# copy resource.cfg next to our binaries where OGRE looks for it
file(COPY ${OGRE_CONFIG_DIR}/resources.cfg DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# add the source files as usual
add_executable(cmake-good src/main.cpp)
# this also sets the includes and pulls third party dependencies
target_link_libraries(cmake-good OgreBites OgreRTShaderSystem)

这似乎是一个“我”的问题,而不是一个“食人魔”的问题,所以如果你能让我朝着正确的方向前进,那就太好了。如果出现提示,我将使用更多信息编辑我的帖子。

注意:如果重要的话,我用 MSVC16 构建了 Ogre,我的 CMake 版本是 3.17.2。

标签: c++gcccmakeogre

解决方案


推荐阅读