FindDEEPSTREAM.cmake怎么写
时间: 2024-05-05 18:22:54 浏览: 144
FindDEEPSTREAM.cmake 是用于 CMake 构建系统的模块,用于查找 NVIDIA 的 DeepStream SDK。以下是 FindDEEPSTREAM.cmake 的一个基本实现:
```
# Checks if DeepStream SDK is installed and sets DEEPSTREAM_FOUND variable
# If found, sets DEEPSTREAM_INCLUDE_DIRS and DEEPSTREAM_LIBRARIES variables
# If not found, sets DEEPSTREAM_FOUND to false
find_path(DEEPSTREAM_INCLUDE_DIRS deepstream/deepstream.h PATH_SUFFIXES include)
find_library(DEEPSTREAM_LIBRARIES NAMES deepstream PATH_SUFFIXES lib)
if(DEEPSTREAM_INCLUDE_DIRS AND DEEPSTREAM_LIBRARIES)
set(DEEPSTREAM_FOUND TRUE)
endif()
if(DEEPSTREAM_FOUND)
message(STATUS "Found DeepStream SDK")
message(STATUS "DeepStream include dirs: ${DEEPSTREAM_INCLUDE_DIRS}")
message(STATUS "DeepStream libraries: ${DEEPSTREAM_LIBRARIES}")
else()
message(STATUS "DeepStream SDK not found")
endif()
# Set variables for external use
set(DEEPSTREAM_INCLUDE_DIRS ${DEEPSTREAM_INCLUDE_DIRS} CACHE PATH "DeepStream include directories")
set(DEEPSTREAM_LIBRARIES ${DEEPSTREAM_LIBRARIES} CACHE PATH "DeepStream libraries")
```
使用时,只需要在 CMakeLists.txt 文件中包含该模块:
```
find_package(DEEPSTREAM REQUIRED)
```
然后使用 DEEPSTREAM_INCLUDE_DIRS 和 DEEPSTREAM_LIBRARIES 变量来包含 DeepStream SDK 的头文件和库文件。
阅读全文