Skip to content
Snippets Groups Projects
Commit c6045669 authored by Joaquim Casals Buñuel's avatar Joaquim Casals Buñuel
Browse files

Removed find.cmake files. Now cmake dependencies are centralized in wolf core

parent b5db7ffd
No related branches found
No related tags found
1 merge request!24After 2nd RAL submission
# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2015 Google Inc. All rights reserved.
# http://ceres-solver.org/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: alexs.mac@gmail.com (Alex Stewart)
#
# FindEigen.cmake - Find Eigen library, version >= 3.
#
# This module defines the following variables:
#
# EIGEN_FOUND: TRUE iff Eigen is found.
# EIGEN_INCLUDE_DIRS: Include directories for Eigen.
# EIGEN_VERSION: Extracted from Eigen/src/Core/util/Macros.h
# EIGEN_WORLD_VERSION: Equal to 3 if EIGEN_VERSION = 3.2.0
# EIGEN_MAJOR_VERSION: Equal to 2 if EIGEN_VERSION = 3.2.0
# EIGEN_MINOR_VERSION: Equal to 0 if EIGEN_VERSION = 3.2.0
# FOUND_INSTALLED_EIGEN_CMAKE_CONFIGURATION: True iff the version of Eigen
# found was built & installed /
# exported as a CMake package.
#
# The following variables control the behaviour of this module:
#
# EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE then
# then prefer using an exported CMake configuration
# generated by Eigen over searching for the
# Eigen components manually. Otherwise (FALSE)
# ignore any exported Eigen CMake configurations and
# always perform a manual search for the components.
# Default: TRUE iff user does not define this variable
# before we are called, and does NOT specify
# EIGEN_INCLUDE_DIR_HINTS, otherwise FALSE.
# EIGEN_INCLUDE_DIR_HINTS: List of additional directories in which to
# search for eigen includes, e.g: /timbuktu/eigen3.
#
# The following variables are also defined by this module, but in line with
# CMake recommended FindPackage() module style should NOT be referenced directly
# by callers (use the plural variables detailed above instead). These variables
# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
# are NOT re-called (i.e. search for library is not repeated) if these variables
# are set with valid values _in the CMake cache_. This means that if these
# variables are set directly in the cache, either by the user in the CMake GUI,
# or by the user passing -DVAR=VALUE directives to CMake when called (which
# explicitly defines a cache variable), then they will be used verbatim,
# bypassing the HINTS variables and other hard-coded search locations.
#
# EIGEN_INCLUDE_DIR: Include directory for CXSparse, not including the
# include directory of any dependencies.
# Called if we failed to find Eigen or any of it's required dependencies,
# unsets all public (designed to be used externally) variables and reports
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
macro(EIGEN_REPORT_NOT_FOUND REASON_MSG)
unset(EIGEN_FOUND)
unset(EIGEN_INCLUDE_DIRS)
unset(FOUND_INSTALLED_EIGEN_CMAKE_CONFIGURATION)
# Make results of search visible in the CMake GUI if Eigen has not
# been found so that user does not have to toggle to advanced view.
mark_as_advanced(CLEAR EIGEN_INCLUDE_DIR)
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
# use the camelcase library name, not uppercase.
if (Eigen_FIND_QUIETLY)
message(STATUS "Failed to find Eigen - " ${REASON_MSG} ${ARGN})
elseif (Eigen_FIND_REQUIRED)
message(FATAL_ERROR "Failed to find Eigen - " ${REASON_MSG} ${ARGN})
else()
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
# but continues configuration and allows generation.
message("-- Failed to find Eigen - " ${REASON_MSG} ${ARGN})
endif ()
return()
endmacro(EIGEN_REPORT_NOT_FOUND)
# Protect against any alternative find_package scripts for this library having
# been called previously (in a client project) which set EIGEN_FOUND, but not
# the other variables we require / set here which could cause the search logic
# here to fail.
unset(EIGEN_FOUND)
# -----------------------------------------------------------------
# By default, if the user has expressed no preference for using an exported
# Eigen CMake configuration over performing a search for the installed
# components, and has not specified any hints for the search locations, then
# prefer an exported configuration if available.
if (NOT DEFINED EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION
AND NOT EIGEN_INCLUDE_DIR_HINTS)
message(STATUS "No preference for use of exported Eigen CMake configuration "
"set, and no hints for include directory provided. "
"Defaulting to preferring an installed/exported Eigen CMake configuration "
"if available.")
set(EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION TRUE)
endif()
if (EIGEN_PREFER_EXPORTED_EIGEN_CMAKE_CONFIGURATION)
# Try to find an exported CMake configuration for Eigen.
#
# We search twice, s/t we can invert the ordering of precedence used by
# find_package() for exported package build directories, and installed
# packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7)
# respectively in [1].
#
# By default, exported build directories are (in theory) detected first, and
# this is usually the case on Windows. However, on OS X & Linux, the install
# path (/usr/local) is typically present in the PATH environment variable
# which is checked in item 4) in [1] (i.e. before both of the above, unless
# NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed
# packages are usually detected in preference to exported package build
# directories.
#
# To ensure a more consistent response across all OSs, and as users usually
# want to prefer an installed version of a package over a locally built one
# where both exist (esp. as the exported build directory might be removed
# after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which
# means any build directories exported by the user are ignored, and thus
# installed directories are preferred. If this fails to find the package
# we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any
# exported build directories will now be detected.
#
# To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which
# is item 5) in [1]), to not preferentially use projects that were built
# recently with the CMake GUI to ensure that we always prefer an installed
# version if available.
#
# [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
find_package(Eigen3 QUIET
NO_MODULE
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_BUILDS_PATH)
if (EIGEN3_FOUND)
message(STATUS "Found installed version of Eigen: ${Eigen3_DIR}")
else()
# Failed to find an installed version of Eigen, repeat search allowing
# exported build directories.
message(STATUS "Failed to find installed Eigen CMake configuration, "
"searching for Eigen build directories exported with CMake.")
# Again pass NO_CMAKE_BUILDS_PATH, as we know that Eigen is exported and
# do not want to treat projects built with the CMake GUI preferentially.
find_package(Eigen3 QUIET
NO_MODULE
NO_CMAKE_BUILDS_PATH)
if (EIGEN3_FOUND)
message(STATUS "Found exported Eigen build directory: ${Eigen3_DIR}")
endif()
endif()
if (EIGEN3_FOUND)
set(FOUND_INSTALLED_EIGEN_CMAKE_CONFIGURATION TRUE)
set(EIGEN_FOUND ${EIGEN3_FOUND})
set(EIGEN_INCLUDE_DIR "${EIGEN3_INCLUDE_DIR}" CACHE STRING
"Eigen include directory" FORCE)
else()
message(STATUS "Failed to find an installed/exported CMake configuration "
"for Eigen, will perform search for installed Eigen components.")
endif()
endif()
if (NOT EIGEN_FOUND)
# Search user-installed locations first, so that we prefer user installs
# to system installs where both exist.
list(APPEND EIGEN_CHECK_INCLUDE_DIRS
/usr/local/include
/usr/local/homebrew/include # Mac OS X
/opt/local/var/macports/software # Mac OS X.
/opt/local/include
/usr/include)
# Additional suffixes to try appending to each search path.
list(APPEND EIGEN_CHECK_PATH_SUFFIXES
eigen3 # Default root directory for Eigen.
Eigen/include/eigen3 # Windows (for C:/Program Files prefix) < 3.3
Eigen3/include/eigen3 ) # Windows (for C:/Program Files prefix) >= 3.3
# Search supplied hint directories first if supplied.
find_path(EIGEN_INCLUDE_DIR
NAMES Eigen/Core
HINTS ${EIGEN_INCLUDE_DIR_HINTS}
PATHS ${EIGEN_CHECK_INCLUDE_DIRS}
PATH_SUFFIXES ${EIGEN_CHECK_PATH_SUFFIXES})
if (NOT EIGEN_INCLUDE_DIR OR
NOT EXISTS ${EIGEN_INCLUDE_DIR})
eigen_report_not_found(
"Could not find eigen3 include directory, set EIGEN_INCLUDE_DIR to "
"path to eigen3 include directory, e.g. /usr/local/include/eigen3.")
endif (NOT EIGEN_INCLUDE_DIR OR
NOT EXISTS ${EIGEN_INCLUDE_DIR})
# Mark internally as found, then verify. EIGEN_REPORT_NOT_FOUND() unsets
# if called.
set(EIGEN_FOUND TRUE)
endif()
# Extract Eigen version from Eigen/src/Core/util/Macros.h
if (EIGEN_INCLUDE_DIR)
set(EIGEN_VERSION_FILE ${EIGEN_INCLUDE_DIR}/Eigen/src/Core/util/Macros.h)
if (NOT EXISTS ${EIGEN_VERSION_FILE})
eigen_report_not_found(
"Could not find file: ${EIGEN_VERSION_FILE} "
"containing version information in Eigen install located at: "
"${EIGEN_INCLUDE_DIR}.")
else (NOT EXISTS ${EIGEN_VERSION_FILE})
file(READ ${EIGEN_VERSION_FILE} EIGEN_VERSION_FILE_CONTENTS)
string(REGEX MATCH "#define EIGEN_WORLD_VERSION [0-9]+"
EIGEN_WORLD_VERSION "${EIGEN_VERSION_FILE_CONTENTS}")
string(REGEX REPLACE "#define EIGEN_WORLD_VERSION ([0-9]+)" "\\1"
EIGEN_WORLD_VERSION "${EIGEN_WORLD_VERSION}")
string(REGEX MATCH "#define EIGEN_MAJOR_VERSION [0-9]+"
EIGEN_MAJOR_VERSION "${EIGEN_VERSION_FILE_CONTENTS}")
string(REGEX REPLACE "#define EIGEN_MAJOR_VERSION ([0-9]+)" "\\1"
EIGEN_MAJOR_VERSION "${EIGEN_MAJOR_VERSION}")
string(REGEX MATCH "#define EIGEN_MINOR_VERSION [0-9]+"
EIGEN_MINOR_VERSION "${EIGEN_VERSION_FILE_CONTENTS}")
string(REGEX REPLACE "#define EIGEN_MINOR_VERSION ([0-9]+)" "\\1"
EIGEN_MINOR_VERSION "${EIGEN_MINOR_VERSION}")
# This is on a single line s/t CMake does not interpret it as a list of
# elements and insert ';' separators which would result in 3.;2.;0 nonsense.
set(EIGEN_VERSION "${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}")
endif (NOT EXISTS ${EIGEN_VERSION_FILE})
endif (EIGEN_INCLUDE_DIR)
# Set standard CMake FindPackage variables if found.
if (EIGEN_FOUND)
set(EIGEN_INCLUDE_DIRS ${EIGEN_INCLUDE_DIR})
endif (EIGEN_FOUND)
# Handle REQUIRED / QUIET optional arguments and version.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Eigen
REQUIRED_VARS EIGEN_INCLUDE_DIRS
VERSION_VAR EIGEN_VERSION)
# Only mark internal variables as advanced if we found Eigen, otherwise
# leave it visible in the standard GUI for the user to set manually.
if (EIGEN_FOUND)
mark_as_advanced(FORCE EIGEN_INCLUDE_DIR
Eigen3_DIR) # Autogenerated by find_package(Eigen3)
endif (EIGEN_FOUND)
\ No newline at end of file
# Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2015 Google Inc. All rights reserved.
# http://ceres-solver.org/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Author: alexs.mac@gmail.com (Alex Stewart)
#
# FindGlog.cmake - Find Google glog logging library.
#
# This module defines the following variables:
#
# GLOG_FOUND: TRUE iff glog is found.
# GLOG_INCLUDE_DIRS: Include directories for glog.
# GLOG_LIBRARIES: Libraries required to link glog.
# FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION: True iff the version of glog found
# was built & installed / exported
# as a CMake package.
#
# The following variables control the behaviour of this module:
#
# GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION: TRUE/FALSE, iff TRUE then
# then prefer using an exported CMake configuration
# generated by glog > 0.3.4 over searching for the
# glog components manually. Otherwise (FALSE)
# ignore any exported glog CMake configurations and
# always perform a manual search for the components.
# Default: TRUE iff user does not define this variable
# before we are called, and does NOT specify either
# GLOG_INCLUDE_DIR_HINTS or GLOG_LIBRARY_DIR_HINTS
# otherwise FALSE.
# GLOG_INCLUDE_DIR_HINTS: List of additional directories in which to
# search for glog includes, e.g: /timbuktu/include.
# GLOG_LIBRARY_DIR_HINTS: List of additional directories in which to
# search for glog libraries, e.g: /timbuktu/lib.
#
# The following variables are also defined by this module, but in line with
# CMake recommended FindPackage() module style should NOT be referenced directly
# by callers (use the plural variables detailed above instead). These variables
# do however affect the behaviour of the module via FIND_[PATH/LIBRARY]() which
# are NOT re-called (i.e. search for library is not repeated) if these variables
# are set with valid values _in the CMake cache_. This means that if these
# variables are set directly in the cache, either by the user in the CMake GUI,
# or by the user passing -DVAR=VALUE directives to CMake when called (which
# explicitly defines a cache variable), then they will be used verbatim,
# bypassing the HINTS variables and other hard-coded search locations.
#
# GLOG_INCLUDE_DIR: Include directory for glog, not including the
# include directory of any dependencies.
# GLOG_LIBRARY: glog library, not including the libraries of any
# dependencies.
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
# FindGlog was invoked.
macro(GLOG_RESET_FIND_LIBRARY_PREFIX)
if (MSVC AND CALLERS_CMAKE_FIND_LIBRARY_PREFIXES)
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
endif()
endmacro(GLOG_RESET_FIND_LIBRARY_PREFIX)
# Called if we failed to find glog or any of it's required dependencies,
# unsets all public (designed to be used externally) variables and reports
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
macro(GLOG_REPORT_NOT_FOUND REASON_MSG)
unset(GLOG_FOUND)
unset(GLOG_INCLUDE_DIRS)
unset(GLOG_LIBRARIES)
# Make results of search visible in the CMake GUI if glog has not
# been found so that user does not have to toggle to advanced view.
mark_as_advanced(CLEAR GLOG_INCLUDE_DIR
GLOG_LIBRARY)
glog_reset_find_library_prefix()
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
# use the camelcase library name, not uppercase.
if (Glog_FIND_QUIETLY)
message(STATUS "Failed to find glog - " ${REASON_MSG} ${ARGN})
elseif (Glog_FIND_REQUIRED)
message(FATAL_ERROR "Failed to find glog - " ${REASON_MSG} ${ARGN})
else()
# Neither QUIETLY nor REQUIRED, use no priority which emits a message
# but continues configuration and allows generation.
message("-- Failed to find glog - " ${REASON_MSG} ${ARGN})
endif ()
return()
endmacro(GLOG_REPORT_NOT_FOUND)
# Protect against any alternative find_package scripts for this library having
# been called previously (in a client project) which set GLOG_FOUND, but not
# the other variables we require / set here which could cause the search logic
# here to fail.
unset(GLOG_FOUND)
# -----------------------------------------------------------------
# By default, if the user has expressed no preference for using an exported
# glog CMake configuration over performing a search for the installed
# components, and has not specified any hints for the search locations, then
# prefer a glog exported configuration if available.
if (NOT DEFINED GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION
AND NOT GLOG_INCLUDE_DIR_HINTS
AND NOT GLOG_LIBRARY_DIR_HINTS)
message(STATUS "No preference for use of exported glog CMake configuration "
"set, and no hints for include/library directories provided. "
"Defaulting to preferring an installed/exported glog CMake configuration "
"if available.")
set(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION TRUE)
endif()
if (GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION)
# Try to find an exported CMake configuration for glog, as generated by
# glog versions > 0.3.4
#
# We search twice, s/t we can invert the ordering of precedence used by
# find_package() for exported package build directories, and installed
# packages (found via CMAKE_SYSTEM_PREFIX_PATH), listed as items 6) and 7)
# respectively in [1].
#
# By default, exported build directories are (in theory) detected first, and
# this is usually the case on Windows. However, on OS X & Linux, the install
# path (/usr/local) is typically present in the PATH environment variable
# which is checked in item 4) in [1] (i.e. before both of the above, unless
# NO_SYSTEM_ENVIRONMENT_PATH is passed). As such on those OSs installed
# packages are usually detected in preference to exported package build
# directories.
#
# To ensure a more consistent response across all OSs, and as users usually
# want to prefer an installed version of a package over a locally built one
# where both exist (esp. as the exported build directory might be removed
# after installation), we first search with NO_CMAKE_PACKAGE_REGISTRY which
# means any build directories exported by the user are ignored, and thus
# installed directories are preferred. If this fails to find the package
# we then research again, but without NO_CMAKE_PACKAGE_REGISTRY, so any
# exported build directories will now be detected.
#
# To prevent confusion on Windows, we also pass NO_CMAKE_BUILDS_PATH (which
# is item 5) in [1]), to not preferentially use projects that were built
# recently with the CMake GUI to ensure that we always prefer an installed
# version if available.
#
# NOTE: We use the NAMES option as glog erroneously uses 'google-glog' as its
# project name when built with CMake, but exports itself as just 'glog'.
# On Linux/OS X this does not break detection as the project name is
# not used as part of the install path for the CMake package files,
# e.g. /usr/local/lib/cmake/glog, where the <glog> suffix is hardcoded
# in glog's CMakeLists. However, on Windows the project name *is*
# part of the install prefix: C:/Program Files/google-glog/[include,lib].
# However, by default CMake checks:
# C:/Program Files/<FIND_PACKAGE_ARGUMENT_NAME='glog'> which does not
# exist and thus detection fails. Thus we use the NAMES to force the
# search to use both google-glog & glog.
#
# [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
find_package(glog QUIET
NAMES google-glog glog
NO_MODULE
NO_CMAKE_PACKAGE_REGISTRY
NO_CMAKE_BUILDS_PATH)
if (glog_FOUND)
message(STATUS "Found installed version of glog: ${glog_DIR}")
else()
# Failed to find an installed version of glog, repeat search allowing
# exported build directories.
message(STATUS "Failed to find installed glog CMake configuration, "
"searching for glog build directories exported with CMake.")
# Again pass NO_CMAKE_BUILDS_PATH, as we know that glog is exported and
# do not want to treat projects built with the CMake GUI preferentially.
find_package(glog QUIET
NAMES google-glog glog
NO_MODULE
NO_CMAKE_BUILDS_PATH)
if (glog_FOUND)
message(STATUS "Found exported glog build directory: ${glog_DIR}")
endif(glog_FOUND)
endif(glog_FOUND)
set(FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION ${glog_FOUND})
if (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION)
message(STATUS "Detected glog version: ${glog_VERSION}")
set(GLOG_FOUND ${glog_FOUND})
# glog wraps the include directories into the exported glog::glog target.
set(GLOG_INCLUDE_DIR "")
set(GLOG_LIBRARY glog::glog)
else (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION)
message(STATUS "Failed to find an installed/exported CMake configuration "
"for glog, will perform search for installed glog components.")
endif (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION)
endif(GLOG_PREFER_EXPORTED_GLOG_CMAKE_CONFIGURATION)
if (NOT GLOG_FOUND)
# Either failed to find an exported glog CMake configuration, or user
# told us not to use one. Perform a manual search for all glog components.
# Handle possible presence of lib prefix for libraries on MSVC, see
# also GLOG_RESET_FIND_LIBRARY_PREFIX().
if (MSVC)
# Preserve the caller's original values for CMAKE_FIND_LIBRARY_PREFIXES
# s/t we can set it back before returning.
set(CALLERS_CMAKE_FIND_LIBRARY_PREFIXES "${CMAKE_FIND_LIBRARY_PREFIXES}")
# The empty string in this list is important, it represents the case when
# the libraries have no prefix (shared libraries / DLLs).
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
endif (MSVC)
# Search user-installed locations first, so that we prefer user installs
# to system installs where both exist.
list(APPEND GLOG_CHECK_INCLUDE_DIRS
/usr/local/include
/usr/local/homebrew/include # Mac OS X
/opt/local/var/macports/software # Mac OS X.
/opt/local/include
/usr/include)
# Windows (for C:/Program Files prefix).
list(APPEND GLOG_CHECK_PATH_SUFFIXES
glog/include
glog/Include
Glog/include
Glog/Include
google-glog/include # CMake installs with project name prefix.
google-glog/Include)
list(APPEND GLOG_CHECK_LIBRARY_DIRS
/usr/local/lib
/usr/local/homebrew/lib # Mac OS X.
/opt/local/lib
/usr/lib)
# Windows (for C:/Program Files prefix).
list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
glog/lib
glog/Lib
Glog/lib
Glog/Lib
google-glog/lib # CMake installs with project name prefix.
google-glog/Lib)
# Search supplied hint directories first if supplied.
find_path(GLOG_INCLUDE_DIR
NAMES glog/logging.h
HINTS ${GLOG_INCLUDE_DIR_HINTS}
PATHS ${GLOG_CHECK_INCLUDE_DIRS}
PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
if (NOT GLOG_INCLUDE_DIR OR
NOT EXISTS ${GLOG_INCLUDE_DIR})
glog_report_not_found(
"Could not find glog include directory, set GLOG_INCLUDE_DIR "
"to directory containing glog/logging.h")
endif (NOT GLOG_INCLUDE_DIR OR
NOT EXISTS ${GLOG_INCLUDE_DIR})
find_library(GLOG_LIBRARY NAMES glog
HINTS ${GLOG_LIBRARY_DIR_HINTS}
PATHS ${GLOG_CHECK_LIBRARY_DIRS}
PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
if (NOT GLOG_LIBRARY OR
NOT EXISTS ${GLOG_LIBRARY})
glog_report_not_found(
"Could not find glog library, set GLOG_LIBRARY "
"to full path to libglog.")
endif (NOT GLOG_LIBRARY OR
NOT EXISTS ${GLOG_LIBRARY})
# Mark internally as found, then verify. GLOG_REPORT_NOT_FOUND() unsets
# if called.
set(GLOG_FOUND TRUE)
# Glog does not seem to provide any record of the version in its
# source tree, thus cannot extract version.
# Catch case when caller has set GLOG_INCLUDE_DIR in the cache / GUI and
# thus FIND_[PATH/LIBRARY] are not called, but specified locations are
# invalid, otherwise we would report the library as found.
if (GLOG_INCLUDE_DIR AND
NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
glog_report_not_found(
"Caller defined GLOG_INCLUDE_DIR:"
" ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.")
endif (GLOG_INCLUDE_DIR AND
NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
# TODO: This regex for glog library is pretty primitive, we use lowercase
# for comparison to handle Windows using CamelCase library names, could
# this check be better?
string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY)
if (GLOG_LIBRARY AND
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
glog_report_not_found(
"Caller defined GLOG_LIBRARY: "
"${GLOG_LIBRARY} does not match glog.")
endif (GLOG_LIBRARY AND
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
glog_reset_find_library_prefix()
endif(NOT GLOG_FOUND)
# Set standard CMake FindPackage variables if found.
if (GLOG_FOUND)
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
endif (GLOG_FOUND)
# If we are using an exported CMake glog target, the include directories are
# wrapped into the target itself, and do not have to be (and are not)
# separately specified. In which case, we should not add GLOG_INCLUDE_DIRS
# to the list of required variables in order that glog be reported as found.
if (FOUND_INSTALLED_GLOG_CMAKE_CONFIGURATION)
set(GLOG_REQUIRED_VARIABLES GLOG_LIBRARIES)
else()
set(GLOG_REQUIRED_VARIABLES GLOG_INCLUDE_DIRS GLOG_LIBRARIES)
endif()
# Handle REQUIRED / QUIET optional arguments.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Glog DEFAULT_MSG
${GLOG_REQUIRED_VARIABLES})
# Only mark internal variables as advanced if we found glog, otherwise
# leave them visible in the standard GUI for the user to set manually.
if (GLOG_FOUND)
mark_as_advanced(FORCE GLOG_INCLUDE_DIR
GLOG_LIBRARY
glog_DIR) # Autogenerated by find_package(glog)
endif (GLOG_FOUND)
# Locate yaml-cpp
#
# This module defines
# YAMLCPP_FOUND, if false, do not try to link to yaml-cpp
# YAMLCPP_LIBNAME, name of yaml library
# YAMLCPP_LIBRARY, where to find yaml-cpp
# YAMLCPP_LIBRARY_RELEASE, where to find Release or RelWithDebInfo yaml-cpp
# YAMLCPP_LIBRARY_DEBUG, where to find Debug yaml-cpp
# YAMLCPP_INCLUDE_DIR, where to find yaml.h
# YAMLCPP_LIBRARY_DIR, the directories to find YAMLCPP_LIBRARY
#
# By default, the dynamic libraries of yaml-cpp will be found. To find the static ones instead,
# you must set the YAMLCPP_USE_STATIC_LIBS variable to TRUE before calling find_package(YamlCpp ...)
# attempt to find static library first if this is set
if(YAMLCPP_USE_STATIC_LIBS)
set(YAMLCPP_STATIC libyaml-cpp.a)
set(YAMLCPP_STATIC_DEBUG libyaml-cpp-dbg.a)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") ### Set Yaml libary name for Windows
set(YAMLCPP_LIBNAME "libyaml-cppmd" CACHE STRING "Name of YAML library")
set(YAMLCPP_LIBNAME optimized ${YAMLCPP_LIBNAME} debug ${YAMLCPP_LIBNAME}d)
else() ### Set Yaml libary name for Unix, Linux, OS X, etc
set(YAMLCPP_LIBNAME "yaml-cpp" CACHE STRING "Name of YAML library")
endif()
# find the yaml-cpp include directory
find_path(YAMLCPP_INCLUDE_DIR
NAMES yaml-cpp/yaml.h
PATH_SUFFIXES include
PATHS
${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp-0.5.1/include
~/Library/Frameworks/yaml-cpp/include/
/Library/Frameworks/yaml-cpp/include/
/usr/local/include/
/usr/include/
/sw/yaml-cpp/ # Fink
/opt/local/yaml-cpp/ # DarwinPorts
/opt/csw/yaml-cpp/ # Blastwave
/opt/yaml-cpp/)
# find the release yaml-cpp library
find_library(YAMLCPP_LIBRARY_RELEASE
NAMES ${YAMLCPP_STATIC} yaml-cpp libyaml-cppmd.lib
PATH_SUFFIXES lib64 lib Release RelWithDebInfo
PATHS
${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp-0.5.1/
${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp-0.5.1/build
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)
# find the debug yaml-cpp library
find_library(YAMLCPP_LIBRARY_DEBUG
NAMES ${YAMLCPP_STATIC_DEBUG} yaml-cpp-dbg libyaml-cppmdd.lib
PATH_SUFFIXES lib64 lib Debug
PATHS
${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp-0.5.1/
${PROJECT_SOURCE_DIR}/dependencies/yaml-cpp-0.5.1/build
~/Library/Frameworks
/Library/Frameworks
/usr/local
/usr
/sw
/opt/local
/opt/csw
/opt)
# set library vars
set(YAMLCPP_LIBRARY ${YAMLCPP_LIBRARY_RELEASE})
if(CMAKE_BUILD_TYPE MATCHES Debug AND EXISTS ${YAMLCPP_LIBRARY_DEBUG})
set(YAMLCPP_LIBRARY ${YAMLCPP_LIBRARY_DEBUG})
endif()
get_filename_component(YAMLCPP_LIBRARY_RELEASE_DIR ${YAMLCPP_LIBRARY_RELEASE} PATH)
get_filename_component(YAMLCPP_LIBRARY_DEBUG_DIR ${YAMLCPP_LIBRARY_DEBUG} PATH)
set(YAMLCPP_LIBRARY_DIR ${YAMLCPP_LIBRARY_RELEASE_DIR} ${YAMLCPP_LIBRARY_DEBUG_DIR})
# handle the QUIETLY and REQUIRED arguments and set YAMLCPP_FOUND to TRUE if all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(YamlCpp DEFAULT_MSG
YAMLCPP_INCLUDE_DIR
YAMLCPP_LIBRARY
YAMLCPP_LIBRARY_DIR)
mark_as_advanced(
YAMLCPP_INCLUDE_DIR
YAMLCPP_LIBRARY_DIR
YAMLCPP_LIBRARY
YAMLCPP_LIBRARY_RELEASE
YAMLCPP_LIBRARY_RELEASE_DIR
YAMLCPP_LIBRARY_DEBUG
YAMLCPP_LIBRARY_DEBUG_DIR)
# This file was copied and adapted from the ceres_solver project
# http://ceres-solver.org/
# wolf - Windowed Localization Frames
# Copyright 2016
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# * Neither the name of Google Inc. nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Authors:
#
# Config file for wolf - Find wolf & dependencies.
#
# This file is used by CMake when find_package(wolf) is invoked and either
# the directory containing this file either is present in CMAKE_MODULE_PATH
# (if wolf was installed), or exists in the local CMake package registry if
# the wolf build directory was exported.
#
# This module defines the following variables:
#
# wolf_FOUND / wolf_FOUND: True if wolf has been successfully
# found. Both variables are set as although
# FindPackage() only references wolf_FOUND
# in Config mode, given the conventions for
# <package>_FOUND when FindPackage() is
# called in Module mode, users could
# reasonably expect to use wolf_FOUND
# instead.
#
# wolf_VERSION: Version of wolf found.
#
# wolf_INCLUDE_DIRS: Include directories for wolf and the
# dependencies which appear in the wolf public
# API and are thus required to use wolf.
#
# wolf_LIBRARIES: Libraries for wolf and all
# dependencies against which wolf was
# compiled. This will not include any optional
# dependencies that were disabled when wolf was
# compiled.
#
# The following variables are also defined for legacy compatibility
# only. Any new code should not use them as they do not conform to
# the standard CMake FindPackage naming conventions.
#
# wolf_INCLUDES = ${wolf_INCLUDE_DIRS}.
# Called if we failed to find Ceres or any of its required dependencies,
# unsets all public (designed to be used externally) variables and reports
# error message at priority depending upon [REQUIRED/QUIET/<NONE>] argument.
macro(wolf_report_not_found REASON_MSG)
# FindPackage() only references Ceres_FOUND, and requires it to be
# explicitly set FALSE to denote not found (not merely undefined).
set(wolf_FOUND FALSE)
set(wolf_FOUND FALSE)
unset(wolf_INCLUDE_DIRS)
unset(wolf_LIBRARIES)
# Reset the CMake module path to its state when this script was called.
set(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH})
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by
# FindPackage() use the camelcase library name, not uppercase.
if (wolf_FIND_QUIETLY)
message(STATUS "Failed to find wolf - " ${REASON_MSG} ${ARGN})
else (wolf_FIND_REQUIRED)
message(FATAL_ERROR "Failed to find wolf - " ${REASON_MSG} ${ARGN})
else()
# Neither QUIETLY nor REQUIRED, use SEND_ERROR which emits an error
# that prevents generation, but continues configuration.
message(SEND_ERROR "Failed to find wolf - " ${REASON_MSG} ${ARGN})
endif ()
return()
endmacro(wolf_report_not_found)
# Record the state of the CMake module path when this script was
# called so that we can ensure that we leave it in the same state on
# exit as it was on entry, but modify it locally.
set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
# Get the (current, i.e. installed) directory containing this file.
get_filename_component(wolf_CURRENT_CONFIG_DIR
"${CMAKE_CURRENT_LIST_FILE}" PATH)
# Reset CMake module path to the installation directory of this
# script, thus we will use the FindPackage() scripts shipped with
# wolf to find wolf' dependencies, even if the user has equivalently
# named FindPackage() scripts in their project.
set(CMAKE_MODULE_PATH ${wolf_CURRENT_CONFIG_DIR})
# Build the absolute root install directory as a relative path
# (determined when wolf was configured & built) from the current
# install directory for this this file. This allows for the install
# tree to be relocated, after wolf was built, outside of CMake.
get_filename_component(CURRENT_ROOT_INSTALL_DIR
${wolf_CURRENT_CONFIG_DIR}/../../../
ABSOLUTE)
if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
wolf_report_not_found(
"wolf install root: ${CURRENT_ROOT_INSTALL_DIR}, "
"determined from relative path from wolfConfig.cmake install location: "
"${wolf_CURRENT_CONFIG_DIR}, does not exist. Either the install "
"directory was deleted, or the install tree was only partially relocated "
"outside of CMake after wolf was built.")
endif (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
# Set the include directories for wolf (itself).
set(wolf_INCLUDE_DIR "${CURRENT_ROOT_INSTALL_DIR}/include/iri-algorithms")
# if (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/wolf.h)
if (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf)
wolf_report_not_found(
"wolf install root: ${CURRENT_ROOT_INSTALL_DIR}, "
"determined from relative path from wolfConfig.cmake install location: "
"${wolf_CURRENT_CONFIG_DIR}, does not contain wolf headers. "
"Either the install directory was deleted, or the install tree was only "
"partially relocated outside of CMake after wolf was built.")
# endif (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf/wolf.h)
endif (NOT EXISTS ${wolf_INCLUDE_DIR}/wolf)
list(APPEND wolf_INCLUDE_DIRS ${wolf_INCLUDE_DIR}/wolf)
# Set the version.
set(wolf_VERSION 0.0.1)
# Eigen.
# Flag set during configuration and build of wolf.
set(wolf_EIGEN_VERSION @EIGEN_VERSION@)
# Append the locations of Eigen when wolf was built to the search path hints.
list(APPEND EIGEN_INCLUDE_DIR_HINTS /usr/include/eigen3)
# Search quietly to control the timing of the error message if not found. The
# search should be for an exact match, but for usability reasons do a soft
# match and reject with an explanation below.
find_package(Eigen3 ${wolf_EIGEN_VERSION} QUIET)
# Flag set with currently found Eigen version.
set(EIGEN_VERSION @EIGEN_VERSION@)
if (EIGEN3_FOUND)
if (NOT EIGEN_VERSION VERSION_EQUAL wolf_EIGEN_VERSION)
# CMake's VERSION check in FIND_PACKAGE() will accept any version >= the
# specified version. However, only version = is supported. Improve
# usability by explaining why we don't accept non-exact version matching.
wolf_report_not_found("Found Eigen dependency, but the version of Eigen "
"found (${EIGEN_VERSION}) does not exactly match the version of Eigen "
"wolf was compiled with (${wolf_EIGEN_VERSION}). This can cause subtle "
"bugs by triggering violations of the One Definition Rule. See the "
"Wikipedia article http://en.wikipedia.org/wiki/One_Definition_Rule "
"for more details")
endif ()
message(STATUS "Found required wolf dependency: "
"Eigen version ${wolf_EIGEN_VERSION} in ${EIGEN3_INCLUDE_DIR}")
else (EIGEN3_FOUND)
wolf_report_not_found("Missing required wolf "
"dependency: Eigen version ${wolf_EIGEN_VERSION}, please set "
"EIGEN3_INCLUDE_DIR.")
endif (EIGEN3_FOUND)
list(APPEND wolf_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
# Import exported wolf targets, if they have not already been imported.
if (NOT TARGET wolf AND NOT wolf_BINARY_DIR)
include(${wolf_CURRENT_CONFIG_DIR}/wolfTargets.cmake)
endif (NOT TARGET wolf AND NOT wolf_BINARY_DIR)
# Set the expected XX_LIBRARIES variable for FindPackage().
set(wolf_LIBRARIES wolf)
# Set legacy library variable for backwards compatibility.
set(wolf_LIBRARY ${wolf_LIBRARIES})
# Make user aware of any compile flags that will be added to their targets
# which use wolf (i.e. flags exported in the wolf target). Only CMake
# versions >= 2.8.12 support target_compile_options().
if (TARGET ${wolf_LIBRARIES} AND
NOT CMAKE_VERSION VERSION_LESS "2.8.12")
get_target_property(wolf_INTERFACE_COMPILE_OPTIONS
${wolf_LIBRARIES} INTERFACE_COMPILE_OPTIONS)
set(wolf_LOCATION "${CURRENT_ROOT_INSTALL_DIR}")
# Check for -std=c++11 flags.
if (wolf_INTERFACE_COMPILE_OPTIONS MATCHES ".*std=c\\+\\+11.*")
message(STATUS "wolf version ${wolf_VERSION} detected here: "
"${wolf_LOCATION} was built with C++11. wolf target will add "
"C++11 flags to compile options for targets using it.")
endif()
endif()
# Reset CMake module path to its state when this script was called.
set(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH})
# As we use wolf_REPORT_NOT_FOUND() to abort, if we reach this point we have
# found wolf and all required dependencies.
message(STATUS "Found wolf version: ${wolf_VERSION} installed in: ${CURRENT_ROOT_INSTALL_DIR}")
# Set wolf_FOUND to be equivalent to wolf_FOUND, which is set to
# TRUE by FindPackage() if this file is found and run, and after which
# wolf_FOUND is not (explicitly, i.e. undefined does not count) set
# to FALSE.
set(wolf_FOUND TRUE)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment