用于CMake的Openscenegraph库的链接

时间:2016-11-07 08:35:16

标签: c++ eclipse cmake openal openscenegraph

嗯,我是CMake的新手,想要在eclipse中编辑飞行模拟代码而不是Visual Studio。为此,我下载了Simgear,CMake,Boost库,开放场景图和openalsoft的源代码。

现在我有所有可用的数据,但我不知道在哪里放置一些这些库。因此,当我运行CMake并提供我的flightgear代码时,它会抱怨opencenegraph库没有安装。

请帮我处理我需要放置所有这些文件的位置,以便使用CMake将我的代码转换为eclipse。我已经安装了boost和openal库。唯一的问题是openscenegraph库,我将程序文件放在以下路径“C:\ Program Files \ OpenSceneGraph-3.4.0”但CMake无法访问它。错误代码是

Eclipse version is set to 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
version is 2016 dot 3 dot 1
ignoring: ^C:/Media/Project/study material/flight gear/simgear-2016.3.1/.git;\\.gitignore;Makefile.am;~$;
Library installation directory: lib
Boost version: 1.62.0
SimGear mode: NORMAL
Found OpenAL: C:/Program Files/OpenAL/OpenAL32.lib  
Sound support: ENABLED
Could NOT find osgText (missing:  OSGTEXT_LIBRARY OSGTEXT_INCLUDE_DIR) 
Could NOT find osgSim (missing:  OSGSIM_LIBRARY OSGSIM_INCLUDE_DIR) 
Could NOT find osgDB (missing:  OSGDB_LIBRARY OSGDB_INCLUDE_DIR) 
Could NOT find osgParticle (missing:  OSGPARTICLE_LIBRARY OSGPARTICLE_INCLUDE_DIR) 
Could NOT find osgGA (missing:  OSGGA_LIBRARY OSGGA_INCLUDE_DIR) 
Could NOT find osgViewer (missing:  OSGVIEWER_LIBRARY OSGVIEWER_INCLUDE_DIR) 
Could NOT find osgUtil (missing:  OSGUTIL_LIBRARY OSGUTIL_INCLUDE_DIR) 
Could NOT find osg (missing:  OSG_LIBRARY OSG_INCLUDE_DIR) 
Could NOT find OpenThreads (missing:  OPENTHREADS_LIBRARY OPENTHREADS_INCLUDE_DIR) 
CMake Error at C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find OpenSceneGraph (missing: OPENSCENEGRAPH_LIBRARIES
  OPENSCENEGRAPH_INCLUDE_DIR OSGTEXT_FOUND OSGSIM_FOUND OSGDB_FOUND
  OSGPARTICLE_FOUND OSGGA_FOUND OSGVIEWER_FOUND OSGUTIL_FOUND OSG_FOUND
  OPENTHREADS_FOUND) (Required is at least version "3.2.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.7/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.7/Modules/FindOpenSceneGraph.cmake:223 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  CMakeLists.txt:243 (find_package)


Configuring incomplete, errors occurred!
See also "C:/Users/shajeeh/Documents/CMake/CMakeFiles/CMakeOutput.log".

1 个答案:

答案 0 :(得分:2)

我不是CMake专家,在这里我做了一些事情来创建ROS& Linux中的OSG项目:

将一个环境变量(如果它还没有)添加到.bashrc文件中:

export PATH = $ {PATH}:... / OpenSceneGraph-3.4.0 / bin(你的绝对路径)

然后在CMake文件中添加:

FIND_PACKAGE(OpenSceneGraph COMPONENTS osgSim osgUtil osgDB osgFX osgGA osgTerrain osgViewer osgText osgWidget osgManipulator osg osgShadow)

target_link_libraries(name_of_your_executable $ {PROJECT_NAME} $ {OPENSCENEGRAPH_LIBRARIES})

有关详细信息,请查看CMake文档herehere