Fix Cmake error when using miniglog.
Create the glog include directories and library directories
only if we've already checked that the user is using
glog (and not miniglog).
Otherwise, @GLOG_INCLUDE_DIR@ and @GLOG_LIBRARY@ will be
empty and the generated files will cause Cmake errors.
Change-Id: Ia0ce9cf98f7d56c83b2285f72f45b8e0d5dc34c4
diff --git a/cmake/CeresConfig.cmake.in b/cmake/CeresConfig.cmake.in
index 0e13d9e..a846850 100644
--- a/cmake/CeresConfig.cmake.in
+++ b/cmake/CeresConfig.cmake.in
@@ -160,10 +160,6 @@
# 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})
@@ -178,6 +174,11 @@
MESSAGE("-- Found Ceres installation compiled with miniglog substitute "
"for glog, beware this will likely cause problems if glog is later linked.")
ELSE (CERES_USES_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})
+
# Search quietly s/t we control the timing of the error message if not found.
FIND_PACKAGE(Glog QUIET)
IF (GLOG_FOUND)