From cb4b71bee6d8ed9a1175d742aec5bc90b9f20983 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 29 May 2022 09:00:43 -0700 Subject: [PATCH] Use target_link_libraries to handle link-type keywords correctly --- cmake/DARTFindBullet.cmake | 18 ++---------------- cmake/DARTFindOpenSceneGraph.cmake | 18 ++---------------- 2 files changed, 4 insertions(+), 32 deletions(-) diff --git a/cmake/DARTFindBullet.cmake b/cmake/DARTFindBullet.cmake index deaecccb0711c..d1fb2a37ae6d4 100644 --- a/cmake/DARTFindBullet.cmake +++ b/cmake/DARTFindBullet.cmake @@ -6,27 +6,13 @@ # # 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. find_package(Bullet COMPONENTS BulletMath BulletCollision MODULE QUIET) if((BULLET_FOUND OR Bullet_FOUND) AND NOT TARGET Bullet) - if(WIN32 AND "optimized" IN_LIST BULLET_LIBRARIES - AND "debug" IN_LIST BULLET_LIBRARIES) - cmake_parse_arguments(BULLET_INTERFACE_LIBRARIES "" "" "debug;optimized" - ${BULLET_LIBRARIES}) - set(BULLET_INTERFACE_LIBRARIES - $<$:${BULLET_INTERFACE_LIBRARIES_debug}> - $<$>:${BULLET_INTERFACE_LIBRARIES_optimized}>) - else() - set(BULLET_INTERFACE_LIBRARIES ${BULLET_LIBRARIES}) - endif() add_library(Bullet INTERFACE IMPORTED) - set_target_properties(Bullet PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${BULLET_INCLUDE_DIRS}" - INTERFACE_LINK_LIBRARIES "${BULLET_INTERFACE_LIBRARIES}" - ) + target_include_directories(Bullet INTERFACE ${BULLET_INCLUDE_DIRS}) + target_link_libraries(Bullet INTERFACE ${BULLET_LIBRARIES}) endif() diff --git a/cmake/DARTFindOpenSceneGraph.cmake b/cmake/DARTFindOpenSceneGraph.cmake index 3b8e90a9bfeb4..06e85c7e06754 100644 --- a/cmake/DARTFindOpenSceneGraph.cmake +++ b/cmake/DARTFindOpenSceneGraph.cmake @@ -6,8 +6,6 @@ # # 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) @@ -57,19 +55,7 @@ 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 - $<$:${OPENSCENEGRAPH_INTERFACE_LIBRARIES_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_INTERFACE_LIBRARIES}" - ) + target_include_directories(osg::osg INTERFACE ${OPENSCENEGRAPH_INCLUDE_DIRS}) + target_link_libraries(osg::osg INTERFACE ${OPENSCENEGRAPH_LIBRARIES}) endif()