首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Cmake中出现Ogre错误

Cmake中出现Ogre错误
EN

Stack Overflow用户
提问于 2014-10-07 14:32:05
回答 1查看 256关注 0票数 0

在我的代码中实现CMake时,我得到了一个ogre错误:

代码语言:javascript
复制
/usr/bin/ld: cannot find -lOGRE

我的CMakeLists.txt文件如下所示:

代码语言:javascript
复制
#Specify the version being used aswell as the language
cmake_minimum_required(VERSION 2.6)

#Name your project here
project(eCAD)

#sets cmake to run moc when needed
set(CMAKE_AUTOMOC ON)

#find requirements of this projects
find_package(Qt5Widgets)
find_package(Qt5Core) 
find_package(OGRE)
find_package(OIS)
# Find includes in corresponding build directories
set(CMAKE_INCLUDE_CURRENT_DIR ON)

#Sends the -std=c++11 flag to the gcc compiler
add_definitions(-std=c++11)

qt5_wrap_ui(Cmake_form_hdr resources/ui/mainwindow.ui)

#This tells CMake to main.cpp and name it eCAD
add_executable(eCAD main.cpp  ${Cmake_form_hdr})

#include the subdirectory containing our libs
add_subdirectory (gui)
include_directories(gui)

#link_libraries
target_link_libraries(eCAD Qt5::Widgets Qt5::Core OGRE OIS) 

我对此还不熟悉。请帮我解决这个问题

EN

回答 1

Stack Overflow用户

发布于 2014-10-07 14:58:01

命令find_package(OGRE)运行文件FindOGRE.cmake并设置变量OGRE_INCLUDE_DIRSOGRE_LIBRARIES。要链接到OGRE库,您应该使用这些变量,例如

target_include_directories(eCAD PRIVATE ${OGRE_INCLUDE_DIRS}) target_link_libraries(eCAD ${OGRE_LIBRARIES})

这对于您使用的所有外部库都是一样的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26229881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档