From b1930782e4dfb0a94d58fcb4cb6992fe03ae842c Mon Sep 17 00:00:00 2001 From: Pierre Willenbrock Date: Tue, 5 Nov 2024 16:51:41 +0100 Subject: [PATCH] Fix: Use setup_qt determined Qt version for finding osgQt The previous test fails when openscenegraph-osgQt5 is present in the install/system but Mars is built against Qt4. --- graphics/CMakeLists.txt | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/graphics/CMakeLists.txt b/graphics/CMakeLists.txt index 09355a9a2..be321fbd1 100644 --- a/graphics/CMakeLists.txt +++ b/graphics/CMakeLists.txt @@ -39,16 +39,18 @@ if(USE_VERTEX_BUFFER) ADD_DEFINITIONS(-DUSE_VERTEX_BUFFER) endif() -pkg_check_modules(OSGQT openscenegraph-osgQt5) -if(OSGQT_FOUND) -find_package(OpenSceneGraph REQUIRED osgManipulator osgViewer osgFX osgShadow osgParticle osgTerrain osgDB osgGA osgWidget osgText osgUtil) - -include_directories(${OSGQT_INCLUDE_DIRS}) -link_directories(${OSGQT_LIBRARY_DIRS}) -add_definitions(${OSGQT_CFLAGS_OTHER}) #cflags without -I +set (QT_USE_QTOPENGL TRUE) +setup_qt() +if (PREFERE_QT4) + find_package(OpenSceneGraph REQUIRED osgManipulator osgViewer osgFX osgShadow osgParticle osgTerrain osgDB osgGA osgWidget osgText osgUtil osgQt) else() -find_package(OpenSceneGraph REQUIRED osgManipulator osgViewer osgFX osgShadow osgParticle osgTerrain osgDB osgGA osgWidget osgText osgUtil osgQt) + pkg_check_modules(OSGQT openscenegraph-osgQt5) + find_package(OpenSceneGraph REQUIRED osgManipulator osgViewer osgFX osgShadow osgParticle osgTerrain osgDB osgGA osgWidget osgText osgUtil) + + include_directories(${OSGQT_INCLUDE_DIRS}) + link_directories(${OSGQT_LIBRARY_DIRS}) + add_definitions(${OSGQT_CFLAGS_OTHER}) #cflags without -I endif() include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) @@ -61,9 +63,6 @@ if(${HAVE_OSG_VERSION_H}) ADD_DEFINITIONS(-DHAVE_OSG_VERSION_H) endif() -set (QT_USE_QTOPENGL TRUE) -setup_qt() - pkg_check_modules(PKGCONFIG REQUIRED lib_manager mars_interfaces