在我的代码中实现CMake时,我得到了一个ogre错误:
/usr/bin/ld: cannot find -lOGRE我的CMakeLists.txt文件如下所示:
#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) 我对此还不熟悉。请帮我解决这个问题
发布于 2014-10-07 14:58:01
命令find_package(OGRE)运行文件FindOGRE.cmake并设置变量OGRE_INCLUDE_DIRS和OGRE_LIBRARIES。要链接到OGRE库,您应该使用这些变量,例如
target_include_directories(eCAD PRIVATE ${OGRE_INCLUDE_DIRS}) target_link_libraries(eCAD ${OGRE_LIBRARIES})
这对于您使用的所有外部库都是一样的。
https://stackoverflow.com/questions/26229881
复制相似问题