Fix search path for miniglog headers when Ceres is exported. - When Ceres is exported (rather than installed), the miniglog headers still reside in the internal Ceres source directory, not the public headers directory. Change-Id: Ia54eb7f8bb0cd24c0112a715a739c15247bc9239
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in index c0e7767..c225058 100644 --- a/cmake/CeresConfig.cmake.in +++ b/cmake/CeresConfig.cmake.in
@@ -236,11 +236,18 @@ set(CERES_USES_GFLAGS @GFLAGS@) if (CERES_USES_MINIGLOG) set(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog) + if (NOT CERES_WAS_INSTALLED) + # When Ceres was exported from the build tree, the miniglog headers + # will be in Ceres internal source directory, not in the public headers + # directory (they are copied with the public headers when installed). + set(MINIGLOG_INCLUDE_DIR + ${CERES_EXPORTED_SOURCE_DIR}/internal/ceres/miniglog) + endif() if (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) ceres_report_not_found( - "Ceres include directory: " - "${CERES_INCLUDE_DIR} does not include miniglog, but Ceres was " - "compiled with MINIGLOG enabled (in place of Glog).") + "Failed to find miniglog headers in expected include directory: " + "${MINIGLOG_INCLUDE_DIR}, but Ceres was compiled with MINIGLOG enabled " + "(in place of glog).") endif (NOT EXISTS ${MINIGLOG_INCLUDE_DIR}) list(APPEND CERES_INCLUDE_DIRS ${MINIGLOG_INCLUDE_DIR}) # Output message at standard log level (not the lower STATUS) so that