Skip to content

Commit

Permalink
Protect dart-gui-osg and check more rigorously for the presence of OSG (
Browse files Browse the repository at this point in the history
#898)

Protect dart-gui-osg from being compiled when OSG is not present, and check more rigorously for the presence of OSG
  • Loading branch information
mxgrey authored Aug 7, 2017
1 parent 0c56851 commit 71e31c9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dart/gui/osg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ if(DART_BUILD_GUI_OSG)

find_package(OpenSceneGraph 3.0 QUIET
COMPONENTS osg osgViewer osgManipulator osgGA osgDB)
if(OPENSCENEGRAPH_FOUND)

# It seems that OPENSCENEGRAPH_FOUND will inadvertently get set to true when
# OpenThreads is found, even if OpenSceneGraph is not installed. This is quite
# possibly a bug in OSG's cmake configuration file. For now, it seems that
# requiring OSG_FOUND to be true as well fixes this.
if(OPENSCENEGRAPH_FOUND AND OSG_FOUND)
if(DART_VERBOSE)
message(STATUS "Looking for OpenSceneGraph - ${OPENSCENEGRAPH_VERSION} found")
endif()
set(HAVE_OPENSCENEGRAPH TRUE)
else()
# dart-gui-osg requires both OSG and OpenThreads. This section attempts to
# identify which of those are missing from the building machine and offer
Expand All @@ -29,13 +33,13 @@ if(DART_BUILD_GUI_OSG)
endif()
message(WARNING "${warning_msg} -- we will skip dart-gui-osg\n"
"If you believe you do have both OSG and OpenThreads installed, try setting OSG_DIR")
set(HAVE_OPENSCENEGRAPH FALSE)
return()
endif()

else()

message(STATUS "Skipping OpenSceneGraph (DART_BUILD_GUI_OSG == ${DART_BUILD_GUI_OSG})")
set(HAVE_OPENSCENEGRAPH FALSE)
return()

endif()

Expand Down

0 comments on commit 71e31c9

Please sign in to comment.