FindOpenSceneGraph

查找 OpenSceneGraph (3D 图形应用程序编程接口)

此模块搜索 OpenSceneGraph 核心 “osg” 库以及 FindOpenThreads,以及您指定的任何其他 COMPONENTS (nodekits)。

See http://www.openscenegraph.org

注意:要有效地使用此模块,您必须要求 CMake >= 2.6.3cmake_minimum_required(VERSION 2.6.3) 或下载并将 FindOpenThreads, Findosg 函数, FindosgFind<etc>.cmake 文件放入您的 CMAKE_MODULE_PATH


此模块接受以下变量(注意混合大小写)

OpenSceneGraph_DEBUG - Enable debugging output
OpenSceneGraph_MARK_AS_ADVANCED - Mark cache variables as advanced
                                  automatically

以下环境变量也用于查找 OSG 及其各种组件。CMAKE_PREFIX_PATH 也可用于此目的(请参阅 find_library() CMake 文档)。

<MODULE>_DIR

(其中 MODULE 的形式为 “OSGVOLUME”,并且存在 FindosgVolume.cmake` 文件)

OSG_DIR
OSGDIR
OSG_ROOT

[CMake 2.8.10]: CMake 变量 OSG_DIR 现在也可以用于影响检测,而无需指定环境变量。

此模块定义以下输出变量

OPENSCENEGRAPH_FOUND - Was the OSG and all of the specified components found?
OPENSCENEGRAPH_VERSION - The version of the OSG which was found
OPENSCENEGRAPH_INCLUDE_DIRS - Where to find the headers
OPENSCENEGRAPH_LIBRARIES - The OSG libraries

================================== 示例用法

find_package(OpenSceneGraph 2.0.0 REQUIRED osgDB osgUtil)
    # libOpenThreads & libosg automatically searched
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo ${OPENSCENEGRAPH_LIBRARIES})