当找到OGRE的CMake包时,我得到了以下错误:
-- Found OGRE CMake module in directory: /usr/share/OGRE/cmake/modules
CMake Error at /usr/share/OGRE/cmake/modules/OgreTargets.cmake:168 (message):
The imported target "OgreGLSupport" references the file
"/usr/lib/x86_64-linux-gnu/libOgreGLSupport.a"
but this file does not exist. Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
"/usr/share/OGRE/cmake/modules/OgreTargets.cmake"
but not all the files it references.
我的文件系统包含以下OGRE库:
ls /usr/lib/x86_64-linux-gnu/libOgre
libOgreBites.so libOgreMain.so libOgreOverlay.so libOgreProperty.so libOgreTerrain.so
libOgreBites.so.1.12.4 libOgreMain.so.1.12.4 libOgreOverlay.so.1.12.4 libOgreProperty.so.1.12.4 libOgreTerrain.so.1.12.4
libOgreHLMS.so libOgreMeshLodGenerator.so libOgrePaging.so libOgreRTShaderSystem.so libOgreVolume.so
libOgreHLMS.so.1.12.4 libOgreMeshLodGenerator.so.1.12.4 libOgrePaging.so.1.12.4 libOgreRTShaderSystem.so.1.12.4 libOgreVolume.so.1.12.4
为什么需要静态库?
这是我CMake代码:
# NOTE search for OGRE before searching for KDE since KDE changes the variable CMAKE_MODULE_PATH
# OGRE does not install the CMake file into the module path. It uses the library path instead.
find_path(OGRE_CMAKE_MODULE_DIR FindOGRE.cmake PATHS ${CMAKE_MODULE_PATH})
message(STATUS "Searching for OGRE in ${CMAKE_MODULE_PATH}")
if (NOT OGRE_CMAKE_MODULE_DIR)
find_path(OGRE_CMAKE_MODULE_DIR FindOGRE.cmake PATHS ${CMAKE_SYSTEM_LIBRARY_PATH} PATH_SUFFIXES OGRE/cmake)
endif ()
if (OGRE_CMAKE_MODULE_DIR)
message(STATUS "Found OGRE CMake module in directory: ${OGRE_CMAKE_MODULE_DIR}")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${OGRE_CMAKE_MODULE_DIR})
else ()
message(WARNING "Did not find OGRE CMake module.")
endif ()
find_package(OGRE REQUIRED)
# https://ogrecave.github.io/ogre/api/1.10/setup.html
# the search paths
#include_directories(${OGRE_INCLUDE_DIRS})
#link_directories(${OGRE_LIBRARY_DIRS})
# copy essential config files next to our binary where OGRE autodiscovers them
#file(COPY ${OGRE_CONFIG_DIR}/plugins.cfg ${OGRE_CONFIG_DIR}/resources.cfg
#DESTINATION ${CMAKE_BINARY_DIR})
if (${OGRE_FOUND})
# SYSTEM suppresses all the warnings of OGRE
include_directories(SYSTEM ${OGRE_INCLUDE_DIRS})
link_directories(${OGRE_LIBRARY_DIRS})
add_definitions(-DHAS_OGRE=1)
endif ()
我可能在打包的时候搞砸了一些东西,而Ubuntu一旦发布(我假设你的情况是20.04)就很难修复了。
请找到Ogre 1.12.13 Ubuntu Focal(20.04)和Ubuntu Jammy(22.04)在我的ppa: https://launchpad.net/~s-schmeisser/+archive/ubuntu/ogre-1.12