Skip to content

Commit

Permalink
Fix finding OSG on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed May 29, 2022
1 parent a240aac commit 51e458a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cmake/DARTFindBullet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
# This file is provided under the "BSD-style" License

include(CMakeParseArguments)

# Bullet. Force MODULE mode to use the FindBullet.cmake file distributed with
# CMake. Otherwise, we may end up using the BulletConfig.cmake file distributed
# with Bullet, which uses relative paths and may break transitive dependencies.
Expand Down
14 changes: 13 additions & 1 deletion cmake/DARTFindOpenSceneGraph.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#
# This file is provided under the "BSD-style" License

include(CMakeParseArguments)

if (CMAKE_VERSION VERSION_LESS 3.12)
get_property(old_find_library_use_lib64_paths GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
Expand Down Expand Up @@ -55,9 +57,19 @@ endif()
# variables contain absolute paths of OpenSceneGraph that could be different in
# where the system that DART is built and where the system that consumes DART.
if((OPENSCENEGRAPH_FOUND OR OpenSceneGraph_FOUND) AND NOT TARGET osg::osg)
if(WIN32 AND "optimized" IN_LIST OPENSCENEGRAPH_LIBRARIES
AND "debug" IN_LIST OPENSCENEGRAPH_LIBRARIES)
cmake_parse_arguments(OPENSCENEGRAPH_INTERFACE_LIBRARIES "" "" "debug;optimized"
${OPENSCENEGRAPH_LIBRARIES})
set(OPENSCENEGRAPH_INTERFACE_LIBRARIES
$<$<CONFIG:Debug>:${OPENSCENEGRAPH_INTERFACE_LIBRARIES_debug}>
$<$<NOT:$<CONFIG:Debug>>:${OPENSCENEGRAPH_INTERFACE_LIBRARIES_optimized}>)
else()
set(OPENSCENEGRAPH_INTERFACE_LIBRARIES ${OPENSCENEGRAPH_LIBRARIES})
endif()
add_library(osg::osg INTERFACE IMPORTED)
set_target_properties(osg::osg PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${OPENSCENEGRAPH_INCLUDE_DIRS}"
INTERFACE_LINK_LIBRARIES "${OPENSCENEGRAPH_LIBRARIES}"
INTERFACE_LINK_LIBRARIES "${OPENSCENEGRAPH_INTERFACE_LIBRARIES}"
)
endif()

0 comments on commit 51e458a

Please sign in to comment.