FindosgShadow

Finds the osgShadow NodeKit from the OpenSceneGraph toolkit.

備註

In most cases, it's recommended to use the FindOpenSceneGraph module instead and list osgShadow as a component. This will automatically handle dependencies such as the OpenThreads and core osg libraries:

find_package(OpenSceneGraph COMPONENTS osgShadow)

This module is used internally by FindOpenSceneGraph to find the osgShadow NodeKit. It is not intended to be included directly during typical use of the find_package() command. However, it is available as a standalone module for advanced use cases where finer control over detection is needed. For example, to find the osgShadow explicitly or bypass automatic component detection:

find_package(osgShadow)

OpenSceneGraph and osgShadow headers are intended to be included in C++ project source code as:

example.cxx
#include <osg/PositionAttitudeTransform>
#include <osgShadow/ShadowTexture>
// ...

When working with the OpenSceneGraph toolkit, other libraries such as OpenGL may also be required.

結果變數

該模組定義了以下變數:

osgShadow_FOUND

在 3.3 版被加入.

布林值,表示是否找到了 OpenSceneGraph 工具組的 osgShadow NodeKit。

OSGSHADOW_LIBRARIES

使用 osgShadow 所需連結的程式庫。

OSGSHADOW_LIBRARY

A result variable that is set to the same value as the OSGSHADOW_LIBRARIES variable.

快取變數

還可能設定以下變數:

OSGSHADOW_INCLUDE_DIR

包含使用 osgShadow 所需標頭檔的引入目錄。

OSGSHADOW_LIBRARY_DEBUG

osgShadow 除錯程式庫的路徑。

提示

該模組接受以下變數:

OSGDIR

Environment variable that can be set to help locate the OpenSceneGraph toolkit, including its osgShadow NodeKit, when installed in a custom location. It should point to the OpenSceneGraph installation prefix used when it was configured, built, and installed: ./configure --prefix=$OSGDIR.

棄用的變數

The following variables are provided for backward compatibility:

OSGSHADOW_FOUND

在 4.2 版之後被棄用: 請使用 osgShadow_FOUND,它有相同的值。

布林值,表示是否找到了 OpenSceneGraph 工具組的 osgShadow NodeKit。

範例

使用該模組明確尋找 osgShadow,並建立一個封裝其使用需求的介面 匯入目標,以便將其連結至專案目標:

find_package(osgShadow)

if(osgShadow_FOUND AND NOT TARGET osgShadow::osgShadow)
  add_library(osgShadow::osgShadow INTERFACE IMPORTED)
  set_target_properties(
    osgShadow::osgShadow
    PROPERTIES
      INTERFACE_INCLUDE_DIRECTORIES "${OSGSHADOW_INCLUDE_DIR}"
      INTERFACE_LINK_LIBRARIES "${OSGSHADOW_LIBRARIES}"
  )
endif()

target_link_libraries(example PRIVATE osgShadow::osgShadow)

另請參見