From 6ed0aaad1786859cdcb0fd3c1e3b2decf6f4e56b Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 24 Apr 2016 14:59:48 -0400 Subject: [PATCH 1/2] Fix BULLET_INCLUDE_DIRS in DART[Core]Config.cmake The fix from #361 doesn't work if bullet package was found by `find_package`. If bullet is not found, `BULLET_INCLUDE_DIRS` will be set to `BULLET_INCLUDE_DIRS-NOT-FOUND` rather than blank as we assumed in #361. Instead, we set DART_INCLUDE_DIRS in the top CMakeList.txt depending on the condition of that bullet has found, and then use it in DART[Core]Config.cmake.in. --- CMakeLists.txt | 7 +++++++ cmake/DARTConfig.cmake.in | 5 +---- cmake/DARTCoreConfig.cmake.in | 5 +---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6236a9cffa756..e638282cafb64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -445,6 +445,13 @@ endif() include_directories("${CMAKE_BINARY_DIR}") +set(DART_INCLUDE_DIRS + "${CMAKE_INSTALL_PREFIX}/include" + "${EIGEN3_INCLUDE_DIRS}") +if(HAVE_BULLET_COLLISION) + list(APPEND DART_INCLUDE_DIRS "${BULLET_INCLUDE_DIRS}") +endif() + #=============================================================================== # Link directories #=============================================================================== diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 014be58171402..6ee608bbecf15 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -10,10 +10,7 @@ #=============================================================================== # DART_INCLUDE_DIRS #=============================================================================== -set(DART_INCLUDE_DIRS - "@CMAKE_INSTALL_PREFIX@/include" - "@EIGEN3_INCLUDE_DIRS@" - "@BULLET_INCLUDE_DIRS@") +set(DART_INCLUDE_DIRS "@DART_INCLUDE_DIRS@") #=============================================================================== # DART_LIBRARY_DIRS diff --git a/cmake/DARTCoreConfig.cmake.in b/cmake/DARTCoreConfig.cmake.in index b343fe5295000..9e2f442573ef9 100644 --- a/cmake/DARTCoreConfig.cmake.in +++ b/cmake/DARTCoreConfig.cmake.in @@ -10,10 +10,7 @@ #=============================================================================== # DARTCore_INCLUDE_DIRS #=============================================================================== -set(DARTCore_INCLUDE_DIRS - "@CMAKE_INSTALL_PREFIX@/include" - "@EIGEN3_INCLUDE_DIRS@" - "@BULLET_INCLUDE_DIRS@") +set(DARTCore_INCLUDE_DIRS "@DART_INCLUDE_DIRS@") #=============================================================================== # DARTCore_LIBRARY_DIRS From d43e084f28e7bba5844cf60e86b8986bf6b3abd3 Mon Sep 17 00:00:00 2001 From: Jeongseok Lee Date: Sun, 24 Apr 2016 15:05:53 -0400 Subject: [PATCH 2/2] #630 for DART 5.1 --- cmake/DARTConfig.cmake.in | 33 ++++++++++++--------------------- cmake/DARTCoreConfig.cmake.in | 19 ++++--------------- 2 files changed, 16 insertions(+), 36 deletions(-) diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 6ee608bbecf15..42a97be38cec3 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -4,7 +4,6 @@ # This sets the following variables: # DART_INCLUDE_DIRS - Directories containing the DART include files. # DART_LIBRARIES - Libraries needed to use DART. -# DART_LIBRARY_DIRS - Directories that contain the DART libraries. # DART_VERSION - DART version. #=============================================================================== @@ -12,36 +11,28 @@ #=============================================================================== set(DART_INCLUDE_DIRS "@DART_INCLUDE_DIRS@") -#=============================================================================== -# DART_LIBRARY_DIRS -#=============================================================================== -set(DART_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/lib" "@Boost_LIBRARY_DIRS@") - #=============================================================================== # DART_LIBRARIES #=============================================================================== -get_filename_component(CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include("${CURRENT_DIR}/DARTTargets.cmake") -# Return absolute path of the library instead of just library name as -# recommended in CMake documentation: -# http://www.cmake.org/cmake/help/v3.0/command/link_directories.html -find_library(dart_location NAMES "dart" PATHS "@CMAKE_INSTALL_PREFIX@/lib") -set(DART_LIBRARIES "${dart_location}") +if(NOT TARGET dart) + include("${CMAKE_CURRENT_LIST_DIR}/DARTTargets.cmake") +endif() +set(DART_LIBRARIES dart) # Handle requested components in find_package(DART COMPONENTS [components]). # The list of components is passed in DART_FIND_COMPONENTS. if(DART_FIND_COMPONENTS) foreach(comp ${DART_FIND_COMPONENTS}) - find_library(dart_${comp}_location - NAMES "dart-${comp}" - PATHS "@CMAKE_INSTALL_PREFIX@/lib") - if(dart_${comp}_location) - list(APPEND DART_LIBRARIES "${dart_${comp}_location}") - else() + if(NOT TARGET "dart-${comp}") + set(DART_${comp}_FOUND 0) if(DART_FIND_REQUIRED_${comp}) message(FATAL_ERROR "dart-${comp} not available") - endif(DART_FIND_REQUIRED_${comp}) - endif(dart_${comp}_location) + endif() + else() + set(DART_${comp}_FOUND 1) + set(DART_${comp}_LIBRARY "dart-${comp}") + list(APPEND DART_LIBRARIES "${DART_${comp}_LIBRARY}") + endif() endforeach(comp) endif(DART_FIND_COMPONENTS) diff --git a/cmake/DARTCoreConfig.cmake.in b/cmake/DARTCoreConfig.cmake.in index 9e2f442573ef9..d1e007462e1f2 100644 --- a/cmake/DARTCoreConfig.cmake.in +++ b/cmake/DARTCoreConfig.cmake.in @@ -3,7 +3,6 @@ # # This sets the following variables: # DARTCore_INCLUDE_DIRS - Directories containing the DART include files. -# DARTCore_LIBRARIES - Libraries needed to use DART. # DARTCore_LIBRARY_DIRS - Directories that contain the DART libraries. # DARTCore_VERSION - DART version. @@ -12,23 +11,13 @@ #=============================================================================== set(DARTCore_INCLUDE_DIRS "@DART_INCLUDE_DIRS@") -#=============================================================================== -# DARTCore_LIBRARY_DIRS -#=============================================================================== -set(DARTCore_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/lib" "@Boost_LIBRARY_DIRS@") - #=============================================================================== # DARTCore_LIBRARIES #=============================================================================== -get_filename_component(CURRENT_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include("${CURRENT_DIR}/DARTCoreTargets.cmake") -# Return absolute path of the library instead of just library name as -# recommended in CMake documentation: -# http://www.cmake.org/cmake/help/v3.0/command/link_directories.html -find_library(dart_core_location - NAMES "dart-core" - PATHS "@CMAKE_INSTALL_PREFIX@/lib") -set(DARTCore_LIBRARIES "${dart_core_location}") +if(NOT TARGET dart-core) + include("${CMAKE_CURRENT_LIST_DIR}/DARTCoreTargets.cmake") +endif() +set(DARTCore_LIBRARIES dart-core) #=============================================================================== # DARTCore_VERSION