Ensure build paths for dependencies are searched in FindPackage(Ceres) - Append to hint locations used by FindPackage scripts for public dependencies (glog & Eigen) the locations of the dependencies when Ceres was built. - This means that the user should not have to supply them again when using find_package(Ceres) even if they are installed in a non-standard location. Change-Id: I9550de91025ba47f01f1ea3c3fefe80fe38d14ff
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index 6044700..1a33656 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in
@@ -126,6 +126,8 @@ # Eigen. # Flag set during configuration and build of Ceres. SET(CERES_EIGEN_VERSION @EIGEN_VERSION@) +# Append the locations of Eigen when Ceres was built to the search path hints. +LIST(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN_INCLUDE_DIR@) # Search quietly s/t we control the timing of the error message if not found. FIND_PACKAGE(Eigen ${CERES_EIGEN_VERSION} EXACT QUIET) IF (EIGEN_FOUND) @@ -141,6 +143,10 @@ # Glog. # Flag set during configuration and build of Ceres. SET(CERES_USES_MINIGLOG @MINIGLOG@) +# Append the locations of glog when Ceres was built to the search path hints. +LIST(APPEND GLOG_INCLUDE_DIR_HINTS @GLOG_INCLUDE_DIR@) +GET_FILENAME_COMPONENT(CERES_BUILD_GLOG_LIBRARY_DIR @GLOG_LIBRARY@ PATH) +LIST(APPEND GLOG_LIBRARY_DIR_HINTS ${CERES_BUILD_GLOG_LIBRARY_DIR}) IF (CERES_USES_MINIGLOG) SET(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog) IF (NOT EXISTS ${MINIGLOG_INCLUDE_DIR})