Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 1 | # Ceres Solver - A fast non-linear least squares minimizer |
| 2 | # Copyright 2015 Google Inc. All rights reserved. |
| 3 | # http://ceres-solver.org/ |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # |
| 8 | # * Redistributions of source code must retain the above copyright notice, |
| 9 | # this list of conditions and the following disclaimer. |
| 10 | # * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | # this list of conditions and the following disclaimer in the documentation |
| 12 | # and/or other materials provided with the distribution. |
| 13 | # * Neither the name of Google Inc. nor the names of its contributors may be |
| 14 | # used to endorse or promote products derived from this software without |
| 15 | # specific prior written permission. |
| 16 | # |
| 17 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 18 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 19 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 20 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
| 21 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 22 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 23 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 24 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 25 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 26 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 27 | # POSSIBILITY OF SUCH DAMAGE. |
| 28 | # |
| 29 | # Author: alexs.mac@gmail.com (Alex Stewart) |
| 30 | # |
| 31 | |
| 32 | # FindGlog.cmake - Find Google glog logging library. |
| 33 | # |
| 34 | # This module defines the following variables: |
| 35 | # |
| 36 | # GLOG_FOUND: TRUE iff glog is found. |
| 37 | # GLOG_INCLUDE_DIRS: Include directories for glog. |
| 38 | # GLOG_LIBRARIES: Libraries required to link glog. |
| 39 | # FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION: True iff the version of glog found |
| 40 | # was built & installed / exported |
| 41 | # as a CMake package. |
| 42 | # |
| 43 | # The following variables control the behaviour of this module: |
| 44 | # |
| 45 | # GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE then |
| 46 | # then prefer using an exported CMake configuration |
| 47 | # generated by glog > 0.3.4 over searching for the |
| 48 | # glog components manually. Otherwise (FALSE) |
| 49 | # ignore any exported glog CMake configurations and |
| 50 | # always perform a manual search for the components. |
| 51 | # Default: TRUE iff user does not define this variable |
| 52 | # before we are called, and does NOT specify either |
| 53 | # GLOG_INCLUDE_DIR_HINTS or GLOG_LIBRARY_DIR_HINTS |
| 54 | # otherwise FALSE. |
| 55 | # GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to |
| 56 | # search for glog includes, e.g: /timbuktu/include. |
| 57 | # GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to |
| 58 | # search for glog libraries, e.g: /timbuktu/lib. |
| 59 | # |
| 60 | # The following variables are also defined by this module, but in line with |
| 61 | # CMake recommended FindPackage() module style should NOT be referenced directly |
| 62 | # by callers (use the plural variables detailed above instead). These variables |
| 63 | # do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which |
| 64 | # are NOT re-called (i.e. search for library is not repeated) if these variables |
| 65 | # are set with valid values _in the CMake cache_. This means that if these |
| 66 | # variables are set directly in the cache, either by the user in the CMake GUI, |
| 67 | # or by the user passing -DVAR=VALUE directives to CMake when called (which |
| 68 | # explicitly defines a cache variable), then they will be used verbatim, |
| 69 | # bypassing the HINTS variables and other hard-coded search locations. |
| 70 | # |
| 71 | # GLOG_INCLUDE_DIR: Include directory for glog, not including the |
| 72 | # include directory of any dependencies. |
| 73 | # GLOG_LIBRARY: glog library, not including the libraries of any |
| 74 | # dependencies. |
| 75 | |
| 76 | # Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when |
| 77 | # FindGlog was invoked. |
| 78 | macro(GLOG_RESET_FIND_LIBRARY_PREFIX) |
| 79 | if (MSVC AND CALLERS_CMAKE_FIND_LIBRARY_PREFIXES) |
| 80 | set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}") |
| 81 | endif() |
| 82 | endmacro(GLOG_RESET_FIND_LIBRARY_PREFIX) |
| 83 | |
| 84 | # Called if we failed to find glog or any of it's required dependencies, |
| 85 | # unsets all public (designed to be used externally) variables and reports |
| 86 | # error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument. |
| 87 | macro(GLOG_REPORT_NOT_FOUND REASON_MSG) |
| 88 | unset(GLOG_FOUND) |
| 89 | unset(GLOG_INCLUDE_DIRS) |
| 90 | unset(GLOG_LIBRARIES) |
| 91 | # Make results of search visible in the CMake GUI if glog has not |
| 92 | # been found so that user does not have to toggle to advanced view. |
| 93 | mark_as_advanced(CLEAR GLOG_INCLUDE_DIR |
| 94 | GLOG_LIBRARY) |
| 95 | |
| 96 | glog_reset_find_library_prefix() |
| 97 | |
| 98 | # Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage() |
| 99 | # use the camelcase library name, not uppercase. |
| 100 | if (Glog_FIND_QUIETLY) |
| 101 | message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN}) |
| 102 | elseif (Glog_FIND_REQUIRED) |
| 103 | message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN}) |
| 104 | else() |
| 105 | # Neither QUIETLY nor REQUIRED, use no priority which emits a message |
| 106 | # but continues configuration and allows generation. |
| 107 | message("-- Failed to find glog - " ${REASON_MSG} ${ARGN}) |
| 108 | endif () |
| 109 | return() |
| 110 | endmacro(GLOG_REPORT_NOT_FOUND) |
| 111 | |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 112 | # glog_message([mode] "message text") |
| 113 | # |
| 114 | # Wraps the standard cmake 'message' command, but suppresses output |
| 115 | # if the QUIET flag was passed to the find_package(Glog ...) call. |
| 116 | function(GLOG_MESSAGE) |
| 117 | if (NOT Glog_FIND_QUIETLY) |
| 118 | message(${ARGN}) |
| 119 | endif() |
| 120 | endfunction() |
| 121 | |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 122 | # Protect against any alternative find_package scripts for this library having |
| 123 | # been called previously (in a client project) which set GLOG_FOUND, but not |
| 124 | # the other variables we require / set here which could cause the search logic |
| 125 | # here to fail. |
| 126 | unset(GLOG_FOUND) |
| 127 | |
| 128 | # ----------------------------------------------------------------- |
| 129 | # By default, if the user has expressed no preference for using an exported |
| 130 | # glog CMake configuration over performing a search for the installed |
| 131 | # components, and has not specified any hints for the search locations, then |
| 132 | # prefer a glog exported configuration if available. |
| 133 | if (NOT DEFINED GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION |
| 134 | AND NOT GLOG_INCLUDE_DIR_HINTS |
| 135 | AND NOT GLOG_LIBRARY_DIR_HINTS) |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 136 | glog_message(STATUS "No preference for use of exported glog CMake " |
| 137 | "configuration set, and no hints for include/library directories provided. " |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 138 | "Defaulting to preferring an installed/exported glog CMake configuration " |
| 139 | "if available.") |
| 140 | set(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION TRUE) |
| 141 | endif() |
| 142 | |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 143 | # On macOS, add the Homebrew prefix (with appropriate suffixes) to the |
| 144 | # respective HINTS directories (after any user-specified locations). This |
| 145 | # handles Homebrew installations into non-standard locations (not /usr/local). |
| 146 | # We do not use CMAKE_PREFIX_PATH for this as given the search ordering of |
| 147 | # find_xxx(), doing so would override any user-specified HINTS locations with |
| 148 | # the Homebrew version if it exists. |
| 149 | if (CMAKE_SYSTEM_NAME MATCHES "Darwin") |
| 150 | find_program(HOMEBREW_EXECUTABLE brew) |
| 151 | mark_as_advanced(FORCE HOMEBREW_EXECUTABLE) |
| 152 | if (HOMEBREW_EXECUTABLE) |
| 153 | # Detected a Homebrew install, query for its install prefix. |
| 154 | execute_process(COMMAND ${HOMEBREW_EXECUTABLE} --prefix |
| 155 | OUTPUT_VARIABLE HOMEBREW_INSTALL_PREFIX |
| 156 | OUTPUT_STRIP_TRAILING_WHITESPACE) |
| 157 | glog_message(STATUS "Detected Homebrew with install prefix: " |
| 158 | "${HOMEBREW_INSTALL_PREFIX}, adding to CMake search paths.") |
| 159 | list(APPEND GLOG_INCLUDE_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/include") |
| 160 | list(APPEND GLOG_LIBRARY_DIR_HINTS "${HOMEBREW_INSTALL_PREFIX}/lib") |
| 161 | endif() |
| 162 | endif() |
| 163 | |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 164 | if (GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION) |
| 165 | # Try to find an exported CMake configuration for glog, as generated by |
| 166 | # glog versions > 0.3.4 |
| 167 | # |
| 168 | # We search twice, s/t we can invert the ordering of precedence used by |
| 169 | # find_package() for exported package build directories, and installed |
| 170 | # packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7) |
| 171 | # respectively in [1]. |
| 172 | # |
| 173 | # By default, exported build directories are (in theory) detected first, and |
| 174 | # this is usually the case on Windows. However, on OS X & Linux, the install |
| 175 | # path (/usr/local) is typically present in the PATH environment variable |
| 176 | # which is checked in item 4) in [1] (i.e. before both of the above, unless |
| 177 | # NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed |
| 178 | # packages are usually detected in preference to exported package build |
| 179 | # directories. |
| 180 | # |
| 181 | # To ensure a more consistent response across all OSs, and as users usually |
| 182 | # want to prefer an installed version of a package over a locally built one |
| 183 | # where both exist (esp. as the exported build directory might be removed |
| 184 | # after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which |
| 185 | # means any build directories exported by the user are ignored, and thus |
| 186 | # installed directories are preferred. If this fails to find the package |
| 187 | # we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any |
| 188 | # exported build directories will now be detected. |
| 189 | # |
| 190 | # To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which |
| 191 | # is item 5) in [1]), to not preferentially use projects that were built |
| 192 | # recently with the CMake GUI to ensure that we always prefer an installed |
| 193 | # version if available. |
| 194 | # |
| 195 | # NOTE: We use the NAMES option as glog erroneously uses 'google-glog' as its |
| 196 | # project name when built with CMake, but exports itself as just 'glog'. |
| 197 | # On Linux/OS X this does not break detection as the project name is |
| 198 | # not used as part of the install path for the CMake package files, |
| 199 | # e.g. /usr/local/lib/cmake/glog, where the <glog> suffix is hardcoded |
| 200 | # in glog's CMakeLists. However, on Windows the project name *is* |
| 201 | # part of the install prefix: C:/Program Files/google-glog/[include,lib]. |
| 202 | # However, by default CMake checks: |
| 203 | # C:/Program Files/<FIND_PACKAGE_ARGUMENT_NAME='glog'> which does not |
| 204 | # exist and thus detection fails. Thus we use the NAMES to force the |
| 205 | # search to use both google-glog & glog. |
| 206 | # |
| 207 | # [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package |
| 208 | find_package(glog QUIET |
| 209 | NAMES google-glog glog |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 210 | HINTS ${glog_DIR} ${HOMEBREW_INSTALL_PREFIX} |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 211 | NO_MODULE |
| 212 | NO_CMAKE_PACKAGE_REGISTRY |
| 213 | NO_CMAKE_BUILDS_PATH) |
| 214 | if (glog_FOUND) |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 215 | glog_message(STATUS "Found installed version of glog: ${glog_DIR}") |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 216 | else() |
| 217 | # Failed to find an installed version of glog, repeat search allowing |
| 218 | # exported build directories. |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 219 | glog_message(STATUS "Failed to find installed glog CMake configuration, " |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 220 | "searching for glog build directories exported with CMake.") |
| 221 | # Again pass NO_CMAKE_BUILDS_PATH, as we know that glog is exported and |
| 222 | # do not want to treat projects built with the CMake GUI preferentially. |
| 223 | find_package(glog QUIET |
| 224 | NAMES google-glog glog |
| 225 | NO_MODULE |
| 226 | NO_CMAKE_BUILDS_PATH) |
| 227 | if (glog_FOUND) |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 228 | glog_message(STATUS "Found exported glog build directory: ${glog_DIR}") |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 229 | endif(glog_FOUND) |
| 230 | endif(glog_FOUND) |
| 231 | |
| 232 | set(FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION ${glog_FOUND}) |
| 233 | |
| 234 | if (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION) |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 235 | glog_message(STATUS "Detected glog version: ${glog_VERSION}") |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 236 | set(GLOG_FOUND ${glog_FOUND}) |
| 237 | # glog wraps the include directories into the exported glog::glog target. |
| 238 | set(GLOG_INCLUDE_DIR "") |
| 239 | set(GLOG_LIBRARY glog::glog) |
| 240 | else (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION) |
Austin Schuh | 1d1e6ea | 2020-12-23 21:56:30 -0800 | [diff] [blame^] | 241 | glog_message(STATUS "Failed to find an installed/exported CMake " |
| 242 | "configuration for glog, will perform search for installed glog " |
| 243 | "components.") |
Austin Schuh | 70cc955 | 2019-01-21 19:46:48 -0800 | [diff] [blame] | 244 | endif (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION) |
| 245 | endif(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION) |
| 246 | |
| 247 | if (NOT GLOG_FOUND) |
| 248 | # Either failed to find an exported glog CMake configuration, or user |
| 249 | # told us not to use one. Perform a manual search for all glog components. |
| 250 | |
| 251 | # Handle possible presence of lib prefix for libraries on MSVC, see |
| 252 | # also GLOG_RESET_FIND_LIBRARY_PREFIX(). |
| 253 | if (MSVC) |
| 254 | # Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES |
| 255 | # s/t we can set it back before returning. |
| 256 | set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}") |
| 257 | # The empty string in this list is important, it represents the case when |
| 258 | # the libraries have no prefix (shared libraries / DLLs). |
| 259 | set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}") |
| 260 | endif (MSVC) |
| 261 | |
| 262 | # Search user-installed locations first, so that we prefer user installs |
| 263 | # to system installs where both exist. |
| 264 | list(APPEND GLOG_CHECK_INCLUDE_DIRS |
| 265 | /usr/local/include |
| 266 | /usr/local/homebrew/include # Mac OS X |
| 267 | /opt/local/var/macports/software # Mac OS X. |
| 268 | /opt/local/include |
| 269 | /usr/include) |
| 270 | # Windows (for C:/Program Files prefix). |
| 271 | list(APPEND GLOG_CHECK_PATH_SUFFIXES |
| 272 | glog/include |
| 273 | glog/Include |
| 274 | Glog/include |
| 275 | Glog/Include |
| 276 | google-glog/include # CMake installs with project name prefix. |
| 277 | google-glog/Include) |
| 278 | |
| 279 | list(APPEND GLOG_CHECK_LIBRARY_DIRS |
| 280 | /usr/local/lib |
| 281 | /usr/local/homebrew/lib # Mac OS X. |
| 282 | /opt/local/lib |
| 283 | /usr/lib) |
| 284 | # Windows (for C:/Program Files prefix). |
| 285 | list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES |
| 286 | glog/lib |
| 287 | glog/Lib |
| 288 | Glog/lib |
| 289 | Glog/Lib |
| 290 | google-glog/lib # CMake installs with project name prefix. |
| 291 | google-glog/Lib) |
| 292 | |
| 293 | # Search supplied hint directories first if supplied. |
| 294 | find_path(GLOG_INCLUDE_DIR |
| 295 | NAMES glog/logging.h |
| 296 | HINTS ${GLOG_INCLUDE_DIR_HINTS} |
| 297 | PATHS ${GLOG_CHECK_INCLUDE_DIRS} |
| 298 | PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES}) |
| 299 | if (NOT GLOG_INCLUDE_DIR OR |
| 300 | NOT EXISTS ${GLOG_INCLUDE_DIR}) |
| 301 | glog_report_not_found( |
| 302 | "Could not find glog include directory, set GLOG_INCLUDE_DIR " |
| 303 | "to directory containing glog/logging.h") |
| 304 | endif (NOT GLOG_INCLUDE_DIR OR |
| 305 | NOT EXISTS ${GLOG_INCLUDE_DIR}) |
| 306 | |
| 307 | find_library(GLOG_LIBRARY NAMES glog |
| 308 | HINTS ${GLOG_LIBRARY_DIR_HINTS} |
| 309 | PATHS ${GLOG_CHECK_LIBRARY_DIRS} |
| 310 | PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES}) |
| 311 | if (NOT GLOG_LIBRARY OR |
| 312 | NOT EXISTS ${GLOG_LIBRARY}) |
| 313 | glog_report_not_found( |
| 314 | "Could not find glog library, set GLOG_LIBRARY " |
| 315 | "to full path to libglog.") |
| 316 | endif (NOT GLOG_LIBRARY OR |
| 317 | NOT EXISTS ${GLOG_LIBRARY}) |
| 318 | |
| 319 | # Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets |
| 320 | # if called. |
| 321 | set(GLOG_FOUND TRUE) |
| 322 | |
| 323 | # Glog does not seem to provide any record of the version in its |
| 324 | # source tree, thus cannot extract version. |
| 325 | |
| 326 | # Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and |
| 327 | # thus FIND_[PATH/LIBRARY] are not called, but specified locations are |
| 328 | # invalid, otherwise we would report the library as found. |
| 329 | if (GLOG_INCLUDE_DIR AND |
| 330 | NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h) |
| 331 | glog_report_not_found( |
| 332 | "Caller defined GLOG_INCLUDE_DIR:" |
| 333 | " ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.") |
| 334 | endif (GLOG_INCLUDE_DIR AND |
| 335 | NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h) |
| 336 | # TODO: This regex for glog library is pretty primitive, we use lowercase |
| 337 | # for comparison to handle Windows using CamelCase library names, could |
| 338 | # this check be better? |
| 339 | string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY) |
| 340 | if (GLOG_LIBRARY AND |
| 341 | NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*") |
| 342 | glog_report_not_found( |
| 343 | "Caller defined GLOG_LIBRARY: " |
| 344 | "${GLOG_LIBRARY} does not match glog.") |
| 345 | endif (GLOG_LIBRARY AND |
| 346 | NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*") |
| 347 | |
| 348 | glog_reset_find_library_prefix() |
| 349 | |
| 350 | endif(NOT GLOG_FOUND) |
| 351 | |
| 352 | # Set standard CMake FindPackage variables if found. |
| 353 | if (GLOG_FOUND) |
| 354 | set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR}) |
| 355 | set(GLOG_LIBRARIES ${GLOG_LIBRARY}) |
| 356 | endif (GLOG_FOUND) |
| 357 | |
| 358 | # If we are using an exported CMake glog target, the include directories are |
| 359 | # wrapped into the target itself, and do not have to be (and are not) |
| 360 | # separately specified. In which case, we should not add GLOG_INCLUDE_DIRS |
| 361 | # to the list of required variables in order that glog be reported as found. |
| 362 | if (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION) |
| 363 | set(GLOG_REQUIRED_VARIABLES GLOG_LIBRARIES) |
| 364 | else() |
| 365 | set(GLOG_REQUIRED_VARIABLES GLOG_INCLUDE_DIRS GLOG_LIBRARIES) |
| 366 | endif() |
| 367 | |
| 368 | # Handle REQUIRED / QUIET optional arguments. |
| 369 | include(FindPackageHandleStandardArgs) |
| 370 | find_package_handle_standard_args(Glog DEFAULT_MSG |
| 371 | ${GLOG_REQUIRED_VARIABLES}) |
| 372 | |
| 373 | # Only mark internal variables as advanced if we found glog, otherwise |
| 374 | # leave them visible in the standard GUI for the user to set manually. |
| 375 | if (GLOG_FOUND) |
| 376 | mark_as_advanced(FORCE GLOG_INCLUDE_DIR |
| 377 | GLOG_LIBRARY |
| 378 | glog_DIR) # Autogenerated by find_package(glog) |
| 379 | endif (GLOG_FOUND) |