使用CMake查找osgQt146

在osg3.6.5中,osgQt已经分离为单独的子项目,其146版本使用了QOpenGL,其使用的头文件与生成的库与旧版osgQt相比,都发生了变化。需要对findosgqt.cmake文件进行修改,才能正常使用find_package(osgQt)find_package(OpenSceneGraph 3.6.5 REQUIRE osgQt)

# findosgqt.cmake
include(${CMAKE_CURRENT_LIST_DIR}/Findosg_functions.cmake)
OSG_FIND_PATH   (OSGQT osgQOpenGL/osgQOpenGLWidget)
OSG_FIND_LIBRARY(OSGQT osgQOpenGL)

include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(osgQt DEFAULT_MSG
    OSGQT_LIBRARY OSGQT_INCLUDE_DIR)

调用示例:

cmake_minimum_required(VERSION 3.10)
project(findOSGQt_test VERSION 0.1.0)

find_package(OpenSceneGraph 3.6.5 REQUIRED
    osgDB
    osgGA
    osgQt
)

message(OSGDB_FOUND=${OSGDB_FOUND}, ${OSGDB_INCLUDE_DIR}, ${OSGDB_LIBRARY})
message(OSGGA_FOUND=${OSGGA_FOUND}, ${OSGGA_INCLUDE_DIR}, ${OSGDB_LIBRARY})
message(OSGQT_FOUND=${OSGGA_FOUND}, ${OSGQT_INCLUDE_DIR}, ${OSGQT_LIBRARY})
message(OPENSCENEGRAPH_FOUND=${OSGGA_FOUND}, ${OPENSCENEGRAPH_INCLUDE_DIR}, ${OPENSCENEGRAPH_LIBRARIES})
posted @ 2021-08-05 10:34  一花一世界,一叶一乾坤  阅读(149)  评论(0编辑  收藏  举报