Skip to content

Commit

Permalink
Fix cmake issue with osgEarthImGui where find_dependency was not call…
Browse files Browse the repository at this point in the history
…ed for GLEW or OpenGL
  • Loading branch information
gwaldron committed Aug 30, 2024
1 parent d943b2c commit 1966c95
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
19 changes: 15 additions & 4 deletions cmake/osgEarth-config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#
# CMake Config TEMPLATE
# Inputs:
# osgEarth CMake Config
#
# Developer inputs:
# OSGEARTH_VERSION : osgEarth version string
# OSGEARTH_COMPONENTS : list of libraries for which to create namespaced imports
# OSGEARTH_PUBLIC_DEPENDENCIES : list of libraries for which to generate find_dependency
#
# User outputs:
# osgEarth::osgEarth import library (and one for each additonal nodekit)
# osgEarth_FOUND : true if successful
# osgEarth_INCLUDE_DIR : include root
# osgEarth_SHARE_DIR : location of share folder containing cmake files and external resources
#
cmake_minimum_required(VERSION 3.10.0)

Expand All @@ -24,10 +32,13 @@ set_and_check(osgEarth_BUILD_DIR "${PACKAGE_PREFIX_DIR}")
# always depend on the public-facing OSG libraries
include(CMakeFindDependencyMacro)
find_dependency(OpenSceneGraph REQUIRED COMPONENTS osg osgDB osgGA osgUtil osgViewer OpenThreads)

# must foreably include the OSG include root
include_directories(${OPENSCENEGRAPH_INCLUDE_DIR})

# additional public dependencies
foreach(MY_DEPENDENCY @OSGEARTH_PUBLIC_DEPENDENCIES@)
find_dependency(${MY_DEPENDENCY} REQUIRED)
endforeach()

# include the target for each library in OSGEARTH_COMPONENTS:
foreach(MY_COMPONENT @OSGEARTH_COMPONENTS@)
if(NOT TARGET osgEarth::${MY_COMPONENT})
Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
set(OSGEARTH_COMPONENTS)
list(APPEND OSGEARTH_COMPONENTS osgEarth)

# A list of public-facing dependencies for the packaging targets
set(OSGEARTH_PUBLIC_DEPENDENCIES)


if(OSGEARTH_BUILD_IMGUI_NODEKIT)
add_subdirectory(osgEarthImGui)
list(APPEND OSGEARTH_COMPONENTS osgEarthImGui)
list(APPEND OSGEARTH_PUBLIC_DEPENDENCIES GLEW)
list(APPEND OSGEARTH_PUBLIC_DEPENDENCIES OpenGL)
endif()

if(OSGEARTH_BUILD_PROCEDURAL_NODEKIT)
Expand Down
2 changes: 1 addition & 1 deletion src/osgEarthImGui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ add_osgearth_library(
TARGET ${LIB_NAME}
SOURCES ${LIB_SOURCES} ${IMGUI_SOURCES}
PUBLIC_HEADERS ${LIB_HEADERS} ${IMGUI_HEADERS} ${STOCK_PANELS}
LIBRARIES PRIVATE GLEW::GLEW OpenGL::GL
LIBRARIES PUBLIC GLEW::GLEW OpenGL::GL
FOLDER "NodeKits")

0 comments on commit 1966c95

Please sign in to comment.