From 4837d19d95173b8e9ab35de77fd8ea4d968b465d Mon Sep 17 00:00:00 2001 From: Andrew Price Date: Mon, 7 Mar 2016 19:23:44 -0500 Subject: [PATCH 1/3] Addresses issue #629: DARTConfig.cmake now depends on the autogenerated targets list rather than find_library. --- cmake/DARTConfig.cmake.in | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 014be58171402..49e1d1192316d 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -24,27 +24,24 @@ 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("${CURRENT_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) + list(APPEND DART_LIBRARIES "dart-${comp}") + endif() endforeach(comp) endif(DART_FIND_COMPONENTS) From c3f589d40b5afd2fe9a44f47cc33b1075cc35a2c Mon Sep 17 00:00:00 2001 From: Andrew Price Date: Wed, 9 Mar 2016 14:19:56 -0500 Subject: [PATCH 2/3] Defines a DART__LIBRARY CMake variable for each requested component. --- cmake/DARTConfig.cmake.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 49e1d1192316d..1ecc6b0b9e87d 100644 --- a/cmake/DARTConfig.cmake.in +++ b/cmake/DARTConfig.cmake.in @@ -40,7 +40,8 @@ if(DART_FIND_COMPONENTS) endif() else() set(DART_${comp}_FOUND 1) - list(APPEND DART_LIBRARIES "dart-${comp}") + set(DART_${comp}_LIBRARY "dart-${comp}") + list(APPEND DART_LIBRARIES "${DART_${comp}_LIBRARY}") endif() endforeach(comp) endif(DART_FIND_COMPONENTS) From cd3724a23a8eccd33bb879cf61a15025aafd6606 Mon Sep 17 00:00:00 2001 From: Andrew Price Date: Tue, 15 Mar 2016 18:10:16 -0400 Subject: [PATCH 3/3] Removed DART_LIBRARY_DIRS. --- cmake/DARTConfig.cmake.in | 6 ------ 1 file changed, 6 deletions(-) diff --git a/cmake/DARTConfig.cmake.in b/cmake/DARTConfig.cmake.in index 1ecc6b0b9e87d..20b1298de7c42 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. #=============================================================================== @@ -15,11 +14,6 @@ set(DART_INCLUDE_DIRS "@EIGEN3_INCLUDE_DIRS@" "@BULLET_INCLUDE_DIRS@") -#=============================================================================== -# DART_LIBRARY_DIRS -#=============================================================================== -set(DART_LIBRARY_DIRS "@CMAKE_INSTALL_PREFIX@/lib" "@Boost_LIBRARY_DIRS@") - #=============================================================================== # DART_LIBRARIES #===============================================================================