mirror of
https://github.com/ceres-solver/ceres-solver.git
synced 2026-08-29 08:34:37 +08:00
Update all CMake to lowercase function name style.
- Updated to new CMake style where function names are all lowercase, this will be backwards compatible as CMake function names are case insensitive. - Updated using Emacs' M-x unscreamify-cmake-buffer. Change-Id: If7219816f560270e59212813aeb021353a64a0e2
This commit is contained in:
+452
-452
File diff suppressed because it is too large
Load Diff
@@ -30,47 +30,47 @@
|
||||
# alexs.mac@gmail.com (Alex Stewart)
|
||||
|
||||
# Set up the git hook to make Gerrit Change-Id: lines in commit messages.
|
||||
FUNCTION(ADD_GERRIT_COMMIT_HOOK)
|
||||
UNSET (LOCAL_GIT_DIRECTORY)
|
||||
IF (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
IF (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
function(ADD_GERRIT_COMMIT_HOOK)
|
||||
unset (LOCAL_GIT_DIRECTORY)
|
||||
if (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
if (IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
# .git directory can be found on Unix based system, or on Windows with
|
||||
# Git Bash (shipped with msysgit).
|
||||
SET (LOCAL_GIT_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
ELSE(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
set (LOCAL_GIT_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
else(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
|
||||
# .git is a file, this means Ceres is a git submodule of another project
|
||||
# and our .git file contains the path to the git directory which manages
|
||||
# Ceres, so we should add the gerrit hook there.
|
||||
FILE(READ ${CMAKE_SOURCE_DIR}/.git GIT_SUBMODULE_FILE_CONTENTS)
|
||||
file(READ ${CMAKE_SOURCE_DIR}/.git GIT_SUBMODULE_FILE_CONTENTS)
|
||||
# Strip any trailing newline characters, s/t we get a valid path.
|
||||
STRING(REGEX REPLACE "gitdir:[ ]*([^$].*)[\n].*" "${CMAKE_SOURCE_DIR}/\\1"
|
||||
string(REGEX REPLACE "gitdir:[ ]*([^$].*)[\n].*" "${CMAKE_SOURCE_DIR}/\\1"
|
||||
GIT_SUBMODULE_GIT_DIRECTORY_PATH "${GIT_SUBMODULE_FILE_CONTENTS}")
|
||||
GET_FILENAME_COMPONENT(GIT_SUBMODULE_GIT_DIRECTORY_PATH
|
||||
get_filename_component(GIT_SUBMODULE_GIT_DIRECTORY_PATH
|
||||
"${GIT_SUBMODULE_GIT_DIRECTORY_PATH}" ABSOLUTE)
|
||||
IF (EXISTS ${GIT_SUBMODULE_GIT_DIRECTORY_PATH}
|
||||
if (EXISTS ${GIT_SUBMODULE_GIT_DIRECTORY_PATH}
|
||||
AND IS_DIRECTORY ${GIT_SUBMODULE_GIT_DIRECTORY_PATH})
|
||||
SET(LOCAL_GIT_DIRECTORY "${GIT_SUBMODULE_GIT_DIRECTORY_PATH}")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ELSE (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
set(LOCAL_GIT_DIRECTORY "${GIT_SUBMODULE_GIT_DIRECTORY_PATH}")
|
||||
endif()
|
||||
endif()
|
||||
else (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
# TODO(keir) Add proper Windows support.
|
||||
ENDIF (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
endif (EXISTS ${CMAKE_SOURCE_DIR}/.git)
|
||||
|
||||
IF (EXISTS ${LOCAL_GIT_DIRECTORY})
|
||||
IF (NOT EXISTS ${LOCAL_GIT_DIRECTORY}/hooks/commit-msg)
|
||||
MESSAGE(STATUS "Detected Ceres being used as a git submodule, adding "
|
||||
if (EXISTS ${LOCAL_GIT_DIRECTORY})
|
||||
if (NOT EXISTS ${LOCAL_GIT_DIRECTORY}/hooks/commit-msg)
|
||||
message(STATUS "Detected Ceres being used as a git submodule, adding "
|
||||
"commit hook for Gerrit to: ${LOCAL_GIT_DIRECTORY}")
|
||||
# Download the hook only if it is not already present.
|
||||
FILE(DOWNLOAD https://ceres-solver-review.googlesource.com/tools/hooks/commit-msg
|
||||
file(DOWNLOAD https://ceres-solver-review.googlesource.com/tools/hooks/commit-msg
|
||||
${CMAKE_BINARY_DIR}/commit-msg)
|
||||
|
||||
# Make the downloaded file executable, since it is not by default.
|
||||
FILE(COPY ${CMAKE_BINARY_DIR}/commit-msg
|
||||
file(COPY ${CMAKE_BINARY_DIR}/commit-msg
|
||||
DESTINATION ${LOCAL_GIT_DIRECTORY}/hooks/
|
||||
FILE_PERMISSIONS
|
||||
OWNER_READ OWNER_WRITE OWNER_EXECUTE
|
||||
GROUP_READ GROUP_WRITE GROUP_EXECUTE
|
||||
WORLD_READ WORLD_EXECUTE)
|
||||
ENDIF (NOT EXISTS ${LOCAL_GIT_DIRECTORY}/hooks/commit-msg)
|
||||
ENDIF (EXISTS ${LOCAL_GIT_DIRECTORY})
|
||||
ENDFUNCTION()
|
||||
endif (NOT EXISTS ${LOCAL_GIT_DIRECTORY}/hooks/commit-msg)
|
||||
endif (EXISTS ${LOCAL_GIT_DIRECTORY})
|
||||
endfunction()
|
||||
|
||||
+92
-92
@@ -69,213 +69,213 @@
|
||||
# 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(CERES_REPORT_NOT_FOUND REASON_MSG)
|
||||
macro(CERES_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(Ceres_FOUND FALSE)
|
||||
SET(CERES_FOUND FALSE)
|
||||
UNSET(CERES_INCLUDE_DIRS)
|
||||
UNSET(CERES_LIBRARIES)
|
||||
set(Ceres_FOUND FALSE)
|
||||
set(CERES_FOUND FALSE)
|
||||
unset(CERES_INCLUDE_DIRS)
|
||||
unset(CERES_LIBRARIES)
|
||||
|
||||
# Reset the CMake module path to its state when this script was called.
|
||||
SET(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH})
|
||||
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 (Ceres_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Failed to find Ceres - " ${REASON_MSG} ${ARGN})
|
||||
ELSE (Ceres_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Failed to find Ceres - " ${REASON_MSG} ${ARGN})
|
||||
ELSE()
|
||||
if (Ceres_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find Ceres - " ${REASON_MSG} ${ARGN})
|
||||
else (Ceres_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find Ceres - " ${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 Ceres - " ${REASON_MSG} ${ARGN})
|
||||
ENDIF ()
|
||||
RETURN()
|
||||
ENDMACRO(CERES_REPORT_NOT_FOUND)
|
||||
message(SEND_ERROR "Failed to find Ceres - " ${REASON_MSG} ${ARGN})
|
||||
endif ()
|
||||
return()
|
||||
endmacro(CERES_REPORT_NOT_FOUND)
|
||||
|
||||
# If Ceres was not installed, then by definition it was exported
|
||||
# from a build directory.
|
||||
SET(CERES_WAS_INSTALLED @SETUP_CERES_CONFIG_FOR_INSTALLATION@)
|
||||
set(CERES_WAS_INSTALLED @SETUP_CERES_CONFIG_FOR_INSTALLATION@)
|
||||
|
||||
# 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})
|
||||
set(CALLERS_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH})
|
||||
|
||||
# Get the (current, i.e. installed) directory containing this file.
|
||||
GET_FILENAME_COMPONENT(CERES_CURRENT_CONFIG_DIR
|
||||
get_filename_component(CERES_CURRENT_CONFIG_DIR
|
||||
"${CMAKE_CURRENT_LIST_FILE}" PATH)
|
||||
|
||||
IF (CERES_WAS_INSTALLED)
|
||||
if (CERES_WAS_INSTALLED)
|
||||
# Reset CMake module path to the installation directory of this
|
||||
# script, thus we will use the FindPackage() scripts shipped with
|
||||
# Ceres to find Ceres' dependencies, even if the user has equivalently
|
||||
# named FindPackage() scripts in their project.
|
||||
SET(CMAKE_MODULE_PATH ${CERES_CURRENT_CONFIG_DIR})
|
||||
set(CMAKE_MODULE_PATH ${CERES_CURRENT_CONFIG_DIR})
|
||||
|
||||
# Build the absolute root install directory as a relative path
|
||||
# (determined when Ceres was configured & built) from the current
|
||||
# install directory for this this file. This allows for the install
|
||||
# tree to be relocated, after Ceres was built, outside of CMake.
|
||||
GET_FILENAME_COMPONENT(CURRENT_ROOT_INSTALL_DIR
|
||||
get_filename_component(CURRENT_ROOT_INSTALL_DIR
|
||||
${CERES_CURRENT_CONFIG_DIR}/@INSTALL_ROOT_REL_CONFIG_INSTALL_DIR@
|
||||
ABSOLUTE)
|
||||
IF (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
if (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
|
||||
ceres_report_not_found(
|
||||
"Ceres install root: ${CURRENT_ROOT_INSTALL_DIR}, "
|
||||
"determined from relative path from CeresConfig.cmake install location: "
|
||||
"${CERES_CURRENT_CONFIG_DIR}, does not exist. Either the install "
|
||||
"directory was deleted, or the install tree was only partially relocated "
|
||||
"outside of CMake after Ceres was built.")
|
||||
ENDIF (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
|
||||
endif (NOT EXISTS ${CURRENT_ROOT_INSTALL_DIR})
|
||||
|
||||
# Set the include directories for Ceres (itself).
|
||||
SET(CERES_INCLUDE_DIR "${CURRENT_ROOT_INSTALL_DIR}/include")
|
||||
IF (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
set(CERES_INCLUDE_DIR "${CURRENT_ROOT_INSTALL_DIR}/include")
|
||||
if (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
ceres_report_not_found(
|
||||
"Ceres install root: ${CURRENT_ROOT_INSTALL_DIR}, "
|
||||
"determined from relative path from CeresConfig.cmake install location: "
|
||||
"${CERES_CURRENT_CONFIG_DIR}, does not contain Ceres headers. "
|
||||
"Either the install directory was deleted, or the install tree was only "
|
||||
"partially relocated outside of CMake after Ceres was built.")
|
||||
ENDIF (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${CERES_INCLUDE_DIR})
|
||||
endif (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
list(APPEND CERES_INCLUDE_DIRS ${CERES_INCLUDE_DIR})
|
||||
|
||||
ELSE(CERES_WAS_INSTALLED)
|
||||
else(CERES_WAS_INSTALLED)
|
||||
# Ceres was exported from the build tree.
|
||||
SET(CERES_EXPORTED_BUILD_DIR ${CERES_CURRENT_CONFIG_DIR})
|
||||
GET_FILENAME_COMPONENT(CERES_EXPORTED_SOURCE_DIR
|
||||
set(CERES_EXPORTED_BUILD_DIR ${CERES_CURRENT_CONFIG_DIR})
|
||||
get_filename_component(CERES_EXPORTED_SOURCE_DIR
|
||||
${CERES_EXPORTED_BUILD_DIR}/@INSTALL_ROOT_REL_CONFIG_INSTALL_DIR@
|
||||
ABSOLUTE)
|
||||
IF (NOT EXISTS ${CERES_EXPORTED_SOURCE_DIR})
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
if (NOT EXISTS ${CERES_EXPORTED_SOURCE_DIR})
|
||||
ceres_report_not_found(
|
||||
"Ceres exported source directory: ${CERES_EXPORTED_SOURCE_DIR}, "
|
||||
"determined from relative path from CeresConfig.cmake exported build "
|
||||
"directory: ${CERES_EXPORTED_BUILD_DIR} does not exist.")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
# Reset CMake module path to the cmake directory in the Ceres source
|
||||
# tree which was exported, thus we will use the FindPackage() scripts shipped
|
||||
# with Ceres to find Ceres' dependencies, even if the user has equivalently
|
||||
# named FindPackage() scripts in their project.
|
||||
SET(CMAKE_MODULE_PATH ${CERES_EXPORTED_SOURCE_DIR}/cmake)
|
||||
set(CMAKE_MODULE_PATH ${CERES_EXPORTED_SOURCE_DIR}/cmake)
|
||||
|
||||
# Set the include directories for Ceres (itself).
|
||||
SET(CERES_INCLUDE_DIR "${CERES_EXPORTED_SOURCE_DIR}/include")
|
||||
IF (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
set(CERES_INCLUDE_DIR "${CERES_EXPORTED_SOURCE_DIR}/include")
|
||||
if (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
ceres_report_not_found(
|
||||
"Ceres exported source directory: ${CERES_EXPORTED_SOURCE_DIR}, "
|
||||
"determined from relative path from CeresConfig.cmake exported build "
|
||||
"directory: ${CERES_EXPORTED_BUILD_DIR}, does not contain Ceres headers.")
|
||||
ENDIF (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${CERES_INCLUDE_DIR})
|
||||
endif (NOT EXISTS ${CERES_INCLUDE_DIR}/ceres/ceres.h)
|
||||
list(APPEND CERES_INCLUDE_DIRS ${CERES_INCLUDE_DIR})
|
||||
|
||||
# Append the path to the configured config.h in the exported build directory
|
||||
# to the Ceres include directories.
|
||||
SET(CERES_CONFIG_FILE
|
||||
set(CERES_CONFIG_FILE
|
||||
${CERES_EXPORTED_BUILD_DIR}/config/ceres/internal/config.h)
|
||||
IF (NOT EXISTS ${CERES_CONFIG_FILE})
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
if (NOT EXISTS ${CERES_CONFIG_FILE})
|
||||
ceres_report_not_found(
|
||||
"Ceres exported build directory: ${CERES_EXPORTED_BUILD_DIR}, "
|
||||
"does not contain required configured Ceres config.h, it is not here: "
|
||||
"${CERES_CONFIG_FILE}.")
|
||||
ENDIF (NOT EXISTS ${CERES_CONFIG_FILE})
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${CERES_EXPORTED_BUILD_DIR}/config)
|
||||
ENDIF(CERES_WAS_INSTALLED)
|
||||
endif (NOT EXISTS ${CERES_CONFIG_FILE})
|
||||
list(APPEND CERES_INCLUDE_DIRS ${CERES_EXPORTED_BUILD_DIR}/config)
|
||||
endif(CERES_WAS_INSTALLED)
|
||||
|
||||
# Set the version.
|
||||
SET(CERES_VERSION @CERES_VERSION@ )
|
||||
set(CERES_VERSION @CERES_VERSION@ )
|
||||
|
||||
# Eigen.
|
||||
# Flag set during configuration and build of Ceres.
|
||||
SET(CERES_EIGEN_VERSION @EIGEN_VERSION@)
|
||||
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@)
|
||||
list(APPEND EIGEN_INCLUDE_DIR_HINTS @EIGEN_INCLUDE_DIR@)
|
||||
# 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(Eigen ${CERES_EIGEN_VERSION} QUIET)
|
||||
IF (EIGEN_FOUND)
|
||||
IF (NOT EIGEN_VERSION VERSION_EQUAL CERES_EIGEN_VERSION)
|
||||
find_package(Eigen ${CERES_EIGEN_VERSION} QUIET)
|
||||
if (EIGEN_FOUND)
|
||||
if (NOT EIGEN_VERSION VERSION_EQUAL CERES_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.
|
||||
CERES_REPORT_NOT_FOUND("Found Eigen dependency, but the version of Eigen "
|
||||
ceres_report_not_found("Found Eigen dependency, but the version of Eigen "
|
||||
"found (${EIGEN_VERSION}) does not exactly match the version of Eigen "
|
||||
"Ceres was compiled with (${CERES_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 Ceres dependency: "
|
||||
endif ()
|
||||
message(STATUS "Found required Ceres dependency: "
|
||||
"Eigen version ${CERES_EIGEN_VERSION} in ${EIGEN_INCLUDE_DIRS}")
|
||||
ELSE (EIGEN_FOUND)
|
||||
CERES_REPORT_NOT_FOUND("Missing required Ceres "
|
||||
else (EIGEN_FOUND)
|
||||
ceres_report_not_found("Missing required Ceres "
|
||||
"dependency: Eigen version ${CERES_EIGEN_VERSION}, please set "
|
||||
"EIGEN_INCLUDE_DIR.")
|
||||
ENDIF (EIGEN_FOUND)
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
|
||||
endif (EIGEN_FOUND)
|
||||
list(APPEND CERES_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS})
|
||||
|
||||
# Glog.
|
||||
# Flag set during configuration and build of Ceres.
|
||||
SET(CERES_USES_MINIGLOG @MINIGLOG@)
|
||||
IF (CERES_USES_MINIGLOG)
|
||||
SET(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog)
|
||||
IF (NOT EXISTS ${MINIGLOG_INCLUDE_DIR})
|
||||
CERES_REPORT_NOT_FOUND(
|
||||
set(CERES_USES_MINIGLOG @MINIGLOG@)
|
||||
if (CERES_USES_MINIGLOG)
|
||||
set(MINIGLOG_INCLUDE_DIR ${CERES_INCLUDE_DIR}/ceres/internal/miniglog)
|
||||
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).")
|
||||
ENDIF (NOT EXISTS ${MINIGLOG_INCLUDE_DIR})
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${MINIGLOG_INCLUDE_DIR})
|
||||
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
|
||||
# the message is output in GUI during configuration to warn user.
|
||||
MESSAGE("-- Found Ceres compiled with miniglog substitute "
|
||||
message("-- Found Ceres compiled with miniglog substitute "
|
||||
"for glog, beware this will likely cause problems if glog is later linked.")
|
||||
ELSE (CERES_USES_MINIGLOG)
|
||||
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})
|
||||
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)
|
||||
MESSAGE(STATUS "Found required Ceres dependency: "
|
||||
find_package(Glog QUIET)
|
||||
if (GLOG_FOUND)
|
||||
message(STATUS "Found required Ceres dependency: "
|
||||
"Glog in ${GLOG_INCLUDE_DIRS}")
|
||||
ELSE (GLOG_FOUND)
|
||||
CERES_REPORT_NOT_FOUND("Missing required Ceres "
|
||||
else (GLOG_FOUND)
|
||||
ceres_report_not_found("Missing required Ceres "
|
||||
"dependency: Glog, please set GLOG_INCLUDE_DIR.")
|
||||
ENDIF (GLOG_FOUND)
|
||||
LIST(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS})
|
||||
ENDIF (CERES_USES_MINIGLOG)
|
||||
endif (GLOG_FOUND)
|
||||
list(APPEND CERES_INCLUDE_DIRS ${GLOG_INCLUDE_DIRS})
|
||||
endif (CERES_USES_MINIGLOG)
|
||||
|
||||
# Import exported Ceres targets, if they have not already been imported.
|
||||
IF (NOT TARGET ceres AND NOT Ceres_BINARY_DIR)
|
||||
INCLUDE(${CERES_CURRENT_CONFIG_DIR}/CeresTargets.cmake)
|
||||
ENDIF (NOT TARGET ceres AND NOT Ceres_BINARY_DIR)
|
||||
if (NOT TARGET ceres AND NOT Ceres_BINARY_DIR)
|
||||
include(${CERES_CURRENT_CONFIG_DIR}/CeresTargets.cmake)
|
||||
endif (NOT TARGET ceres AND NOT Ceres_BINARY_DIR)
|
||||
# Set the expected XX_LIBRARIES variable for FindPackage().
|
||||
SET(CERES_LIBRARIES ceres)
|
||||
set(CERES_LIBRARIES ceres)
|
||||
|
||||
# Set legacy include directories variable for backwards compatibility.
|
||||
SET(CERES_INCLUDES ${CERES_INCLUDE_DIRS})
|
||||
set(CERES_INCLUDES ${CERES_INCLUDE_DIRS})
|
||||
|
||||
# Reset CMake module path to its state when this script was called.
|
||||
SET(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH ${CALLERS_CMAKE_MODULE_PATH})
|
||||
|
||||
# As we use CERES_REPORT_NOT_FOUND() to abort, if we reach this point we have
|
||||
# found Ceres and all required dependencies.
|
||||
IF (CERES_WAS_INSTALLED)
|
||||
MESSAGE(STATUS "Found Ceres version: ${CERES_VERSION} "
|
||||
if (CERES_WAS_INSTALLED)
|
||||
message(STATUS "Found Ceres version: ${CERES_VERSION} "
|
||||
"installed in: ${CURRENT_ROOT_INSTALL_DIR}")
|
||||
ELSE (CERES_WAS_INSTALLED)
|
||||
MESSAGE(STATUS "Found Ceres version: ${CERES_VERSION} "
|
||||
else (CERES_WAS_INSTALLED)
|
||||
message(STATUS "Found Ceres version: ${CERES_VERSION} "
|
||||
"exported from build directory: ${CERES_EXPORTED_BUILD_DIR}")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
# Set CERES_FOUND to be equivalent to Ceres_FOUND, which is set to
|
||||
# TRUE by FindPackage() if this file is found and run, and after which
|
||||
# Ceres_FOUND is not (explicitly, i.e. undefined does not count) set
|
||||
# to FALSE.
|
||||
SET(CERES_FOUND TRUE)
|
||||
set(CERES_FOUND TRUE)
|
||||
|
||||
@@ -38,13 +38,13 @@
|
||||
# version string are exactly the same and it sets PACKAGE_VERSION_COMPATIBLE
|
||||
# if the current version is >= requested version.
|
||||
|
||||
SET(PACKAGE_VERSION @CERES_VERSION@)
|
||||
set(PACKAGE_VERSION @CERES_VERSION@)
|
||||
|
||||
IF ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
SET(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
ELSE ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
SET(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
IF ("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
SET(PACKAGE_VERSION_EXACT TRUE)
|
||||
ENDIF ("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
ENDIF ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
if ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE FALSE)
|
||||
else ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
set(PACKAGE_VERSION_COMPATIBLE TRUE)
|
||||
if ("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
set(PACKAGE_VERSION_EXACT TRUE)
|
||||
endif ("${PACKAGE_FIND_VERSION}" STREQUAL "${PACKAGE_VERSION}")
|
||||
endif ("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
# we can determine where *this* file is, and thus the relative path to
|
||||
# config.h.in. Inside of CONFIGURE_CERES_CONFIG(), CMAKE_CURRENT_LIST_DIR
|
||||
# refers to the caller of CONFIGURE_CERES_CONFIG(), not this file.
|
||||
SET(CERES_CONFIG_IN_FILE "${CMAKE_CURRENT_LIST_DIR}/config.h.in")
|
||||
set(CERES_CONFIG_IN_FILE "${CMAKE_CURRENT_LIST_DIR}/config.h.in")
|
||||
|
||||
# CreateCeresConfig.cmake - Create the config.h for Ceres.
|
||||
#
|
||||
@@ -55,61 +55,61 @@ SET(CERES_CONFIG_IN_FILE "${CMAKE_CURRENT_LIST_DIR}/config.h.in")
|
||||
# the configured config.h. Typically this
|
||||
# will be <src>/include/ceres/internal.
|
||||
|
||||
FUNCTION(CREATE_CERES_CONFIG CURRENT_CERES_COMPILE_OPTIONS CERES_CONFIG_OUTPUT_DIRECTORY)
|
||||
function(CREATE_CERES_CONFIG CURRENT_CERES_COMPILE_OPTIONS CERES_CONFIG_OUTPUT_DIRECTORY)
|
||||
# Create the specified output directory if it does not exist.
|
||||
IF (NOT EXISTS "${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
MESSAGE(STATUS "Creating configured Ceres config.h output directory: "
|
||||
if (NOT EXISTS "${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
message(STATUS "Creating configured Ceres config.h output directory: "
|
||||
"${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
FILE(MAKE_DIRECTORY "${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
ENDIF()
|
||||
IF (EXISTS "${CERES_CONFIG_OUTPUT_DIRECTORY}" AND
|
||||
file(MAKE_DIRECTORY "${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
endif()
|
||||
if (EXISTS "${CERES_CONFIG_OUTPUT_DIRECTORY}" AND
|
||||
NOT IS_DIRECTORY "${CERES_CONFIG_OUTPUT_DIRECTORY}")
|
||||
MESSAGE(FATAL_ERROR "Ceres Bug: Specified CERES_CONFIG_OUTPUT_DIRECTORY: "
|
||||
message(FATAL_ERROR "Ceres Bug: Specified CERES_CONFIG_OUTPUT_DIRECTORY: "
|
||||
"${CERES_CONFIG_OUTPUT_DIRECTORY} exists, but is not a directory.")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
# Read all possible configurable compile options from config.h.in, this avoids
|
||||
# us having to hard-code in this file what the valid options are.
|
||||
FILE(READ ${CERES_CONFIG_IN_FILE} CERES_CONFIG_IN_CONTENTS)
|
||||
STRING(REGEX MATCHALL "@[^@ $]+@"
|
||||
file(READ ${CERES_CONFIG_IN_FILE} CERES_CONFIG_IN_CONTENTS)
|
||||
string(REGEX MATCHALL "@[^@ $]+@"
|
||||
ALL_CONFIGURABLE_CERES_OPTIONS "${CERES_CONFIG_IN_CONTENTS}")
|
||||
# Removing @ symbols at beginning and end of each option.
|
||||
STRING(REPLACE "@" ""
|
||||
string(REPLACE "@" ""
|
||||
ALL_CONFIGURABLE_CERES_OPTIONS "${ALL_CONFIGURABLE_CERES_OPTIONS}")
|
||||
|
||||
# Ensure that there are no repetitions in the current compile options.
|
||||
LIST(REMOVE_DUPLICATES CURRENT_CERES_COMPILE_OPTIONS)
|
||||
list(REMOVE_DUPLICATES CURRENT_CERES_COMPILE_OPTIONS)
|
||||
|
||||
FOREACH (CERES_OPTION ${ALL_CONFIGURABLE_CERES_OPTIONS})
|
||||
foreach (CERES_OPTION ${ALL_CONFIGURABLE_CERES_OPTIONS})
|
||||
# Try and find the option in the list of current compile options, if it
|
||||
# is present, then the option is enabled, otherwise it is disabled.
|
||||
LIST(FIND CURRENT_CERES_COMPILE_OPTIONS ${CERES_OPTION} OPTION_ENABLED)
|
||||
list(FIND CURRENT_CERES_COMPILE_OPTIONS ${CERES_OPTION} OPTION_ENABLED)
|
||||
|
||||
# list(FIND ..) returns -1 if the element was not in the list, but CMake
|
||||
# interprets if (VAR) to be true if VAR is any non-zero number, even
|
||||
# negative ones, hence we have to explicitly check for >= 0.
|
||||
IF (OPTION_ENABLED GREATER -1)
|
||||
MESSAGE(STATUS "Enabling ${CERES_OPTION} in Ceres config.h")
|
||||
SET(${CERES_OPTION} "#define ${CERES_OPTION}")
|
||||
if (OPTION_ENABLED GREATER -1)
|
||||
message(STATUS "Enabling ${CERES_OPTION} in Ceres config.h")
|
||||
set(${CERES_OPTION} "#define ${CERES_OPTION}")
|
||||
|
||||
# Remove the item from the list of current options so that we can identify
|
||||
# any options that were in CURRENT_CERES_COMPILE_OPTIONS, but not in
|
||||
# ALL_CONFIGURABLE_CERES_OPTIONS (which is an error).
|
||||
LIST(REMOVE_ITEM CURRENT_CERES_COMPILE_OPTIONS ${CERES_OPTION})
|
||||
ELSE()
|
||||
SET(${CERES_OPTION} "// #define ${CERES_OPTION}")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
list(REMOVE_ITEM CURRENT_CERES_COMPILE_OPTIONS ${CERES_OPTION})
|
||||
else()
|
||||
set(${CERES_OPTION} "// #define ${CERES_OPTION}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# CURRENT_CERES_COMPILE_OPTIONS should now be an empty list, any elements
|
||||
# remaining were not present in ALL_CONFIGURABLE_CERES_OPTIONS read from
|
||||
# config.h.in.
|
||||
IF (CURRENT_CERES_COMPILE_OPTIONS)
|
||||
MESSAGE(FATAL_ERROR "Ceres Bug: CURRENT_CERES_COMPILE_OPTIONS contained "
|
||||
if (CURRENT_CERES_COMPILE_OPTIONS)
|
||||
message(FATAL_ERROR "Ceres Bug: CURRENT_CERES_COMPILE_OPTIONS contained "
|
||||
"the following options which were not present in config.h.in: "
|
||||
"${CURRENT_CERES_COMPILE_OPTIONS}")
|
||||
ENDIF()
|
||||
endif()
|
||||
|
||||
CONFIGURE_FILE(${CERES_CONFIG_IN_FILE}
|
||||
configure_file(${CERES_CONFIG_IN_FILE}
|
||||
"${CERES_CONFIG_OUTPUT_DIRECTORY}/config.h" @ONLY)
|
||||
ENDFUNCTION()
|
||||
endfunction()
|
||||
|
||||
+63
-63
@@ -69,125 +69,125 @@
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
|
||||
# FindCXSparse was invoked.
|
||||
MACRO(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
IF (MSVC)
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
ENDIF (MSVC)
|
||||
ENDMACRO(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
macro(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
if (MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
endmacro(CXSPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
|
||||
# Called if we failed to find CXSparse 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(CXSPARSE_REPORT_NOT_FOUND REASON_MSG)
|
||||
UNSET(CXSPARSE_FOUND)
|
||||
UNSET(CXSPARSE_INCLUDE_DIRS)
|
||||
UNSET(CXSPARSE_LIBRARIES)
|
||||
macro(CXSPARSE_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(CXSPARSE_FOUND)
|
||||
unset(CXSPARSE_INCLUDE_DIRS)
|
||||
unset(CXSPARSE_LIBRARIES)
|
||||
# Make results of search visible in the CMake GUI if CXSparse has not
|
||||
# been found so that user does not have to toggle to advanced view.
|
||||
MARK_AS_ADVANCED(CLEAR CXSPARSE_INCLUDE_DIR
|
||||
mark_as_advanced(CLEAR CXSPARSE_INCLUDE_DIR
|
||||
CXSPARSE_LIBRARY)
|
||||
|
||||
CXSPARSE_RESET_FIND_LIBRARY_PREFIX()
|
||||
cxsparse_reset_find_library_prefix()
|
||||
|
||||
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
|
||||
# use the camelcase library name, not uppercase.
|
||||
IF (CXSparse_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
|
||||
ELSEIF (CXSparse_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
|
||||
ELSE()
|
||||
if (CXSparse_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
|
||||
elseif (CXSparse_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find CXSparse - " ${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 CXSparse - " ${REASON_MSG} ${ARGN})
|
||||
ENDIF ()
|
||||
ENDMACRO(CXSPARSE_REPORT_NOT_FOUND)
|
||||
message("-- Failed to find CXSparse - " ${REASON_MSG} ${ARGN})
|
||||
endif ()
|
||||
endmacro(CXSPARSE_REPORT_NOT_FOUND)
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also CXSPARSE_RESET_FIND_LIBRARY_PREFIX().
|
||||
IF (MSVC)
|
||||
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}")
|
||||
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)
|
||||
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.
|
||||
#
|
||||
# TODO: Add standard Windows search locations for CXSparse.
|
||||
LIST(APPEND CXSPARSE_CHECK_INCLUDE_DIRS
|
||||
list(APPEND CXSPARSE_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)
|
||||
LIST(APPEND CXSPARSE_CHECK_LIBRARY_DIRS
|
||||
list(APPEND CXSPARSE_CHECK_LIBRARY_DIRS
|
||||
/usr/local/lib
|
||||
/usr/local/homebrew/lib # Mac OS X.
|
||||
/opt/local/lib
|
||||
/usr/lib)
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
FIND_PATH(CXSPARSE_INCLUDE_DIR
|
||||
find_path(CXSPARSE_INCLUDE_DIR
|
||||
NAMES cs.h
|
||||
PATHS ${CXSPARSE_INCLUDE_DIR_HINTS}
|
||||
${CXSPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (NOT CXSPARSE_INCLUDE_DIR OR
|
||||
if (NOT CXSPARSE_INCLUDE_DIR OR
|
||||
NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
|
||||
CXSPARSE_REPORT_NOT_FOUND(
|
||||
cxsparse_report_not_found(
|
||||
"Could not find CXSparse include directory, set CXSPARSE_INCLUDE_DIR "
|
||||
"to directory containing cs.h")
|
||||
ENDIF (NOT CXSPARSE_INCLUDE_DIR OR
|
||||
endif (NOT CXSPARSE_INCLUDE_DIR OR
|
||||
NOT EXISTS ${CXSPARSE_INCLUDE_DIR})
|
||||
|
||||
FIND_LIBRARY(CXSPARSE_LIBRARY NAMES cxsparse
|
||||
find_library(CXSPARSE_LIBRARY NAMES cxsparse
|
||||
PATHS ${CXSPARSE_LIBRARY_DIR_HINTS}
|
||||
${CXSPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (NOT CXSPARSE_LIBRARY OR
|
||||
if (NOT CXSPARSE_LIBRARY OR
|
||||
NOT EXISTS ${CXSPARSE_LIBRARY})
|
||||
CXSPARSE_REPORT_NOT_FOUND(
|
||||
cxsparse_report_not_found(
|
||||
"Could not find CXSparse library, set CXSPARSE_LIBRARY "
|
||||
"to full path to libcxsparse.")
|
||||
ENDIF (NOT CXSPARSE_LIBRARY OR
|
||||
endif (NOT CXSPARSE_LIBRARY OR
|
||||
NOT EXISTS ${CXSPARSE_LIBRARY})
|
||||
|
||||
# Mark internally as found, then verify. CXSPARSE_REPORT_NOT_FOUND() unsets
|
||||
# if called.
|
||||
SET(CXSPARSE_FOUND TRUE)
|
||||
set(CXSPARSE_FOUND TRUE)
|
||||
|
||||
# Extract CXSparse version from cs.h
|
||||
IF (CXSPARSE_INCLUDE_DIR)
|
||||
SET(CXSPARSE_VERSION_FILE ${CXSPARSE_INCLUDE_DIR}/cs.h)
|
||||
IF (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
CXSPARSE_REPORT_NOT_FOUND(
|
||||
if (CXSPARSE_INCLUDE_DIR)
|
||||
set(CXSPARSE_VERSION_FILE ${CXSPARSE_INCLUDE_DIR}/cs.h)
|
||||
if (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
cxsparse_report_not_found(
|
||||
"Could not find file: ${CXSPARSE_VERSION_FILE} "
|
||||
"containing version information in CXSparse install located at: "
|
||||
"${CXSPARSE_INCLUDE_DIR}.")
|
||||
ELSE (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
FILE(READ ${CXSPARSE_INCLUDE_DIR}/cs.h CXSPARSE_VERSION_FILE_CONTENTS)
|
||||
else (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
file(READ ${CXSPARSE_INCLUDE_DIR}/cs.h CXSPARSE_VERSION_FILE_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define CS_VER [0-9]+"
|
||||
string(REGEX MATCH "#define CS_VER [0-9]+"
|
||||
CXSPARSE_MAIN_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define CS_VER ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define CS_VER ([0-9]+)" "\\1"
|
||||
CXSPARSE_MAIN_VERSION "${CXSPARSE_MAIN_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define CS_SUBVER [0-9]+"
|
||||
string(REGEX MATCH "#define CS_SUBVER [0-9]+"
|
||||
CXSPARSE_SUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define CS_SUBVER ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define CS_SUBVER ([0-9]+)" "\\1"
|
||||
CXSPARSE_SUB_VERSION "${CXSPARSE_SUB_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define CS_SUBSUB [0-9]+"
|
||||
string(REGEX MATCH "#define CS_SUBSUB [0-9]+"
|
||||
CXSPARSE_SUBSUB_VERSION "${CXSPARSE_VERSION_FILE_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define CS_SUBSUB ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define CS_SUBSUB ([0-9]+)" "\\1"
|
||||
CXSPARSE_SUBSUB_VERSION "${CXSPARSE_SUBSUB_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.;1.;2 nonsense.
|
||||
SET(CXSPARSE_VERSION "${CXSPARSE_MAIN_VERSION}.${CXSPARSE_SUB_VERSION}.${CXSPARSE_SUBSUB_VERSION}")
|
||||
ENDIF (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
ENDIF (CXSPARSE_INCLUDE_DIR)
|
||||
set(CXSPARSE_VERSION "${CXSPARSE_MAIN_VERSION}.${CXSPARSE_SUB_VERSION}.${CXSPARSE_SUBSUB_VERSION}")
|
||||
endif (NOT EXISTS ${CXSPARSE_VERSION_FILE})
|
||||
endif (CXSPARSE_INCLUDE_DIR)
|
||||
|
||||
# Catch the case when the caller has set CXSPARSE_LIBRARY in the cache / GUI and
|
||||
# thus FIND_LIBRARY was not called, but specified library is invalid, otherwise
|
||||
@@ -195,34 +195,34 @@ ENDIF (CXSPARSE_INCLUDE_DIR)
|
||||
# TODO: This regex for CXSparse library is pretty primitive, we use lowercase
|
||||
# for comparison to handle Windows using CamelCase library names, could
|
||||
# this check be better?
|
||||
STRING(TOLOWER "${CXSPARSE_LIBRARY}" LOWERCASE_CXSPARSE_LIBRARY)
|
||||
IF (CXSPARSE_LIBRARY AND
|
||||
string(TOLOWER "${CXSPARSE_LIBRARY}" LOWERCASE_CXSPARSE_LIBRARY)
|
||||
if (CXSPARSE_LIBRARY AND
|
||||
EXISTS ${CXSPARSE_LIBRARY} AND
|
||||
NOT "${LOWERCASE_CXSPARSE_LIBRARY}" MATCHES ".*cxsparse[^/]*")
|
||||
CXSPARSE_REPORT_NOT_FOUND(
|
||||
cxsparse_report_not_found(
|
||||
"Caller defined CXSPARSE_LIBRARY: "
|
||||
"${CXSPARSE_LIBRARY} does not match CXSparse.")
|
||||
ENDIF (CXSPARSE_LIBRARY AND
|
||||
endif (CXSPARSE_LIBRARY AND
|
||||
EXISTS ${CXSPARSE_LIBRARY} AND
|
||||
NOT "${LOWERCASE_CXSPARSE_LIBRARY}" MATCHES ".*cxsparse[^/]*")
|
||||
|
||||
# Set standard CMake FindPackage variables if found.
|
||||
IF (CXSPARSE_FOUND)
|
||||
SET(CXSPARSE_INCLUDE_DIRS ${CXSPARSE_INCLUDE_DIR})
|
||||
SET(CXSPARSE_LIBRARIES ${CXSPARSE_LIBRARY})
|
||||
ENDIF (CXSPARSE_FOUND)
|
||||
if (CXSPARSE_FOUND)
|
||||
set(CXSPARSE_INCLUDE_DIRS ${CXSPARSE_INCLUDE_DIR})
|
||||
set(CXSPARSE_LIBRARIES ${CXSPARSE_LIBRARY})
|
||||
endif (CXSPARSE_FOUND)
|
||||
|
||||
CXSPARSE_RESET_FIND_LIBRARY_PREFIX()
|
||||
cxsparse_reset_find_library_prefix()
|
||||
|
||||
# Handle REQUIRED / QUIET optional arguments and version.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CXSparse
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(CXSparse
|
||||
REQUIRED_VARS CXSPARSE_INCLUDE_DIRS CXSPARSE_LIBRARIES
|
||||
VERSION_VAR CXSPARSE_VERSION)
|
||||
|
||||
# Only mark internal variables as advanced if we found CXSparse, otherwise
|
||||
# leave them visible in the standard GUI for the user to set manually.
|
||||
IF (CXSPARSE_FOUND)
|
||||
MARK_AS_ADVANCED(FORCE CXSPARSE_INCLUDE_DIR
|
||||
if (CXSPARSE_FOUND)
|
||||
mark_as_advanced(FORCE CXSPARSE_INCLUDE_DIR
|
||||
CXSPARSE_LIBRARY)
|
||||
ENDIF (CXSPARSE_FOUND)
|
||||
endif (CXSPARSE_FOUND)
|
||||
|
||||
+42
-42
@@ -63,104 +63,104 @@
|
||||
# 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)
|
||||
macro(EIGEN_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(EIGEN_FOUND)
|
||||
unset(EIGEN_INCLUDE_DIRS)
|
||||
# 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)
|
||||
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()
|
||||
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 ()
|
||||
ENDMACRO(EIGEN_REPORT_NOT_FOUND)
|
||||
message("-- Failed to find Eigen - " ${REASON_MSG} ${ARGN})
|
||||
endif ()
|
||||
endmacro(EIGEN_REPORT_NOT_FOUND)
|
||||
|
||||
# Search user-installed locations first, so that we prefer user installs
|
||||
# to system installs where both exist.
|
||||
#
|
||||
# TODO: Add standard Windows search locations for Eigen.
|
||||
LIST(APPEND EIGEN_CHECK_INCLUDE_DIRS
|
||||
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
|
||||
list(APPEND EIGEN_CHECK_PATH_SUFFIXES
|
||||
eigen3 # Default root directory for Eigen.
|
||||
Eigen/include/eigen3 ) # Windows (for C:/Program Files prefix).
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
FIND_PATH(EIGEN_INCLUDE_DIR
|
||||
find_path(EIGEN_INCLUDE_DIR
|
||||
NAMES Eigen/Core
|
||||
PATHS ${EIGEN_INCLUDE_DIR_HINTS}
|
||||
${EIGEN_CHECK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ${EIGEN_CHECK_PATH_SUFFIXES})
|
||||
|
||||
IF (NOT EIGEN_INCLUDE_DIR OR
|
||||
if (NOT EIGEN_INCLUDE_DIR OR
|
||||
NOT EXISTS ${EIGEN_INCLUDE_DIR})
|
||||
EIGEN_REPORT_NOT_FOUND(
|
||||
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
|
||||
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)
|
||||
set(EIGEN_FOUND TRUE)
|
||||
|
||||
# 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(
|
||||
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)
|
||||
else (NOT EXISTS ${EIGEN_VERSION_FILE})
|
||||
file(READ ${EIGEN_VERSION_FILE} EIGEN_VERSION_FILE_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define EIGEN_WORLD_VERSION [0-9]+"
|
||||
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"
|
||||
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]+"
|
||||
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"
|
||||
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]+"
|
||||
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"
|
||||
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(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)
|
||||
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
|
||||
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)
|
||||
ENDIF (EIGEN_FOUND)
|
||||
if (EIGEN_FOUND)
|
||||
mark_as_advanced(FORCE EIGEN_INCLUDE_DIR)
|
||||
endif (EIGEN_FOUND)
|
||||
|
||||
+181
-181
@@ -84,54 +84,54 @@
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when FindGflags was
|
||||
# invoked, necessary for MSVC.
|
||||
MACRO(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
IF (MSVC)
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
ENDIF (MSVC)
|
||||
ENDMACRO(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
macro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
if (MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
endmacro(GFLAGS_RESET_FIND_LIBRARY_PREFIX)
|
||||
|
||||
# Called if we failed to find gflags 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(GFLAGS_REPORT_NOT_FOUND REASON_MSG)
|
||||
UNSET(GFLAGS_FOUND)
|
||||
UNSET(GFLAGS_INCLUDE_DIRS)
|
||||
UNSET(GFLAGS_LIBRARIES)
|
||||
macro(GFLAGS_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(GFLAGS_FOUND)
|
||||
unset(GFLAGS_INCLUDE_DIRS)
|
||||
unset(GFLAGS_LIBRARIES)
|
||||
# Do not use unset, as we want to keep GFLAGS_NAMESPACE in the cache,
|
||||
# but simply clear its value.
|
||||
SET(GFLAGS_NAMESPACE "" CACHE STRING
|
||||
set(GFLAGS_NAMESPACE "" CACHE STRING
|
||||
"gflags namespace (google or gflags)" FORCE)
|
||||
|
||||
# Make results of search visible in the CMake GUI if gflags has not
|
||||
# been found so that user does not have to toggle to advanced view.
|
||||
MARK_AS_ADVANCED(CLEAR GFLAGS_INCLUDE_DIR
|
||||
mark_as_advanced(CLEAR GFLAGS_INCLUDE_DIR
|
||||
GFLAGS_LIBRARY
|
||||
GFLAGS_NAMESPACE)
|
||||
|
||||
GFLAGS_RESET_FIND_LIBRARY_PREFIX()
|
||||
gflags_reset_find_library_prefix()
|
||||
|
||||
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
|
||||
# use the camelcase library name, not uppercase.
|
||||
IF (Gflags_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
ELSEIF (Gflags_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
ELSE()
|
||||
if (Gflags_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
elseif (Gflags_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find gflags - " ${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 gflags - " ${REASON_MSG} ${ARGN})
|
||||
ENDIF ()
|
||||
ENDMACRO(GFLAGS_REPORT_NOT_FOUND)
|
||||
message("-- Failed to find gflags - " ${REASON_MSG} ${ARGN})
|
||||
endif ()
|
||||
endmacro(GFLAGS_REPORT_NOT_FOUND)
|
||||
|
||||
# Verify that all variable names passed as arguments are defined (can be empty
|
||||
# but must be defined) or raise a fatal error.
|
||||
MACRO(GFLAGS_CHECK_VARS_DEFINED)
|
||||
FOREACH(CHECK_VAR ${ARGN})
|
||||
IF (NOT DEFINED ${CHECK_VAR})
|
||||
MESSAGE(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.")
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDMACRO(GFLAGS_CHECK_VARS_DEFINED)
|
||||
macro(GFLAGS_CHECK_VARS_DEFINED)
|
||||
foreach(CHECK_VAR ${ARGN})
|
||||
if (NOT DEFINED ${CHECK_VAR})
|
||||
message(FATAL_ERROR "Ceres Bug: ${CHECK_VAR} is not defined.")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro(GFLAGS_CHECK_VARS_DEFINED)
|
||||
|
||||
# Use check_cxx_source_compiles() to compile trivial test programs to determine
|
||||
# the gflags namespace. This works on all OSs except Windows. If using Visual
|
||||
@@ -143,50 +143,50 @@ ENDMACRO(GFLAGS_CHECK_VARS_DEFINED)
|
||||
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
|
||||
# which is blank (empty string, will test FALSE is CMake conditionals)
|
||||
# if detection failed.
|
||||
FUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
# Verify that all required variables are defined.
|
||||
GFLAGS_CHECK_VARS_DEFINED(
|
||||
gflags_check_vars_defined(
|
||||
GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
|
||||
# Ensure that GFLAGS_NAMESPACE is always unset on completion unless
|
||||
# we explicitly set if after having the correct namespace.
|
||||
SET(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
include(CheckCXXSourceCompiles)
|
||||
# Setup include path & link library for gflags for CHECK_CXX_SOURCE_COMPILES.
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
# First try the (older) google namespace. Note that the output variable
|
||||
# MUST be unique to the build type as otherwise the test is not repeated as
|
||||
# it is assumed to have already been performed.
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
check_cxx_source_compiles(
|
||||
"#include <gflags/gflags.h>
|
||||
int main(int argc, char * argv[]) {
|
||||
google::ParseCommandLineFlags(&argc, &argv, true);
|
||||
return 0;
|
||||
}"
|
||||
GFLAGS_IN_GOOGLE_NAMESPACE)
|
||||
IF (GFLAGS_IN_GOOGLE_NAMESPACE)
|
||||
SET(GFLAGS_NAMESPACE google PARENT_SCOPE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
if (GFLAGS_IN_GOOGLE_NAMESPACE)
|
||||
set(GFLAGS_NAMESPACE google PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Try (newer) gflags namespace instead. Note that the output variable
|
||||
# MUST be unique to the build type as otherwise the test is not repeated as
|
||||
# it is assumed to have already been performed.
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
CHECK_CXX_SOURCE_COMPILES(
|
||||
set(CMAKE_REQUIRED_INCLUDES ${GFLAGS_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
check_cxx_source_compiles(
|
||||
"#include <gflags/gflags.h>
|
||||
int main(int argc, char * argv[]) {
|
||||
gflags::ParseCommandLineFlags(&argc, &argv, true);
|
||||
return 0;
|
||||
}"
|
||||
GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
IF (GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
SET(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
|
||||
RETURN()
|
||||
ENDIF (GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
ENDFUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
if (GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
set(GFLAGS_NAMESPACE gflags PARENT_SCOPE)
|
||||
return()
|
||||
endif (GFLAGS_IN_GFLAGS_NAMESPACE)
|
||||
endfunction(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
|
||||
# Use regex on the gflags headers to attempt to determine the gflags namespace.
|
||||
# Checks both gflags.h (contained namespace on versions < 2.1.2) and
|
||||
@@ -198,91 +198,91 @@ ENDFUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE)
|
||||
# Defines: GFLAGS_NAMESPACE in the caller's scope with the detected namespace,
|
||||
# which is blank (empty string, will test FALSE is CMake conditionals)
|
||||
# if detection failed.
|
||||
FUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
|
||||
function(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
|
||||
# Verify that all required variables are defined.
|
||||
GFLAGS_CHECK_VARS_DEFINED(GFLAGS_INCLUDE_DIR)
|
||||
gflags_check_vars_defined(GFLAGS_INCLUDE_DIR)
|
||||
# Ensure that GFLAGS_NAMESPACE is always undefined on completion unless
|
||||
# we explicitly set if after having the correct namespace.
|
||||
SET(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
set(GFLAGS_NAMESPACE "" PARENT_SCOPE)
|
||||
|
||||
# Scan gflags.h to identify what namespace gflags was built with. On
|
||||
# versions of gflags < 2.1.2, gflags.h was configured with the namespace
|
||||
# directly, on >= 2.1.2, gflags.h uses the GFLAGS_NAMESPACE #define which
|
||||
# is defined in gflags_declare.h, we try each location in turn.
|
||||
SET(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
IF (NOT EXISTS ${GFLAGS_HEADER_FILE})
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
set(GFLAGS_HEADER_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
if (NOT EXISTS ${GFLAGS_HEADER_FILE})
|
||||
gflags_report_not_found(
|
||||
"Could not find file: ${GFLAGS_HEADER_FILE} "
|
||||
"containing namespace information in gflags install located at: "
|
||||
"${GFLAGS_INCLUDE_DIR}.")
|
||||
ENDIF()
|
||||
FILE(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
|
||||
endif()
|
||||
file(READ ${GFLAGS_HEADER_FILE} GFLAGS_HEADER_FILE_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "namespace [A-Za-z]+"
|
||||
string(REGEX MATCH "namespace [A-Za-z]+"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_HEADER_FILE_CONTENTS}")
|
||||
STRING(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
|
||||
string(REGEX REPLACE "namespace ([A-Za-z]+)" "\\1"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
|
||||
|
||||
IF (NOT GFLAGS_NAMESPACE)
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
if (NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to extract gflags namespace from header file: "
|
||||
"${GFLAGS_HEADER_FILE}.")
|
||||
ENDIF (NOT GFLAGS_NAMESPACE)
|
||||
endif (NOT GFLAGS_NAMESPACE)
|
||||
|
||||
IF (GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
if (GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
# Found valid gflags namespace from gflags.h.
|
||||
SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
|
||||
# Failed to find gflags namespace from gflags.h, gflags is likely a new
|
||||
# version, check gflags_declare.h, which in newer versions (>= 2.1.2) contains
|
||||
# the GFLAGS_NAMESPACE #define, which is then referenced in gflags.h.
|
||||
SET(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
|
||||
IF (NOT EXISTS ${GFLAGS_DECLARE_FILE})
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
set(GFLAGS_DECLARE_FILE ${GFLAGS_INCLUDE_DIR}/gflags/gflags_declare.h)
|
||||
if (NOT EXISTS ${GFLAGS_DECLARE_FILE})
|
||||
gflags_report_not_found(
|
||||
"Could not find file: ${GFLAGS_DECLARE_FILE} "
|
||||
"containing namespace information in gflags install located at: "
|
||||
"${GFLAGS_INCLUDE_DIR}.")
|
||||
ENDIF()
|
||||
FILE(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
|
||||
endif()
|
||||
file(READ ${GFLAGS_DECLARE_FILE} GFLAGS_DECLARE_FILE_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
|
||||
string(REGEX MATCH "#define GFLAGS_NAMESPACE [A-Za-z]+"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_DECLARE_FILE_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
|
||||
string(REGEX REPLACE "#define GFLAGS_NAMESPACE ([A-Za-z]+)" "\\1"
|
||||
GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}")
|
||||
|
||||
IF (NOT GFLAGS_NAMESPACE)
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
if (NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to extract gflags namespace from declare file: "
|
||||
"${GFLAGS_DECLARE_FILE}.")
|
||||
ENDIF (NOT GFLAGS_NAMESPACE)
|
||||
endif (NOT GFLAGS_NAMESPACE)
|
||||
|
||||
IF (GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
if (GFLAGS_NAMESPACE STREQUAL "google" OR
|
||||
GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
# Found valid gflags namespace from gflags.h.
|
||||
SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
ENDFUNCTION(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" PARENT_SCOPE)
|
||||
return()
|
||||
endif()
|
||||
endfunction(GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX)
|
||||
|
||||
# -----------------------------------------------------------------
|
||||
# By default, if the user has expressed no preference for using an exported
|
||||
# gflags CMake configuration over performing a search for the installed
|
||||
# components, and has not specified any hints for the search locations, then
|
||||
# prefer a gflags exported configuration if available.
|
||||
IF (NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION
|
||||
if (NOT DEFINED GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION
|
||||
AND NOT GFLAGS_INCLUDE_DIR_HINTS
|
||||
AND NOT GFLAGS_LIBRARY_DIR_HINTS)
|
||||
MESSAGE(STATUS "No preference for use of exported gflags CMake configuration "
|
||||
message(STATUS "No preference for use of exported gflags CMake configuration "
|
||||
"set, and no hints for include/library directories provided. "
|
||||
"Defaulting to preferring an installed/exported gflags CMake configuration "
|
||||
"if available.")
|
||||
SET(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)
|
||||
ENDIF()
|
||||
set(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION TRUE)
|
||||
endif()
|
||||
|
||||
IF (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
if (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
# Try to find an exported CMake configuration for gflags, as generated by
|
||||
# gflags versions >= 2.1.
|
||||
#
|
||||
@@ -314,28 +314,28 @@ IF (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
# version if available.
|
||||
#
|
||||
# [1] http://www.cmake.org/cmake/help/v2.8.11/cmake.html#command:find_package
|
||||
FIND_PACKAGE(gflags QUIET
|
||||
find_package(gflags QUIET
|
||||
NO_MODULE
|
||||
NO_CMAKE_PACKAGE_REGISTRY
|
||||
NO_CMAKE_BUILDS_PATH)
|
||||
IF (gflags_FOUND)
|
||||
MESSAGE(STATUS "Found installed version of gflags: ${gflags_DIR}")
|
||||
ELSE(gflags_FOUND)
|
||||
if (gflags_FOUND)
|
||||
message(STATUS "Found installed version of gflags: ${gflags_DIR}")
|
||||
else(gflags_FOUND)
|
||||
# Failed to find an installed version of gflags, repeat search allowing
|
||||
# exported build directories.
|
||||
MESSAGE(STATUS "Failed to find installed version of gflags, searching for "
|
||||
message(STATUS "Failed to find installed version of gflags, searching for "
|
||||
"gflags build directories exported with CMake.")
|
||||
# Again pass NO_CMAKE_BUILDS_PATH, as we know that gflags is exported and
|
||||
# do not want to treat projects built with the CMake GUI preferentially.
|
||||
FIND_PACKAGE(gflags QUIET
|
||||
find_package(gflags QUIET
|
||||
NO_MODULE
|
||||
NO_CMAKE_BUILDS_PATH)
|
||||
IF (gflags_FOUND)
|
||||
MESSAGE(STATUS "Found exported gflags build directory: ${gflags_DIR}")
|
||||
ENDIF(gflags_FOUND)
|
||||
ENDIF(gflags_FOUND)
|
||||
if (gflags_FOUND)
|
||||
message(STATUS "Found exported gflags build directory: ${gflags_DIR}")
|
||||
endif(gflags_FOUND)
|
||||
endif(gflags_FOUND)
|
||||
|
||||
SET(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
|
||||
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION ${gflags_FOUND})
|
||||
|
||||
# gflags v2.1 - 2.1.2 shipped with a bug in their gflags-config.cmake [1]
|
||||
# whereby gflags_LIBRARIES = "gflags", but there was no imported target
|
||||
@@ -345,43 +345,43 @@ IF (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
# fix it.
|
||||
#
|
||||
# [1] https://github.com/gflags/gflags/issues/110
|
||||
IF (gflags_FOUND AND
|
||||
if (gflags_FOUND AND
|
||||
${gflags_VERSION} VERSION_LESS 2.1.3 AND
|
||||
NOT TARGET ${gflags_LIBRARIES})
|
||||
MESSAGE(STATUS "Detected broken gflags install in: ${gflags_DIR}, "
|
||||
message(STATUS "Detected broken gflags install in: ${gflags_DIR}, "
|
||||
"version: ${gflags_VERSION} <= 2.1.2 which defines gflags_LIBRARIES = "
|
||||
"${gflags_LIBRARIES} which is not an imported CMake target, see: "
|
||||
"https://github.com/gflags/gflags/issues/110. Attempting to fix by "
|
||||
"detecting correct gflags target.")
|
||||
# Ordering here expresses preference for detection, specifically we do not
|
||||
# want to use the _nothreads variants if the full library is available.
|
||||
LIST(APPEND CHECK_GFLAGS_IMPORTED_TARGET_NAMES
|
||||
list(APPEND CHECK_GFLAGS_IMPORTED_TARGET_NAMES
|
||||
gflags-shared gflags-static
|
||||
gflags_nothreads-shared gflags_nothreads-static)
|
||||
FOREACH(CHECK_GFLAGS_TARGET ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES})
|
||||
IF (TARGET ${CHECK_GFLAGS_TARGET})
|
||||
MESSAGE(STATUS "Found valid gflags target: ${CHECK_GFLAGS_TARGET}, "
|
||||
foreach(CHECK_GFLAGS_TARGET ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES})
|
||||
if (TARGET ${CHECK_GFLAGS_TARGET})
|
||||
message(STATUS "Found valid gflags target: ${CHECK_GFLAGS_TARGET}, "
|
||||
"updating gflags_LIBRARIES.")
|
||||
SET(gflags_LIBRARIES ${CHECK_GFLAGS_TARGET})
|
||||
BREAK()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
IF (NOT TARGET ${gflags_LIBRARIES})
|
||||
MESSAGE(STATUS "Failed to fix detected broken gflags install in: "
|
||||
set(gflags_LIBRARIES ${CHECK_GFLAGS_TARGET})
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
if (NOT TARGET ${gflags_LIBRARIES})
|
||||
message(STATUS "Failed to fix detected broken gflags install in: "
|
||||
"${gflags_DIR}, version: ${gflags_VERSION} <= 2.1.2, none of the "
|
||||
"imported targets for gflags: ${CHECK_GFLAGS_IMPORTED_TARGET_NAMES} "
|
||||
"are defined. Will continue with a manual search for gflags "
|
||||
"components. We recommend you build/install a version of gflags > "
|
||||
"2.1.2 (or master).")
|
||||
SET(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION FALSE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
set(FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION FALSE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
MESSAGE(STATUS "Detected gflags version: ${gflags_VERSION}")
|
||||
SET(GFLAGS_FOUND ${gflags_FOUND})
|
||||
SET(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
|
||||
SET(GFLAGS_LIBRARY ${gflags_LIBRARIES})
|
||||
if (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
message(STATUS "Detected gflags version: ${gflags_VERSION}")
|
||||
set(GFLAGS_FOUND ${gflags_FOUND})
|
||||
set(GFLAGS_INCLUDE_DIR ${gflags_INCLUDE_DIR})
|
||||
set(GFLAGS_LIBRARY ${gflags_LIBRARIES})
|
||||
|
||||
# gflags does not export the namespace in their CMake configuration, so
|
||||
# use our function to determine what it should be, as it can be either
|
||||
@@ -390,102 +390,102 @@ IF (GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
# NOTE: We use the regex method to determine the namespace here, as
|
||||
# check_cxx_source_compiles() will not use imported targets, which
|
||||
# is what gflags will be in this case.
|
||||
GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX()
|
||||
gflags_check_gflags_namespace_using_regex()
|
||||
|
||||
IF (NOT GFLAGS_NAMESPACE)
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
if (NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to determine gflags namespace using regex for gflags "
|
||||
"version: ${gflags_VERSION} exported here: ${gflags_DIR} using CMake.")
|
||||
ENDIF (NOT GFLAGS_NAMESPACE)
|
||||
ELSE (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
MESSAGE(STATUS "Failed to find an installed/exported CMake configuration "
|
||||
endif (NOT GFLAGS_NAMESPACE)
|
||||
else (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
message(STATUS "Failed to find an installed/exported CMake configuration "
|
||||
"for gflags, will perform search for installed gflags components.")
|
||||
ENDIF (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
ENDIF(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
endif (FOUND_INSTALLED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
endif(GFLAGS_PREFER_EXPORTED_GFLAGS_CMAKE_CONFIGURATION)
|
||||
|
||||
IF (NOT GFLAGS_FOUND)
|
||||
if (NOT GFLAGS_FOUND)
|
||||
# Either failed to find an exported gflags CMake configuration, or user
|
||||
# told us not to use one. Perform a manual search for all gflags components.
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also GFLAGS_RESET_FIND_LIBRARY_PREFIX().
|
||||
IF (MSVC)
|
||||
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}")
|
||||
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)
|
||||
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 GFLAGS_CHECK_INCLUDE_DIRS
|
||||
list(APPEND GFLAGS_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)
|
||||
LIST(APPEND GFLAGS_CHECK_PATH_SUFFIXES
|
||||
list(APPEND GFLAGS_CHECK_PATH_SUFFIXES
|
||||
gflags/include # Windows (for C:/Program Files prefix).
|
||||
gflags/Include ) # Windows (for C:/Program Files prefix).
|
||||
|
||||
LIST(APPEND GFLAGS_CHECK_LIBRARY_DIRS
|
||||
list(APPEND GFLAGS_CHECK_LIBRARY_DIRS
|
||||
/usr/local/lib
|
||||
/usr/local/homebrew/lib # Mac OS X.
|
||||
/opt/local/lib
|
||||
/usr/lib)
|
||||
LIST(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES
|
||||
list(APPEND GFLAGS_CHECK_LIBRARY_SUFFIXES
|
||||
gflags/lib # Windows (for C:/Program Files prefix).
|
||||
gflags/Lib ) # Windows (for C:/Program Files prefix).
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
FIND_PATH(GFLAGS_INCLUDE_DIR
|
||||
find_path(GFLAGS_INCLUDE_DIR
|
||||
NAMES gflags/gflags.h
|
||||
PATHS ${GFLAGS_INCLUDE_DIR_HINTS}
|
||||
${GFLAGS_CHECK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ${GFLAGS_CHECK_PATH_SUFFIXES})
|
||||
IF (NOT GFLAGS_INCLUDE_DIR OR
|
||||
if (NOT GFLAGS_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags include directory, set GFLAGS_INCLUDE_DIR "
|
||||
"to directory containing gflags/gflags.h")
|
||||
ENDIF (NOT GFLAGS_INCLUDE_DIR OR
|
||||
endif (NOT GFLAGS_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR})
|
||||
|
||||
FIND_LIBRARY(GFLAGS_LIBRARY NAMES gflags
|
||||
find_library(GFLAGS_LIBRARY NAMES gflags
|
||||
PATHS ${GFLAGS_LIBRARY_DIR_HINTS}
|
||||
${GFLAGS_CHECK_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${GFLAGS_CHECK_LIBRARY_SUFFIXES})
|
||||
IF (NOT GFLAGS_LIBRARY OR
|
||||
if (NOT GFLAGS_LIBRARY OR
|
||||
NOT EXISTS ${GFLAGS_LIBRARY})
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
gflags_report_not_found(
|
||||
"Could not find gflags library, set GFLAGS_LIBRARY "
|
||||
"to full path to libgflags.")
|
||||
ENDIF (NOT GFLAGS_LIBRARY OR
|
||||
endif (NOT GFLAGS_LIBRARY OR
|
||||
NOT EXISTS ${GFLAGS_LIBRARY})
|
||||
|
||||
# gflags typically requires a threading library (which is OS dependent), note
|
||||
# that this defines the CMAKE_THREAD_LIBS_INIT variable. If we are able to
|
||||
# detect threads, we assume that gflags requires it.
|
||||
FIND_PACKAGE(Threads QUIET)
|
||||
SET(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
find_package(Threads QUIET)
|
||||
set(GFLAGS_LINK_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
# On Windows (including MinGW), the Shlwapi library is used by gflags if
|
||||
# available.
|
||||
IF (WIN32)
|
||||
INCLUDE(CheckIncludeFileCXX)
|
||||
CHECK_INCLUDE_FILE_CXX("shlwapi.h" HAVE_SHLWAPI)
|
||||
IF (HAVE_SHLWAPI)
|
||||
LIST(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
|
||||
ENDIF(HAVE_SHLWAPI)
|
||||
ENDIF (WIN32)
|
||||
if (WIN32)
|
||||
include(CheckIncludeFileCXX)
|
||||
check_include_file_cxx("shlwapi.h" HAVE_SHLWAPI)
|
||||
if (HAVE_SHLWAPI)
|
||||
list(APPEND GFLAGS_LINK_LIBRARIES shlwapi.lib)
|
||||
endif(HAVE_SHLWAPI)
|
||||
endif (WIN32)
|
||||
|
||||
# Mark internally as found, then verify. GFLAGS_REPORT_NOT_FOUND() unsets
|
||||
# if called.
|
||||
SET(GFLAGS_FOUND TRUE)
|
||||
set(GFLAGS_FOUND TRUE)
|
||||
|
||||
# Identify what namespace gflags was built with.
|
||||
IF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
|
||||
if (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
|
||||
# To handle Windows peculiarities / CMake bugs on MSVC we try two approaches
|
||||
# to detect the gflags namespace:
|
||||
#
|
||||
@@ -495,27 +495,27 @@ IF (NOT GFLAGS_FOUND)
|
||||
# 2) [In the event 1) fails] Use regex on the gflags headers to try to
|
||||
# determine the gflags namespace. Whilst this is less robust than 1),
|
||||
# it does avoid any interaction with msbuild.
|
||||
GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_TRY_COMPILE()
|
||||
gflags_check_gflags_namespace_using_try_compile()
|
||||
|
||||
IF (NOT GFLAGS_NAMESPACE)
|
||||
if (NOT GFLAGS_NAMESPACE)
|
||||
# Failed to determine gflags namespace using check_cxx_source_compiles()
|
||||
# method, try and obtain it using regex on the gflags headers instead.
|
||||
MESSAGE(STATUS "Failed to find gflags namespace using using "
|
||||
message(STATUS "Failed to find gflags namespace using using "
|
||||
"check_cxx_source_compiles(), trying namespace regex instead, "
|
||||
"this is expected on Windows.")
|
||||
GFLAGS_CHECK_GFLAGS_NAMESPACE_USING_REGEX()
|
||||
gflags_check_gflags_namespace_using_regex()
|
||||
|
||||
IF (NOT GFLAGS_NAMESPACE)
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
if (NOT GFLAGS_NAMESPACE)
|
||||
gflags_report_not_found(
|
||||
"Failed to determine gflags namespace either by "
|
||||
"check_cxx_source_compiles(), or namespace regex.")
|
||||
ENDIF (NOT GFLAGS_NAMESPACE)
|
||||
ENDIF (NOT GFLAGS_NAMESPACE)
|
||||
ENDIF (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
|
||||
endif (NOT GFLAGS_NAMESPACE)
|
||||
endif (NOT GFLAGS_NAMESPACE)
|
||||
endif (GFLAGS_INCLUDE_DIR AND NOT GFLAGS_NAMESPACE)
|
||||
|
||||
# Make the GFLAGS_NAMESPACE a cache variable s/t the user can view it, and could
|
||||
# overwrite it in the CMake GUI.
|
||||
SET(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
|
||||
set(GFLAGS_NAMESPACE "${GFLAGS_NAMESPACE}" CACHE STRING
|
||||
"gflags namespace (google or gflags)" FORCE)
|
||||
|
||||
# gflags does not seem to provide any record of the version in its
|
||||
@@ -523,55 +523,55 @@ IF (NOT GFLAGS_FOUND)
|
||||
|
||||
# Catch case when caller has set GFLAGS_NAMESPACE in the cache / GUI
|
||||
# with an invalid value.
|
||||
IF (GFLAGS_NAMESPACE AND
|
||||
if (GFLAGS_NAMESPACE AND
|
||||
NOT GFLAGS_NAMESPACE STREQUAL "google" AND
|
||||
NOT GFLAGS_NAMESPACE STREQUAL "gflags")
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_NAMESPACE:"
|
||||
" ${GFLAGS_NAMESPACE} is not valid, not google or gflags.")
|
||||
ENDIF ()
|
||||
endif ()
|
||||
# Catch case when caller has set GFLAGS_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 (GFLAGS_INCLUDE_DIR AND
|
||||
if (GFLAGS_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_INCLUDE_DIR:"
|
||||
" ${GFLAGS_INCLUDE_DIR} does not contain gflags/gflags.h header.")
|
||||
ENDIF (GFLAGS_INCLUDE_DIR AND
|
||||
endif (GFLAGS_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GFLAGS_INCLUDE_DIR}/gflags/gflags.h)
|
||||
# TODO: This regex for gflags library is pretty primitive, we use lowercase
|
||||
# for comparison to handle Windows using CamelCase library names, could
|
||||
# this check be better?
|
||||
STRING(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
|
||||
IF (GFLAGS_LIBRARY AND
|
||||
string(TOLOWER "${GFLAGS_LIBRARY}" LOWERCASE_GFLAGS_LIBRARY)
|
||||
if (GFLAGS_LIBRARY AND
|
||||
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
|
||||
GFLAGS_REPORT_NOT_FOUND(
|
||||
gflags_report_not_found(
|
||||
"Caller defined GFLAGS_LIBRARY: "
|
||||
"${GFLAGS_LIBRARY} does not match gflags.")
|
||||
ENDIF (GFLAGS_LIBRARY AND
|
||||
endif (GFLAGS_LIBRARY AND
|
||||
NOT "${LOWERCASE_GFLAGS_LIBRARY}" MATCHES ".*gflags[^/]*")
|
||||
|
||||
GFLAGS_RESET_FIND_LIBRARY_PREFIX()
|
||||
gflags_reset_find_library_prefix()
|
||||
|
||||
ENDIF(NOT GFLAGS_FOUND)
|
||||
endif(NOT GFLAGS_FOUND)
|
||||
|
||||
# Set standard CMake FindPackage variables if found.
|
||||
IF (GFLAGS_FOUND)
|
||||
SET(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
|
||||
SET(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
ENDIF (GFLAGS_FOUND)
|
||||
if (GFLAGS_FOUND)
|
||||
set(GFLAGS_INCLUDE_DIRS ${GFLAGS_INCLUDE_DIR})
|
||||
set(GFLAGS_LIBRARIES ${GFLAGS_LIBRARY} ${GFLAGS_LINK_LIBRARIES})
|
||||
endif (GFLAGS_FOUND)
|
||||
|
||||
# Handle REQUIRED / QUIET optional arguments.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gflags DEFAULT_MSG
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Gflags DEFAULT_MSG
|
||||
GFLAGS_INCLUDE_DIRS GFLAGS_LIBRARIES GFLAGS_NAMESPACE)
|
||||
|
||||
# Only mark internal variables as advanced if we found gflags, otherwise
|
||||
# leave them visible in the standard GUI for the user to set manually.
|
||||
IF (GFLAGS_FOUND)
|
||||
MARK_AS_ADVANCED(FORCE GFLAGS_INCLUDE_DIR
|
||||
if (GFLAGS_FOUND)
|
||||
mark_as_advanced(FORCE GFLAGS_INCLUDE_DIR
|
||||
GFLAGS_LIBRARY
|
||||
GFLAGS_NAMESPACE
|
||||
gflags_DIR) # Autogenerated by find_package(gflags)
|
||||
ENDIF (GFLAGS_FOUND)
|
||||
endif (GFLAGS_FOUND)
|
||||
|
||||
+53
-53
@@ -62,106 +62,106 @@
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
|
||||
# FindGlog was invoked.
|
||||
MACRO(GLOG_RESET_FIND_LIBRARY_PREFIX)
|
||||
IF (MSVC)
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
ENDIF (MSVC)
|
||||
ENDMACRO(GLOG_RESET_FIND_LIBRARY_PREFIX)
|
||||
macro(GLOG_RESET_FIND_LIBRARY_PREFIX)
|
||||
if (MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
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)
|
||||
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
|
||||
mark_as_advanced(CLEAR GLOG_INCLUDE_DIR
|
||||
GLOG_LIBRARY)
|
||||
|
||||
GLOG_RESET_FIND_LIBRARY_PREFIX()
|
||||
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()
|
||||
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 ()
|
||||
ENDMACRO(GLOG_REPORT_NOT_FOUND)
|
||||
message("-- Failed to find glog - " ${REASON_MSG} ${ARGN})
|
||||
endif ()
|
||||
endmacro(GLOG_REPORT_NOT_FOUND)
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also GLOG_RESET_FIND_LIBRARY_PREFIX().
|
||||
IF (MSVC)
|
||||
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}")
|
||||
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)
|
||||
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
|
||||
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
|
||||
list(APPEND GLOG_CHECK_PATH_SUFFIXES
|
||||
glog/include
|
||||
glog/Include
|
||||
Glog/include
|
||||
Glog/Include)
|
||||
|
||||
LIST(APPEND GLOG_CHECK_LIBRARY_DIRS
|
||||
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
|
||||
list(APPEND GLOG_CHECK_LIBRARY_SUFFIXES
|
||||
glog/lib
|
||||
glog/Lib
|
||||
Glog/lib
|
||||
Glog/Lib)
|
||||
|
||||
# Search supplied hint directories first if supplied.
|
||||
FIND_PATH(GLOG_INCLUDE_DIR
|
||||
find_path(GLOG_INCLUDE_DIR
|
||||
NAMES glog/logging.h
|
||||
PATHS ${GLOG_INCLUDE_DIR_HINTS}
|
||||
${GLOG_CHECK_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES ${GLOG_CHECK_PATH_SUFFIXES})
|
||||
IF (NOT GLOG_INCLUDE_DIR OR
|
||||
if (NOT GLOG_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GLOG_INCLUDE_DIR})
|
||||
GLOG_REPORT_NOT_FOUND(
|
||||
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
|
||||
endif (NOT GLOG_INCLUDE_DIR OR
|
||||
NOT EXISTS ${GLOG_INCLUDE_DIR})
|
||||
|
||||
FIND_LIBRARY(GLOG_LIBRARY NAMES glog
|
||||
find_library(GLOG_LIBRARY NAMES glog
|
||||
PATHS ${GLOG_LIBRARY_DIR_HINTS}
|
||||
${GLOG_CHECK_LIBRARY_DIRS}
|
||||
PATH_SUFFIXES ${GLOG_CHECK_LIBRARY_SUFFIXES})
|
||||
IF (NOT GLOG_LIBRARY OR
|
||||
if (NOT GLOG_LIBRARY OR
|
||||
NOT EXISTS ${GLOG_LIBRARY})
|
||||
GLOG_REPORT_NOT_FOUND(
|
||||
glog_report_not_found(
|
||||
"Could not find glog library, set GLOG_LIBRARY "
|
||||
"to full path to libglog.")
|
||||
ENDIF (NOT GLOG_LIBRARY OR
|
||||
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)
|
||||
set(GLOG_FOUND TRUE)
|
||||
|
||||
# Glog does not seem to provide any record of the version in its
|
||||
# source tree, thus cannot extract version.
|
||||
@@ -169,41 +169,41 @@ SET(GLOG_FOUND TRUE)
|
||||
# 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
|
||||
if (GLOG_INCLUDE_DIR AND
|
||||
NOT EXISTS ${GLOG_INCLUDE_DIR}/glog/logging.h)
|
||||
GLOG_REPORT_NOT_FOUND(
|
||||
glog_report_not_found(
|
||||
"Caller defined GLOG_INCLUDE_DIR:"
|
||||
" ${GLOG_INCLUDE_DIR} does not contain glog/logging.h header.")
|
||||
ENDIF (GLOG_INCLUDE_DIR AND
|
||||
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
|
||||
string(TOLOWER "${GLOG_LIBRARY}" LOWERCASE_GLOG_LIBRARY)
|
||||
if (GLOG_LIBRARY AND
|
||||
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
|
||||
GLOG_REPORT_NOT_FOUND(
|
||||
glog_report_not_found(
|
||||
"Caller defined GLOG_LIBRARY: "
|
||||
"${GLOG_LIBRARY} does not match glog.")
|
||||
ENDIF (GLOG_LIBRARY AND
|
||||
endif (GLOG_LIBRARY AND
|
||||
NOT "${LOWERCASE_GLOG_LIBRARY}" MATCHES ".*glog[^/]*")
|
||||
|
||||
# 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 (GLOG_FOUND)
|
||||
set(GLOG_INCLUDE_DIRS ${GLOG_INCLUDE_DIR})
|
||||
set(GLOG_LIBRARIES ${GLOG_LIBRARY})
|
||||
endif (GLOG_FOUND)
|
||||
|
||||
GLOG_RESET_FIND_LIBRARY_PREFIX()
|
||||
glog_reset_find_library_prefix()
|
||||
|
||||
# Handle REQUIRED / QUIET optional arguments.
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Glog DEFAULT_MSG
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Glog DEFAULT_MSG
|
||||
GLOG_INCLUDE_DIRS GLOG_LIBRARIES)
|
||||
|
||||
# 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
|
||||
if (GLOG_FOUND)
|
||||
mark_as_advanced(FORCE GLOG_INCLUDE_DIR
|
||||
GLOG_LIBRARY)
|
||||
ENDIF (GLOG_FOUND)
|
||||
endif (GLOG_FOUND)
|
||||
|
||||
+36
-36
@@ -39,70 +39,70 @@
|
||||
# SHARED_PTR_TR1_NAMESPACE: TRUE if shared_ptr is defined in std::tr1 namespace,
|
||||
# otherwise it's assumed to be defined in std namespace.
|
||||
|
||||
MACRO(FIND_SHARED_PTR)
|
||||
macro(FIND_SHARED_PTR)
|
||||
# To support CXX11 option, clear the results of all check_xxx() functions
|
||||
# s/t we always perform the checks each time, otherwise CMake fails to
|
||||
# detect that the tests should be performed again after CXX11 is toggled.
|
||||
UNSET(HAVE_STD_MEMORY_HEADER CACHE)
|
||||
UNSET(HAVE_SHARED_PTR_IN_STD_NAMESPACE CACHE)
|
||||
UNSET(HAVE_SHARED_PTR_IN_TR1_NAMESPACE CACHE)
|
||||
UNSET(HAVE_TR1_MEMORY_HEADER CACHE)
|
||||
UNSET(HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER CACHE)
|
||||
unset(HAVE_STD_MEMORY_HEADER CACHE)
|
||||
unset(HAVE_SHARED_PTR_IN_STD_NAMESPACE CACHE)
|
||||
unset(HAVE_SHARED_PTR_IN_TR1_NAMESPACE CACHE)
|
||||
unset(HAVE_TR1_MEMORY_HEADER CACHE)
|
||||
unset(HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER CACHE)
|
||||
|
||||
SET(SHARED_PTR_FOUND FALSE)
|
||||
CHECK_INCLUDE_FILE_CXX(memory HAVE_STD_MEMORY_HEADER)
|
||||
IF (HAVE_STD_MEMORY_HEADER)
|
||||
set(SHARED_PTR_FOUND FALSE)
|
||||
check_include_file_cxx(memory HAVE_STD_MEMORY_HEADER)
|
||||
if (HAVE_STD_MEMORY_HEADER)
|
||||
# Finding the memory header doesn't mean that shared_ptr is in std
|
||||
# namespace.
|
||||
#
|
||||
# In particular, MSVC 2008 has shared_ptr declared in std::tr1. In
|
||||
# order to support this, we do an extra check to see which namespace
|
||||
# should be used.
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <memory>
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("#include <memory>
|
||||
int main() {
|
||||
std::shared_ptr<int> int_ptr;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
|
||||
IF (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
MESSAGE("-- Found shared_ptr in std namespace using <memory> header.")
|
||||
SET(SHARED_PTR_FOUND TRUE)
|
||||
ELSE (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <memory>
|
||||
if (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
message("-- Found shared_ptr in std namespace using <memory> header.")
|
||||
set(SHARED_PTR_FOUND TRUE)
|
||||
else (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
check_cxx_source_compiles("#include <memory>
|
||||
int main() {
|
||||
std::tr1::shared_ptr<int> int_ptr;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||
IF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||
MESSAGE("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
|
||||
SET(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||
SET(SHARED_PTR_FOUND TRUE)
|
||||
ENDIF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||
ENDIF (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
ENDIF (HAVE_STD_MEMORY_HEADER)
|
||||
if (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||
message("-- Found shared_ptr in std::tr1 namespace using <memory> header.")
|
||||
set(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||
set(SHARED_PTR_FOUND TRUE)
|
||||
endif (HAVE_SHARED_PTR_IN_TR1_NAMESPACE)
|
||||
endif (HAVE_SHARED_PTR_IN_STD_NAMESPACE)
|
||||
endif (HAVE_STD_MEMORY_HEADER)
|
||||
|
||||
IF (NOT SHARED_PTR_FOUND)
|
||||
if (NOT SHARED_PTR_FOUND)
|
||||
# Further, gcc defines shared_ptr in std::tr1 namespace and
|
||||
# <tr1/memory> is to be included for this. And what makes things
|
||||
# even more tricky is that gcc does have <memory> header, so
|
||||
# all the checks above wouldn't find shared_ptr.
|
||||
CHECK_INCLUDE_FILE_CXX("tr1/memory" HAVE_TR1_MEMORY_HEADER)
|
||||
IF (HAVE_TR1_MEMORY_HEADER)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <tr1/memory>
|
||||
check_include_file_cxx("tr1/memory" HAVE_TR1_MEMORY_HEADER)
|
||||
if (HAVE_TR1_MEMORY_HEADER)
|
||||
check_cxx_source_compiles("#include <tr1/memory>
|
||||
int main() {
|
||||
std::tr1::shared_ptr<int> int_ptr;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||
IF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||
MESSAGE("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
|
||||
SET(SHARED_PTR_TR1_MEMORY_HEADER TRUE)
|
||||
SET(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||
SET(SHARED_PTR_FOUND TRUE)
|
||||
ENDIF (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||
ENDIF (HAVE_TR1_MEMORY_HEADER)
|
||||
ENDIF (NOT SHARED_PTR_FOUND)
|
||||
ENDMACRO(FIND_SHARED_PTR)
|
||||
if (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||
message("-- Found shared_ptr in std::tr1 namespace using <tr1/memory> header.")
|
||||
set(SHARED_PTR_TR1_MEMORY_HEADER TRUE)
|
||||
set(SHARED_PTR_TR1_NAMESPACE TRUE)
|
||||
set(SHARED_PTR_FOUND TRUE)
|
||||
endif (HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)
|
||||
endif (HAVE_TR1_MEMORY_HEADER)
|
||||
endif (NOT SHARED_PTR_FOUND)
|
||||
endmacro(FIND_SHARED_PTR)
|
||||
|
||||
+11
-11
@@ -35,7 +35,7 @@
|
||||
# SPHINX_EXECUTABLE
|
||||
# SPHINX_FOUND
|
||||
|
||||
FIND_PROGRAM(SPHINX_EXECUTABLE
|
||||
find_program(SPHINX_EXECUTABLE
|
||||
NAMES sphinx-build
|
||||
PATHS
|
||||
/usr/bin
|
||||
@@ -43,24 +43,24 @@ FIND_PROGRAM(SPHINX_EXECUTABLE
|
||||
/opt/local/bin
|
||||
DOC "Sphinx documentation generator")
|
||||
|
||||
IF (NOT SPHINX_EXECUTABLE)
|
||||
SET(_Python_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
||||
if (NOT SPHINX_EXECUTABLE)
|
||||
set(_Python_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
|
||||
|
||||
FOREACH (_version ${_Python_VERSIONS})
|
||||
SET(_sphinx_NAMES sphinx-build-${_version})
|
||||
foreach (_version ${_Python_VERSIONS})
|
||||
set(_sphinx_NAMES sphinx-build-${_version})
|
||||
|
||||
FIND_PROGRAM(SPHINX_EXECUTABLE
|
||||
find_program(SPHINX_EXECUTABLE
|
||||
NAMES ${_sphinx_NAMES}
|
||||
PATHS
|
||||
/usr/bin
|
||||
/usr/local/bin
|
||||
/opt/local/bin
|
||||
DOC "Sphinx documentation generator")
|
||||
ENDFOREACH ()
|
||||
ENDIF ()
|
||||
endforeach ()
|
||||
endif ()
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sphinx DEFAULT_MSG SPHINX_EXECUTABLE)
|
||||
find_package_handle_standard_args(Sphinx DEFAULT_MSG SPHINX_EXECUTABLE)
|
||||
|
||||
MARK_AS_ADVANCED(SPHINX_EXECUTABLE)
|
||||
mark_as_advanced(SPHINX_EXECUTABLE)
|
||||
|
||||
+287
-287
@@ -112,60 +112,60 @@
|
||||
|
||||
# Reset CALLERS_CMAKE_FIND_LIBRARY_PREFIXES to its value when
|
||||
# FindSuiteSparse was invoked.
|
||||
MACRO(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
IF (MSVC)
|
||||
SET(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
ENDIF (MSVC)
|
||||
ENDMACRO(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
macro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
if (MSVC)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "${CALLERS_CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
endmacro(SUITESPARSE_RESET_FIND_LIBRARY_PREFIX)
|
||||
|
||||
# Called if we failed to find SuiteSparse 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(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
|
||||
UNSET(SUITESPARSE_FOUND)
|
||||
UNSET(SUITESPARSE_INCLUDE_DIRS)
|
||||
UNSET(SUITESPARSE_LIBRARIES)
|
||||
UNSET(SUITESPARSE_VERSION)
|
||||
UNSET(SUITESPARSE_MAIN_VERSION)
|
||||
UNSET(SUITESPARSE_SUB_VERSION)
|
||||
UNSET(SUITESPARSE_SUBSUB_VERSION)
|
||||
macro(SUITESPARSE_REPORT_NOT_FOUND REASON_MSG)
|
||||
unset(SUITESPARSE_FOUND)
|
||||
unset(SUITESPARSE_INCLUDE_DIRS)
|
||||
unset(SUITESPARSE_LIBRARIES)
|
||||
unset(SUITESPARSE_VERSION)
|
||||
unset(SUITESPARSE_MAIN_VERSION)
|
||||
unset(SUITESPARSE_SUB_VERSION)
|
||||
unset(SUITESPARSE_SUBSUB_VERSION)
|
||||
# Do NOT unset SUITESPARSE_FOUND_REQUIRED_VARS here, as it is used by
|
||||
# FindPackageHandleStandardArgs() to generate the automatic error message on
|
||||
# failure which highlights which components are missing.
|
||||
|
||||
SUITESPARSE_RESET_FIND_LIBRARY_PREFIX()
|
||||
suitesparse_reset_find_library_prefix()
|
||||
|
||||
# Note <package>_FIND_[REQUIRED/QUIETLY] variables defined by FindPackage()
|
||||
# use the camelcase library name, not uppercase.
|
||||
IF (SuiteSparse_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
|
||||
ELSEIF (SuiteSparse_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
|
||||
ELSE()
|
||||
if (SuiteSparse_FIND_QUIETLY)
|
||||
message(STATUS "Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
|
||||
elseif (SuiteSparse_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Failed to find SuiteSparse - " ${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 SuiteSparse - " ${REASON_MSG} ${ARGN})
|
||||
ENDIF (SuiteSparse_FIND_QUIETLY)
|
||||
message("-- Failed to find SuiteSparse - " ${REASON_MSG} ${ARGN})
|
||||
endif (SuiteSparse_FIND_QUIETLY)
|
||||
|
||||
# Do not call RETURN(), s/t we keep processing if not called with REQUIRED.
|
||||
ENDMACRO(SUITESPARSE_REPORT_NOT_FOUND)
|
||||
endmacro(SUITESPARSE_REPORT_NOT_FOUND)
|
||||
|
||||
# Handle possible presence of lib prefix for libraries on MSVC, see
|
||||
# also SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
|
||||
IF (MSVC)
|
||||
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}")
|
||||
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)
|
||||
set(CMAKE_FIND_LIBRARY_PREFIXES "lib" "" "${CMAKE_FIND_LIBRARY_PREFIXES}")
|
||||
endif (MSVC)
|
||||
|
||||
# Specify search directories for include files and libraries (this is the union
|
||||
# of the search directories for all OSs). Search user-specified hint
|
||||
# directories first if supplied, and search user-installed locations first
|
||||
# so that we prefer user installs to system installs where both exist.
|
||||
LIST(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
|
||||
list(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
|
||||
${SUITESPARSE_INCLUDE_DIR_HINTS}
|
||||
/opt/local/include
|
||||
/opt/local/include/ufsparse # Mac OS X
|
||||
@@ -174,7 +174,7 @@ LIST(APPEND SUITESPARSE_CHECK_INCLUDE_DIRS
|
||||
/usr/local/include/suitesparse
|
||||
/usr/include/suitesparse # Ubuntu
|
||||
/usr/include)
|
||||
LIST(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
|
||||
list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
|
||||
${SUITESPARSE_LIBRARY_DIR_HINTS}
|
||||
/opt/local/lib
|
||||
/opt/local/lib/ufsparse # Mac OS X
|
||||
@@ -188,380 +188,380 @@ LIST(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
|
||||
# automatic failure message generated by FindPackageHandleStandardArgs()
|
||||
# when not all required components are found is helpful, we maintain a list
|
||||
# of all variables that must be defined for SuiteSparse to be considered found.
|
||||
UNSET(SUITESPARSE_FOUND_REQUIRED_VARS)
|
||||
unset(SUITESPARSE_FOUND_REQUIRED_VARS)
|
||||
|
||||
# BLAS.
|
||||
FIND_PACKAGE(BLAS QUIET)
|
||||
IF (NOT BLAS_FOUND)
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
find_package(BLAS QUIET)
|
||||
if (NOT BLAS_FOUND)
|
||||
suitesparse_report_not_found(
|
||||
"Did not find BLAS library (required for SuiteSparse).")
|
||||
ENDIF (NOT BLAS_FOUND)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS BLAS_FOUND)
|
||||
endif (NOT BLAS_FOUND)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS BLAS_FOUND)
|
||||
|
||||
# LAPACK.
|
||||
FIND_PACKAGE(LAPACK QUIET)
|
||||
IF (NOT LAPACK_FOUND)
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
find_package(LAPACK QUIET)
|
||||
if (NOT LAPACK_FOUND)
|
||||
suitesparse_report_not_found(
|
||||
"Did not find LAPACK library (required for SuiteSparse).")
|
||||
ENDIF (NOT LAPACK_FOUND)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS LAPACK_FOUND)
|
||||
endif (NOT LAPACK_FOUND)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS LAPACK_FOUND)
|
||||
|
||||
# AMD.
|
||||
SET(AMD_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS AMD_FOUND)
|
||||
FIND_LIBRARY(AMD_LIBRARY NAMES amd
|
||||
set(AMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS AMD_FOUND)
|
||||
find_library(AMD_LIBRARY NAMES amd
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${AMD_LIBRARY})
|
||||
MESSAGE(STATUS "Found AMD library: ${AMD_LIBRARY}")
|
||||
ELSE (EXISTS ${AMD_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${AMD_LIBRARY})
|
||||
message(STATUS "Found AMD library: ${AMD_LIBRARY}")
|
||||
else (EXISTS ${AMD_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find AMD library (required SuiteSparse component).")
|
||||
SET(AMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${AMD_LIBRARY})
|
||||
MARK_AS_ADVANCED(AMD_LIBRARY)
|
||||
set(AMD_FOUND FALSE)
|
||||
endif (EXISTS ${AMD_LIBRARY})
|
||||
mark_as_advanced(AMD_LIBRARY)
|
||||
|
||||
FIND_PATH(AMD_INCLUDE_DIR NAMES amd.h
|
||||
find_path(AMD_INCLUDE_DIR NAMES amd.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${AMD_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found AMD header in: ${AMD_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${AMD_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${AMD_INCLUDE_DIR})
|
||||
message(STATUS "Found AMD header in: ${AMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${AMD_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find AMD header (required SuiteSparse component).")
|
||||
SET(AMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${AMD_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(AMD_INCLUDE_DIR)
|
||||
set(AMD_FOUND FALSE)
|
||||
endif (EXISTS ${AMD_INCLUDE_DIR})
|
||||
mark_as_advanced(AMD_INCLUDE_DIR)
|
||||
|
||||
# CAMD.
|
||||
SET(CAMD_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CAMD_FOUND)
|
||||
FIND_LIBRARY(CAMD_LIBRARY NAMES camd
|
||||
set(CAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CAMD_FOUND)
|
||||
find_library(CAMD_LIBRARY NAMES camd
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${CAMD_LIBRARY})
|
||||
MESSAGE(STATUS "Found CAMD library: ${CAMD_LIBRARY}")
|
||||
ELSE (EXISTS ${CAMD_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CAMD_LIBRARY})
|
||||
message(STATUS "Found CAMD library: ${CAMD_LIBRARY}")
|
||||
else (EXISTS ${CAMD_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CAMD library (required SuiteSparse component).")
|
||||
SET(CAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CAMD_LIBRARY})
|
||||
MARK_AS_ADVANCED(CAMD_LIBRARY)
|
||||
set(CAMD_FOUND FALSE)
|
||||
endif (EXISTS ${CAMD_LIBRARY})
|
||||
mark_as_advanced(CAMD_LIBRARY)
|
||||
|
||||
FIND_PATH(CAMD_INCLUDE_DIR NAMES camd.h
|
||||
find_path(CAMD_INCLUDE_DIR NAMES camd.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found CAMD header in: ${CAMD_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found CAMD header in: ${CAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CAMD header (required SuiteSparse component).")
|
||||
SET(CAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(CAMD_INCLUDE_DIR)
|
||||
set(CAMD_FOUND FALSE)
|
||||
endif (EXISTS ${CAMD_INCLUDE_DIR})
|
||||
mark_as_advanced(CAMD_INCLUDE_DIR)
|
||||
|
||||
# COLAMD.
|
||||
SET(COLAMD_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS COLAMD_FOUND)
|
||||
FIND_LIBRARY(COLAMD_LIBRARY NAMES colamd
|
||||
set(COLAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS COLAMD_FOUND)
|
||||
find_library(COLAMD_LIBRARY NAMES colamd
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${COLAMD_LIBRARY})
|
||||
MESSAGE(STATUS "Found COLAMD library: ${COLAMD_LIBRARY}")
|
||||
ELSE (EXISTS ${COLAMD_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${COLAMD_LIBRARY})
|
||||
message(STATUS "Found COLAMD library: ${COLAMD_LIBRARY}")
|
||||
else (EXISTS ${COLAMD_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find COLAMD library (required SuiteSparse component).")
|
||||
SET(COLAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${COLAMD_LIBRARY})
|
||||
MARK_AS_ADVANCED(COLAMD_LIBRARY)
|
||||
set(COLAMD_FOUND FALSE)
|
||||
endif (EXISTS ${COLAMD_LIBRARY})
|
||||
mark_as_advanced(COLAMD_LIBRARY)
|
||||
|
||||
FIND_PATH(COLAMD_INCLUDE_DIR NAMES colamd.h
|
||||
find_path(COLAMD_INCLUDE_DIR NAMES colamd.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found COLAMD header in: ${COLAMD_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found COLAMD header in: ${COLAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find COLAMD header (required SuiteSparse component).")
|
||||
SET(COLAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(COLAMD_INCLUDE_DIR)
|
||||
set(COLAMD_FOUND FALSE)
|
||||
endif (EXISTS ${COLAMD_INCLUDE_DIR})
|
||||
mark_as_advanced(COLAMD_INCLUDE_DIR)
|
||||
|
||||
# CCOLAMD.
|
||||
SET(CCOLAMD_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CCOLAMD_FOUND)
|
||||
FIND_LIBRARY(CCOLAMD_LIBRARY NAMES ccolamd
|
||||
set(CCOLAMD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CCOLAMD_FOUND)
|
||||
find_library(CCOLAMD_LIBRARY NAMES ccolamd
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${CCOLAMD_LIBRARY})
|
||||
MESSAGE(STATUS "Found CCOLAMD library: ${CCOLAMD_LIBRARY}")
|
||||
ELSE (EXISTS ${CCOLAMD_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CCOLAMD_LIBRARY})
|
||||
message(STATUS "Found CCOLAMD library: ${CCOLAMD_LIBRARY}")
|
||||
else (EXISTS ${CCOLAMD_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CCOLAMD library (required SuiteSparse component).")
|
||||
SET(CCOLAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CCOLAMD_LIBRARY})
|
||||
MARK_AS_ADVANCED(CCOLAMD_LIBRARY)
|
||||
set(CCOLAMD_FOUND FALSE)
|
||||
endif (EXISTS ${CCOLAMD_LIBRARY})
|
||||
mark_as_advanced(CCOLAMD_LIBRARY)
|
||||
|
||||
FIND_PATH(CCOLAMD_INCLUDE_DIR NAMES ccolamd.h
|
||||
find_path(CCOLAMD_INCLUDE_DIR NAMES ccolamd.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found CCOLAMD header in: ${CCOLAMD_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
message(STATUS "Found CCOLAMD header in: ${CCOLAMD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CCOLAMD header (required SuiteSparse component).")
|
||||
SET(CCOLAMD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(CCOLAMD_INCLUDE_DIR)
|
||||
set(CCOLAMD_FOUND FALSE)
|
||||
endif (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
||||
mark_as_advanced(CCOLAMD_INCLUDE_DIR)
|
||||
|
||||
# CHOLMOD.
|
||||
SET(CHOLMOD_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CHOLMOD_FOUND)
|
||||
FIND_LIBRARY(CHOLMOD_LIBRARY NAMES cholmod
|
||||
set(CHOLMOD_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CHOLMOD_FOUND)
|
||||
find_library(CHOLMOD_LIBRARY NAMES cholmod
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${CHOLMOD_LIBRARY})
|
||||
MESSAGE(STATUS "Found CHOLMOD library: ${CHOLMOD_LIBRARY}")
|
||||
ELSE (EXISTS ${CHOLMOD_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CHOLMOD_LIBRARY})
|
||||
message(STATUS "Found CHOLMOD library: ${CHOLMOD_LIBRARY}")
|
||||
else (EXISTS ${CHOLMOD_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CHOLMOD library (required SuiteSparse component).")
|
||||
SET(CHOLMOD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CHOLMOD_LIBRARY})
|
||||
MARK_AS_ADVANCED(CHOLMOD_LIBRARY)
|
||||
set(CHOLMOD_FOUND FALSE)
|
||||
endif (EXISTS ${CHOLMOD_LIBRARY})
|
||||
mark_as_advanced(CHOLMOD_LIBRARY)
|
||||
|
||||
FIND_PATH(CHOLMOD_INCLUDE_DIR NAMES cholmod.h
|
||||
find_path(CHOLMOD_INCLUDE_DIR NAMES cholmod.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found CHOLMOD header in: ${CHOLMOD_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
message(STATUS "Found CHOLMOD header in: ${CHOLMOD_INCLUDE_DIR}")
|
||||
else (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find CHOLMOD header (required SuiteSparse component).")
|
||||
SET(CHOLMOD_FOUND FALSE)
|
||||
ENDIF (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(CHOLMOD_INCLUDE_DIR)
|
||||
set(CHOLMOD_FOUND FALSE)
|
||||
endif (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
||||
mark_as_advanced(CHOLMOD_INCLUDE_DIR)
|
||||
|
||||
# SuiteSparseQR.
|
||||
SET(SUITESPARSEQR_FOUND TRUE)
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSEQR_FOUND)
|
||||
FIND_LIBRARY(SUITESPARSEQR_LIBRARY NAMES spqr
|
||||
set(SUITESPARSEQR_FOUND TRUE)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSEQR_FOUND)
|
||||
find_library(SUITESPARSEQR_LIBRARY NAMES spqr
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
MESSAGE(STATUS "Found SuiteSparseQR library: ${SUITESPARSEQR_LIBRARY}")
|
||||
ELSE (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
message(STATUS "Found SuiteSparseQR library: ${SUITESPARSEQR_LIBRARY}")
|
||||
else (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find SuiteSparseQR library (required SuiteSparse component).")
|
||||
SET(SUITESPARSEQR_FOUND FALSE)
|
||||
ENDIF (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
MARK_AS_ADVANCED(SUITESPARSEQR_LIBRARY)
|
||||
set(SUITESPARSEQR_FOUND FALSE)
|
||||
endif (EXISTS ${SUITESPARSEQR_LIBRARY})
|
||||
mark_as_advanced(SUITESPARSEQR_LIBRARY)
|
||||
|
||||
FIND_PATH(SUITESPARSEQR_INCLUDE_DIR NAMES SuiteSparseQR.hpp
|
||||
find_path(SUITESPARSEQR_INCLUDE_DIR NAMES SuiteSparseQR.hpp
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found SuiteSparseQR header in: ${SUITESPARSEQR_INCLUDE_DIR}")
|
||||
ELSE (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
message(STATUS "Found SuiteSparseQR header in: ${SUITESPARSEQR_INCLUDE_DIR}")
|
||||
else (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
suitesparse_report_not_found(
|
||||
"Did not find SUITESPARSEQR header (required SuiteSparse component).")
|
||||
SET(SUITESPARSEQR_FOUND FALSE)
|
||||
ENDIF (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(SUITESPARSEQR_INCLUDE_DIR)
|
||||
set(SUITESPARSEQR_FOUND FALSE)
|
||||
endif (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
||||
mark_as_advanced(SUITESPARSEQR_INCLUDE_DIR)
|
||||
|
||||
IF (SUITESPARSEQR_FOUND)
|
||||
if (SUITESPARSEQR_FOUND)
|
||||
# SuiteSparseQR may be compiled with Intel Threading Building Blocks,
|
||||
# we assume that if TBB is installed, SuiteSparseQR was compiled with
|
||||
# support for it, this will do no harm if it wasn't.
|
||||
SET(TBB_FOUND TRUE)
|
||||
FIND_LIBRARY(TBB_LIBRARIES NAMES tbb
|
||||
set(TBB_FOUND TRUE)
|
||||
find_library(TBB_LIBRARIES NAMES tbb
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${TBB_LIBRARIES})
|
||||
MESSAGE(STATUS "Found Intel Thread Building Blocks (TBB) library: "
|
||||
if (EXISTS ${TBB_LIBRARIES})
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) library: "
|
||||
"${TBB_LIBRARIES}, assuming SuiteSparseQR was compiled with TBB.")
|
||||
ELSE (EXISTS ${TBB_LIBRARIES})
|
||||
MESSAGE(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
|
||||
else (EXISTS ${TBB_LIBRARIES})
|
||||
message(STATUS "Did not find Intel TBB library, assuming SuiteSparseQR was "
|
||||
"not compiled with TBB.")
|
||||
SET(TBB_FOUND FALSE)
|
||||
ENDIF (EXISTS ${TBB_LIBRARIES})
|
||||
MARK_AS_ADVANCED(TBB_LIBRARIES)
|
||||
set(TBB_FOUND FALSE)
|
||||
endif (EXISTS ${TBB_LIBRARIES})
|
||||
mark_as_advanced(TBB_LIBRARIES)
|
||||
|
||||
IF (TBB_FOUND)
|
||||
FIND_LIBRARY(TBB_MALLOC_LIB NAMES tbbmalloc
|
||||
if (TBB_FOUND)
|
||||
find_library(TBB_MALLOC_LIB NAMES tbbmalloc
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${TBB_MALLOC_LIB})
|
||||
MESSAGE(STATUS "Found Intel Thread Building Blocks (TBB) Malloc library: "
|
||||
if (EXISTS ${TBB_MALLOC_LIB})
|
||||
message(STATUS "Found Intel Thread Building Blocks (TBB) Malloc library: "
|
||||
"${TBB_MALLOC_LIB}")
|
||||
# Append TBB malloc library to TBB libraries list whilst retaining
|
||||
# any CMake generated help string (cache variable).
|
||||
LIST(APPEND TBB_LIBRARIES ${TBB_MALLOC_LIB})
|
||||
GET_PROPERTY(HELP_STRING CACHE TBB_LIBRARIES PROPERTY HELPSTRING)
|
||||
SET(TBB_LIBRARIES "${TBB_LIBRARIES}" CACHE STRING "${HELP_STRING}")
|
||||
list(APPEND TBB_LIBRARIES ${TBB_MALLOC_LIB})
|
||||
get_property(HELP_STRING CACHE TBB_LIBRARIES PROPERTY HELPSTRING)
|
||||
set(TBB_LIBRARIES "${TBB_LIBRARIES}" CACHE STRING "${HELP_STRING}")
|
||||
|
||||
# Add the TBB libraries to the SuiteSparseQR libraries (the only
|
||||
# libraries to optionally depend on TBB).
|
||||
LIST(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
|
||||
list(APPEND SUITESPARSEQR_LIBRARY ${TBB_LIBRARIES})
|
||||
|
||||
ELSE (EXISTS ${TBB_MALLOC_LIB})
|
||||
else (EXISTS ${TBB_MALLOC_LIB})
|
||||
# If we cannot find all required TBB components do not include it as
|
||||
# a dependency.
|
||||
MESSAGE(STATUS "Did not find Intel Thread Building Blocks (TBB) Malloc "
|
||||
message(STATUS "Did not find Intel Thread Building Blocks (TBB) Malloc "
|
||||
"Library, discarding TBB as a dependency.")
|
||||
SET(TBB_FOUND FALSE)
|
||||
ENDIF (EXISTS ${TBB_MALLOC_LIB})
|
||||
MARK_AS_ADVANCED(TBB_MALLOC_LIB)
|
||||
ENDIF (TBB_FOUND)
|
||||
ENDIF(SUITESPARSEQR_FOUND)
|
||||
set(TBB_FOUND FALSE)
|
||||
endif (EXISTS ${TBB_MALLOC_LIB})
|
||||
mark_as_advanced(TBB_MALLOC_LIB)
|
||||
endif (TBB_FOUND)
|
||||
endif(SUITESPARSEQR_FOUND)
|
||||
|
||||
# UFconfig / SuiteSparse_config.
|
||||
#
|
||||
# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
|
||||
# For SuiteSparse 3, UFconfig.h is required.
|
||||
FIND_LIBRARY(SUITESPARSE_CONFIG_LIBRARY NAMES suitesparseconfig
|
||||
find_library(SUITESPARSE_CONFIG_LIBRARY NAMES suitesparseconfig
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
||||
MESSAGE(STATUS "Found SuiteSparse_config library: "
|
||||
if (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
||||
message(STATUS "Found SuiteSparse_config library: "
|
||||
"${SUITESPARSE_CONFIG_LIBRARY}")
|
||||
ENDIF (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
||||
MARK_AS_ADVANCED(SUITESPARSE_CONFIG_LIBRARY)
|
||||
endif (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
||||
mark_as_advanced(SUITESPARSE_CONFIG_LIBRARY)
|
||||
|
||||
FIND_PATH(SUITESPARSE_CONFIG_INCLUDE_DIR NAMES SuiteSparse_config.h
|
||||
find_path(SUITESPARSE_CONFIG_INCLUDE_DIR NAMES SuiteSparse_config.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found SuiteSparse_config header in: "
|
||||
if (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
message(STATUS "Found SuiteSparse_config header in: "
|
||||
"${SUITESPARSE_CONFIG_INCLUDE_DIR}")
|
||||
ENDIF (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(SUITESPARSE_CONFIG_INCLUDE_DIR)
|
||||
endif (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
mark_as_advanced(SUITESPARSE_CONFIG_INCLUDE_DIR)
|
||||
|
||||
SET(SUITESPARSE_CONFIG_FOUND FALSE)
|
||||
SET(UFCONFIG_FOUND FALSE)
|
||||
set(SUITESPARSE_CONFIG_FOUND FALSE)
|
||||
set(UFCONFIG_FOUND FALSE)
|
||||
|
||||
IF (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
if (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
SET(SUITESPARSE_CONFIG_FOUND TRUE)
|
||||
set(SUITESPARSE_CONFIG_FOUND TRUE)
|
||||
# SuiteSparse_config (SuiteSparse version >= 4) requires librt library for
|
||||
# timing by default when compiled on Linux or Unix, but not on OSX (which
|
||||
# does not have librt).
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
||||
FIND_LIBRARY(LIBRT_LIBRARY NAMES rt
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
||||
find_library(LIBRT_LIBRARY NAMES rt
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (LIBRT_LIBRARY)
|
||||
MESSAGE(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
|
||||
if (LIBRT_LIBRARY)
|
||||
message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
|
||||
"SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
|
||||
"SuiteSparse is compiled with timing).")
|
||||
ELSE (LIBRT_LIBRARY)
|
||||
MESSAGE(STATUS "Could not find librt, but found SuiteSparse_config, "
|
||||
else (LIBRT_LIBRARY)
|
||||
message(STATUS "Could not find librt, but found SuiteSparse_config, "
|
||||
"assuming that SuiteSparse was compiled without timing.")
|
||||
ENDIF (LIBRT_LIBRARY)
|
||||
MARK_AS_ADVANCED(LIBRT_LIBRARY)
|
||||
LIST(APPEND SUITESPARSE_CONFIG_LIBRARY ${LIBRT_LIBRARY})
|
||||
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
||||
endif (LIBRT_LIBRARY)
|
||||
mark_as_advanced(LIBRT_LIBRARY)
|
||||
list(APPEND SUITESPARSE_CONFIG_LIBRARY ${LIBRT_LIBRARY})
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
||||
|
||||
ELSE (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
else (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
# Failed to find SuiteSparse_config (>= v4 installs), instead look for
|
||||
# UFconfig header which should be present in < v4 installs.
|
||||
SET(SUITESPARSE_CONFIG_FOUND FALSE)
|
||||
FIND_PATH(UFCONFIG_INCLUDE_DIR NAMES UFconfig.h
|
||||
set(SUITESPARSE_CONFIG_FOUND FALSE)
|
||||
find_path(UFCONFIG_INCLUDE_DIR NAMES UFconfig.h
|
||||
PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
||||
IF (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
||||
MESSAGE(STATUS "Found UFconfig header in: ${UFCONFIG_INCLUDE_DIR}")
|
||||
SET(UFCONFIG_FOUND TRUE)
|
||||
ENDIF (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
||||
MARK_AS_ADVANCED(UFCONFIG_INCLUDE_DIR)
|
||||
ENDIF (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
if (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
||||
message(STATUS "Found UFconfig header in: ${UFCONFIG_INCLUDE_DIR}")
|
||||
set(UFCONFIG_FOUND TRUE)
|
||||
endif (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
||||
mark_as_advanced(UFCONFIG_INCLUDE_DIR)
|
||||
endif (EXISTS ${SUITESPARSE_CONFIG_LIBRARY} AND
|
||||
EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
|
||||
IF (NOT SUITESPARSE_CONFIG_FOUND AND
|
||||
if (NOT SUITESPARSE_CONFIG_FOUND AND
|
||||
NOT UFCONFIG_FOUND)
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
suitesparse_report_not_found(
|
||||
"Failed to find either: SuiteSparse_config header & library (should be "
|
||||
"present in all SuiteSparse >= v4 installs), or UFconfig header (should "
|
||||
"be present in all SuiteSparse < v4 installs).")
|
||||
ENDIF (NOT SUITESPARSE_CONFIG_FOUND AND
|
||||
endif (NOT SUITESPARSE_CONFIG_FOUND AND
|
||||
NOT UFCONFIG_FOUND)
|
||||
|
||||
# Extract the SuiteSparse version from the appropriate header (UFconfig.h for
|
||||
# <= v3, SuiteSparse_config.h for >= v4).
|
||||
LIST(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSE_VERSION)
|
||||
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSE_VERSION)
|
||||
|
||||
IF (UFCONFIG_FOUND)
|
||||
if (UFCONFIG_FOUND)
|
||||
# SuiteSparse version <= 3.
|
||||
SET(SUITESPARSE_VERSION_FILE ${UFCONFIG_INCLUDE_DIR}/UFconfig.h)
|
||||
IF (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
set(SUITESPARSE_VERSION_FILE ${UFCONFIG_INCLUDE_DIR}/UFconfig.h)
|
||||
if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
suitesparse_report_not_found(
|
||||
"Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
|
||||
"information for <= v3 SuiteSparse installs, but UFconfig was found "
|
||||
"(only present in <= v3 installs).")
|
||||
ELSE (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
FILE(READ ${SUITESPARSE_VERSION_FILE} UFCONFIG_CONTENTS)
|
||||
else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
file(READ ${SUITESPARSE_VERSION_FILE} UFCONFIG_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
|
||||
SUITESPARSE_MAIN_VERSION "${UFCONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
|
||||
SUITESPARSE_SUB_VERSION "${UFCONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
|
||||
SUITESPARSE_SUBSUB_VERSION "${UFCONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_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 4.;2.;1 nonsense.
|
||||
SET(SUITESPARSE_VERSION
|
||||
set(SUITESPARSE_VERSION
|
||||
"${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
|
||||
ENDIF (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
ENDIF (UFCONFIG_FOUND)
|
||||
endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
endif (UFCONFIG_FOUND)
|
||||
|
||||
IF (SUITESPARSE_CONFIG_FOUND)
|
||||
if (SUITESPARSE_CONFIG_FOUND)
|
||||
# SuiteSparse version >= 4.
|
||||
SET(SUITESPARSE_VERSION_FILE
|
||||
set(SUITESPARSE_VERSION_FILE
|
||||
${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h)
|
||||
IF (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
SUITESPARSE_REPORT_NOT_FOUND(
|
||||
if (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
suitesparse_report_not_found(
|
||||
"Could not find file: ${SUITESPARSE_VERSION_FILE} containing version "
|
||||
"information for >= v4 SuiteSparse installs, but SuiteSparse_config was "
|
||||
"found (only present in >= v4 installs).")
|
||||
ELSE (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
FILE(READ ${SUITESPARSE_VERSION_FILE} SUITESPARSE_CONFIG_CONTENTS)
|
||||
else (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
file(READ ${SUITESPARSE_VERSION_FILE} SUITESPARSE_CONFIG_CONTENTS)
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_MAIN_VERSION [0-9]+"
|
||||
SUITESPARSE_MAIN_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_MAIN_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_MAIN_VERSION "${SUITESPARSE_MAIN_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_SUB_VERSION [0-9]+"
|
||||
SUITESPARSE_SUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_SUB_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_SUB_VERSION "${SUITESPARSE_SUB_VERSION}")
|
||||
|
||||
STRING(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
|
||||
string(REGEX MATCH "#define SUITESPARSE_SUBSUB_VERSION [0-9]+"
|
||||
SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_CONFIG_CONTENTS}")
|
||||
STRING(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
|
||||
string(REGEX REPLACE "#define SUITESPARSE_SUBSUB_VERSION ([0-9]+)" "\\1"
|
||||
SUITESPARSE_SUBSUB_VERSION "${SUITESPARSE_SUBSUB_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 4.;2.;1 nonsense.
|
||||
SET(SUITESPARSE_VERSION
|
||||
set(SUITESPARSE_VERSION
|
||||
"${SUITESPARSE_MAIN_VERSION}.${SUITESPARSE_SUB_VERSION}.${SUITESPARSE_SUBSUB_VERSION}")
|
||||
ENDIF (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
ENDIF (SUITESPARSE_CONFIG_FOUND)
|
||||
endif (NOT EXISTS ${SUITESPARSE_VERSION_FILE})
|
||||
endif (SUITESPARSE_CONFIG_FOUND)
|
||||
|
||||
# METIS (Optional dependency).
|
||||
FIND_LIBRARY(METIS_LIBRARY NAMES metis
|
||||
find_library(METIS_LIBRARY NAMES metis
|
||||
PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
||||
IF (EXISTS ${METIS_LIBRARY})
|
||||
MESSAGE(STATUS "Found METIS library: ${METIS_LIBRARY}.")
|
||||
if (EXISTS ${METIS_LIBRARY})
|
||||
message(STATUS "Found METIS library: ${METIS_LIBRARY}.")
|
||||
set(METIS_FOUND TRUE)
|
||||
ELSE (EXISTS ${METIS_LIBRARY})
|
||||
MESSAGE(STATUS "Did not find METIS library (optional SuiteSparse dependency)")
|
||||
else (EXISTS ${METIS_LIBRARY})
|
||||
message(STATUS "Did not find METIS library (optional SuiteSparse dependency)")
|
||||
set(METIS_FOUND FALSE)
|
||||
ENDIF (EXISTS ${METIS_LIBRARY})
|
||||
MARK_AS_ADVANCED(METIS_LIBRARY)
|
||||
endif (EXISTS ${METIS_LIBRARY})
|
||||
mark_as_advanced(METIS_LIBRARY)
|
||||
|
||||
# Only mark SuiteSparse as found if all required components and dependencies
|
||||
# have been found.
|
||||
SET(SUITESPARSE_FOUND TRUE)
|
||||
FOREACH(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
|
||||
IF (NOT ${REQUIRED_VAR})
|
||||
SET(SUITESPARSE_FOUND FALSE)
|
||||
ENDIF (NOT ${REQUIRED_VAR})
|
||||
ENDFOREACH(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
|
||||
set(SUITESPARSE_FOUND TRUE)
|
||||
foreach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
|
||||
if (NOT ${REQUIRED_VAR})
|
||||
set(SUITESPARSE_FOUND FALSE)
|
||||
endif (NOT ${REQUIRED_VAR})
|
||||
endforeach(REQUIRED_VAR ${SUITESPARSE_FOUND_REQUIRED_VARS})
|
||||
|
||||
IF (SUITESPARSE_FOUND)
|
||||
LIST(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
if (SUITESPARSE_FOUND)
|
||||
list(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
${AMD_INCLUDE_DIR}
|
||||
${CAMD_INCLUDE_DIR}
|
||||
${COLAMD_INCLUDE_DIR}
|
||||
@@ -570,21 +570,21 @@ IF (SUITESPARSE_FOUND)
|
||||
${SUITESPARSEQR_INCLUDE_DIR})
|
||||
# Handle config separately, as otherwise at least one of them will be set
|
||||
# to NOTFOUND which would cause any check on SUITESPARSE_INCLUDE_DIRS to fail.
|
||||
IF (SUITESPARSE_CONFIG_FOUND)
|
||||
LIST(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
if (SUITESPARSE_CONFIG_FOUND)
|
||||
list(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
||||
ENDIF (SUITESPARSE_CONFIG_FOUND)
|
||||
IF (UFCONFIG_FOUND)
|
||||
LIST(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
endif (SUITESPARSE_CONFIG_FOUND)
|
||||
if (UFCONFIG_FOUND)
|
||||
list(APPEND SUITESPARSE_INCLUDE_DIRS
|
||||
${UFCONFIG_INCLUDE_DIR})
|
||||
ENDIF (UFCONFIG_FOUND)
|
||||
endif (UFCONFIG_FOUND)
|
||||
# As SuiteSparse includes are often all in the same directory, remove any
|
||||
# repetitions.
|
||||
LIST(REMOVE_DUPLICATES SUITESPARSE_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES SUITESPARSE_INCLUDE_DIRS)
|
||||
|
||||
# Important: The ordering of these libraries is *NOT* arbitrary, as these
|
||||
# could potentially be static libraries their link ordering is important.
|
||||
LIST(APPEND SUITESPARSE_LIBRARIES
|
||||
list(APPEND SUITESPARSE_LIBRARIES
|
||||
${SUITESPARSEQR_LIBRARY}
|
||||
${CHOLMOD_LIBRARY}
|
||||
${CCOLAMD_LIBRARY}
|
||||
@@ -593,59 +593,59 @@ IF (SUITESPARSE_FOUND)
|
||||
${AMD_LIBRARY}
|
||||
${LAPACK_LIBRARIES}
|
||||
${BLAS_LIBRARIES})
|
||||
IF (SUITESPARSE_CONFIG_FOUND)
|
||||
LIST(APPEND SUITESPARSE_LIBRARIES
|
||||
if (SUITESPARSE_CONFIG_FOUND)
|
||||
list(APPEND SUITESPARSE_LIBRARIES
|
||||
${SUITESPARSE_CONFIG_LIBRARY})
|
||||
ENDIF (SUITESPARSE_CONFIG_FOUND)
|
||||
IF (METIS_FOUND)
|
||||
LIST(APPEND SUITESPARSE_LIBRARIES
|
||||
endif (SUITESPARSE_CONFIG_FOUND)
|
||||
if (METIS_FOUND)
|
||||
list(APPEND SUITESPARSE_LIBRARIES
|
||||
${METIS_LIBRARY})
|
||||
ENDIF (METIS_FOUND)
|
||||
ENDIF()
|
||||
endif (METIS_FOUND)
|
||||
endif()
|
||||
|
||||
# Determine if we are running on Ubuntu with the package install of SuiteSparse
|
||||
# which is broken and does not support linking a shared library.
|
||||
SET(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION FALSE)
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION FALSE)
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
|
||||
FIND_PROGRAM(LSB_RELEASE_EXECUTABLE lsb_release)
|
||||
IF (LSB_RELEASE_EXECUTABLE)
|
||||
find_program(LSB_RELEASE_EXECUTABLE lsb_release)
|
||||
if (LSB_RELEASE_EXECUTABLE)
|
||||
# Any even moderately recent Ubuntu release (likely to be affected by
|
||||
# this bug) should have lsb_release, if it isn't present we are likely
|
||||
# on a different Linux distribution (should be fine).
|
||||
|
||||
EXECUTE_PROCESS(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
|
||||
execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -si
|
||||
OUTPUT_VARIABLE LSB_DISTRIBUTOR_ID
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
IF (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
|
||||
if (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
|
||||
SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
|
||||
# We are on Ubuntu, and the SuiteSparse version matches the broken
|
||||
# system install version and is a system install.
|
||||
SET(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION TRUE)
|
||||
MESSAGE(STATUS "Found system install of SuiteSparse "
|
||||
set(SUITESPARSE_IS_BROKEN_SHARED_LINKING_UBUNTU_SYSTEM_VERSION TRUE)
|
||||
message(STATUS "Found system install of SuiteSparse "
|
||||
"${SUITESPARSE_VERSION} running on Ubuntu, which has a known bug "
|
||||
"preventing linking of shared libraries (static linking unaffected).")
|
||||
ENDIF (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
|
||||
endif (LSB_DISTRIBUTOR_ID MATCHES "Ubuntu" AND
|
||||
SUITESPARSE_LIBRARIES MATCHES "/usr/lib/libamd")
|
||||
ENDIF (LSB_RELEASE_EXECUTABLE)
|
||||
ENDIF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
endif (LSB_RELEASE_EXECUTABLE)
|
||||
endif (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
SUITESPARSE_VERSION VERSION_EQUAL 3.4.0)
|
||||
|
||||
SUITESPARSE_RESET_FIND_LIBRARY_PREFIX()
|
||||
suitesparse_reset_find_library_prefix()
|
||||
|
||||
# Handle REQUIRED and QUIET arguments to FIND_PACKAGE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
IF (SUITESPARSE_FOUND)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SuiteSparse
|
||||
include(FindPackageHandleStandardArgs)
|
||||
if (SUITESPARSE_FOUND)
|
||||
find_package_handle_standard_args(SuiteSparse
|
||||
REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
|
||||
VERSION_VAR SUITESPARSE_VERSION
|
||||
FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
|
||||
ELSE (SUITESPARSE_FOUND)
|
||||
else (SUITESPARSE_FOUND)
|
||||
# Do not pass VERSION_VAR to FindPackageHandleStandardArgs() if we failed to
|
||||
# find SuiteSparse to avoid a confusing autogenerated failure message
|
||||
# that states 'not found (missing: FOO) (found version: x.y.z)'.
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SuiteSparse
|
||||
find_package_handle_standard_args(SuiteSparse
|
||||
REQUIRED_VARS ${SUITESPARSE_FOUND_REQUIRED_VARS}
|
||||
FAIL_MESSAGE "Failed to find some/all required components of SuiteSparse.")
|
||||
ENDIF (SUITESPARSE_FOUND)
|
||||
endif (SUITESPARSE_FOUND)
|
||||
|
||||
@@ -37,58 +37,58 @@
|
||||
# HAVE_UNORDERED_MAP_IN_STD_NAMESPACE: Use <unordered_map> & std.
|
||||
# HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE: Use <unordered_map> & std::tr1.
|
||||
# HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE: <tr1/unordered_map> & std::tr1.
|
||||
MACRO(FIND_UNORDERED_MAP)
|
||||
macro(FIND_UNORDERED_MAP)
|
||||
# To support CXX11 option, clear the results of all check_xxx() functions
|
||||
# s/t we always perform the checks each time, otherwise CMake fails to
|
||||
# detect that the tests should be performed again after CXX11 is toggled.
|
||||
UNSET(HAVE_STD_UNORDERED_MAP_HEADER CACHE)
|
||||
UNSET(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE CACHE)
|
||||
UNSET(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE CACHE)
|
||||
UNSET(HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE CACHE)
|
||||
unset(HAVE_STD_UNORDERED_MAP_HEADER CACHE)
|
||||
unset(HAVE_UNORDERED_MAP_IN_STD_NAMESPACE CACHE)
|
||||
unset(HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE CACHE)
|
||||
unset(HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE CACHE)
|
||||
|
||||
SET(UNORDERED_MAP_FOUND FALSE)
|
||||
INCLUDE(CheckIncludeFileCXX)
|
||||
CHECK_INCLUDE_FILE_CXX(unordered_map HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
IF (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
set(UNORDERED_MAP_FOUND FALSE)
|
||||
include(CheckIncludeFileCXX)
|
||||
check_include_file_cxx(unordered_map HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
if (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
# Finding the unordered_map header doesn't mean that unordered_map
|
||||
# is in std namespace.
|
||||
#
|
||||
# In particular, MSVC 2008 has unordered_map declared in std::tr1.
|
||||
# In order to support this, we do an extra check to see which
|
||||
# namespace should be used.
|
||||
INCLUDE(CheckCXXSourceCompiles)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("#include <unordered_map>
|
||||
int main() {
|
||||
std::unordered_map<int, int> map;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
IF (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
SET(UNORDERED_MAP_FOUND TRUE)
|
||||
MESSAGE("-- Found unordered_map/set in std namespace.")
|
||||
ELSE (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
CHECK_CXX_SOURCE_COMPILES("#include <unordered_map>
|
||||
if (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
set(UNORDERED_MAP_FOUND TRUE)
|
||||
message("-- Found unordered_map/set in std namespace.")
|
||||
else (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
check_cxx_source_compiles("#include <unordered_map>
|
||||
int main() {
|
||||
std::tr1::unordered_map<int, int> map;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
IF (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
SET(UNORDERED_MAP_FOUND TRUE)
|
||||
MESSAGE("-- Found unordered_map/set in std::tr1 namespace.")
|
||||
ELSE (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
MESSAGE("-- Found <unordered_map> but cannot find either "
|
||||
if (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
set(UNORDERED_MAP_FOUND TRUE)
|
||||
message("-- Found unordered_map/set in std::tr1 namespace.")
|
||||
else (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
message("-- Found <unordered_map> but cannot find either "
|
||||
"std::unordered_map or std::tr1::unordered_map.")
|
||||
ENDIF (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
ENDIF (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
ELSE (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
CHECK_INCLUDE_FILE_CXX("tr1/unordered_map"
|
||||
endif (HAVE_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
endif (HAVE_UNORDERED_MAP_IN_STD_NAMESPACE)
|
||||
else (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
check_include_file_cxx("tr1/unordered_map"
|
||||
HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
IF (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
SET(UNORDERED_MAP_FOUND TRUE)
|
||||
MESSAGE("-- Found tr1/unordered_map/set in std::tr1 namespace.")
|
||||
ELSE (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
MESSAGE("-- Unable to find <unordered_map> or <tr1/unordered_map>.")
|
||||
ENDIF (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
ENDIF (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
ENDMACRO(FIND_UNORDERED_MAP)
|
||||
if (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
set(UNORDERED_MAP_FOUND TRUE)
|
||||
message("-- Found tr1/unordered_map/set in std::tr1 namespace.")
|
||||
else (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
message("-- Unable to find <unordered_map> or <tr1/unordered_map>.")
|
||||
endif (HAVE_TR1_UNORDERED_MAP_IN_TR1_NAMESPACE)
|
||||
endif (HAVE_STD_UNORDERED_MAP_HEADER)
|
||||
endmacro(FIND_UNORDERED_MAP)
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
# This function automates this process by getting the current help string
|
||||
# for the cache variable to update, then reinitialising it with the new
|
||||
# value, but with the original help string.
|
||||
FUNCTION(UPDATE_CACHE_VARIABLE VAR_NAME VALUE)
|
||||
GET_PROPERTY(HELP_STRING CACHE ${VAR_NAME} PROPERTY HELPSTRING)
|
||||
GET_PROPERTY(VAR_TYPE CACHE ${VAR_NAME} PROPERTY TYPE)
|
||||
SET(${VAR_NAME} ${VALUE} CACHE ${VAR_TYPE} "${HELP_STRING}" FORCE)
|
||||
ENDFUNCTION()
|
||||
function(UPDATE_CACHE_VARIABLE VAR_NAME VALUE)
|
||||
get_property(HELP_STRING CACHE ${VAR_NAME} PROPERTY HELPSTRING)
|
||||
get_property(VAR_TYPE CACHE ${VAR_NAME} PROPERTY TYPE)
|
||||
set(${VAR_NAME} ${VALUE} CACHE ${VAR_TYPE} "${HELP_STRING}" FORCE)
|
||||
endfunction()
|
||||
|
||||
+39
-39
@@ -29,69 +29,69 @@
|
||||
# Author: arnaudgelas@gmail.com (Arnaud Gelas)
|
||||
# alexs.mac@gmail.com (Alex Stewart)
|
||||
|
||||
IF (COMMAND cmake_policy)
|
||||
if (COMMAND cmake_policy)
|
||||
# Ignore empty elements in LIST() commands.
|
||||
CMAKE_POLICY(SET CMP0007 OLD)
|
||||
ENDIF (COMMAND cmake_policy)
|
||||
cmake_policy(SET CMP0007 OLD)
|
||||
endif (COMMAND cmake_policy)
|
||||
|
||||
IF (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
MESSAGE(FATAL_ERROR "Cannot find install manifest: "
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: "
|
||||
"\"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
ENDIF (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
endif (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" INSTALL_MANIFEST)
|
||||
STRING(REGEX REPLACE "\n" ";" INSTALL_MANIFEST "${INSTALL_MANIFEST}")
|
||||
LIST(REVERSE INSTALL_MANIFEST)
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" INSTALL_MANIFEST)
|
||||
string(REGEX REPLACE "\n" ";" INSTALL_MANIFEST "${INSTALL_MANIFEST}")
|
||||
list(REVERSE INSTALL_MANIFEST)
|
||||
|
||||
FOREACH (INSTALLED_FILE ${INSTALL_MANIFEST})
|
||||
foreach (INSTALLED_FILE ${INSTALL_MANIFEST})
|
||||
# Save the root ceres include install directory, e.g. /usr/local/include/ceres
|
||||
# so that we can remove it at the end.
|
||||
IF (NOT CERES_INCLUDE_INSTALL_ROOT)
|
||||
GET_FILENAME_COMPONENT(FILE_NAME ${INSTALLED_FILE} NAME)
|
||||
IF (FILE_NAME STREQUAL ceres.h)
|
||||
if (NOT CERES_INCLUDE_INSTALL_ROOT)
|
||||
get_filename_component(FILE_NAME ${INSTALLED_FILE} NAME)
|
||||
if (FILE_NAME STREQUAL ceres.h)
|
||||
# Ensure that the directory is nested as we expect, as we are going to
|
||||
# remove it, and we do not want to remove files pertaining to anyone else.
|
||||
GET_FILENAME_COMPONENT(PARENT_DIR ${INSTALLED_FILE} PATH)
|
||||
GET_FILENAME_COMPONENT(PARENT_DIR_NAME ${PARENT_DIR} NAME)
|
||||
IF (PARENT_DIR_NAME STREQUAL ceres AND IS_DIRECTORY ${PARENT_DIR})
|
||||
SET(CERES_INCLUDE_INSTALL_ROOT ${PARENT_DIR})
|
||||
ENDIF (PARENT_DIR_NAME STREQUAL ceres AND IS_DIRECTORY ${PARENT_DIR})
|
||||
ENDIF (FILE_NAME STREQUAL ceres.h)
|
||||
ENDIF (NOT CERES_INCLUDE_INSTALL_ROOT)
|
||||
get_filename_component(PARENT_DIR ${INSTALLED_FILE} PATH)
|
||||
get_filename_component(PARENT_DIR_NAME ${PARENT_DIR} NAME)
|
||||
if (PARENT_DIR_NAME STREQUAL ceres AND IS_DIRECTORY ${PARENT_DIR})
|
||||
set(CERES_INCLUDE_INSTALL_ROOT ${PARENT_DIR})
|
||||
endif (PARENT_DIR_NAME STREQUAL ceres AND IS_DIRECTORY ${PARENT_DIR})
|
||||
endif (FILE_NAME STREQUAL ceres.h)
|
||||
endif (NOT CERES_INCLUDE_INSTALL_ROOT)
|
||||
|
||||
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${INSTALLED_FILE}\"")
|
||||
IF (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
EXECUTE_PROCESS(COMMAND @CMAKE_COMMAND@
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${INSTALLED_FILE}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
execute_process(COMMAND @CMAKE_COMMAND@
|
||||
-E remove "$ENV{DESTDIR}${INSTALLED_FILE}"
|
||||
OUTPUT_VARIABLE RM_OUT
|
||||
RESULT_VARIABLE RM_RETVAL)
|
||||
IF (NOT ${RM_RETVAL} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR
|
||||
if (NOT ${RM_RETVAL} EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Problem when removing \"$ENV{DESTDIR}${INSTALLED_FILE}\"")
|
||||
ENDIF (NOT ${RM_RETVAL} EQUAL 0)
|
||||
ELSE (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
MESSAGE(STATUS "File \"$ENV{DESTDIR}${INSTALLED_FILE}\" does not exist.")
|
||||
ENDIF (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
ENDFOREACH(INSTALLED_FILE)
|
||||
endif (NOT ${RM_RETVAL} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${INSTALLED_FILE}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${INSTALLED_FILE}")
|
||||
endforeach(INSTALLED_FILE)
|
||||
|
||||
# Removing Ceres include install directory.
|
||||
IF (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
if (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
EXISTS ${CERES_INCLUDE_INSTALL_ROOT})
|
||||
MESSAGE(STATUS "Removing Ceres include install directory: "
|
||||
message(STATUS "Removing Ceres include install directory: "
|
||||
"\"$ENV{DESTDIR}${CERES_INCLUDE_INSTALL_ROOT}\"")
|
||||
EXECUTE_PROCESS(COMMAND @CMAKE_COMMAND@
|
||||
execute_process(COMMAND @CMAKE_COMMAND@
|
||||
-E remove_directory
|
||||
"$ENV{DESTDIR}${CERES_INCLUDE_INSTALL_ROOT}"
|
||||
OUTPUT_VARIABLE RM_OUT
|
||||
RESULT_VARIABLE RM_RETVAL)
|
||||
IF (NOT ${RM_RETVAL} EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR
|
||||
if (NOT ${RM_RETVAL} EQUAL 0)
|
||||
message(FATAL_ERROR
|
||||
"Failed to remove: \"$ENV{DESTDIR}${CERES_INCLUDE_INSTALL_ROOT\"")
|
||||
ENDIF (NOT ${RM_RETVAL} EQUAL 0)
|
||||
ELSE (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
endif (NOT ${RM_RETVAL} EQUAL 0)
|
||||
else (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
EXISTS ${CERES_INCLUDE_INSTALL_ROOT})
|
||||
MESSAGE(FATAL_ERROR "Failed to find Ceres installed include directory "
|
||||
message(FATAL_ERROR "Failed to find Ceres installed include directory "
|
||||
"(e.g. /usr/local/include/ceres), candidate: "
|
||||
"\"$ENV{DESTDIR}${CERES_INCLUDE_INSTALL_ROOT}\"")
|
||||
ENDIF (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
endif (CERES_INCLUDE_INSTALL_ROOT AND
|
||||
EXISTS ${CERES_INCLUDE_INSTALL_ROOT})
|
||||
|
||||
+1
-1
@@ -26,4 +26,4 @@
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
ADD_SUBDIRECTORY(source)
|
||||
add_subdirectory(source)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
FIND_PACKAGE(Sphinx REQUIRED)
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
# HTML output directory
|
||||
SET(SPHINX_HTML_DIR "${CMAKE_BINARY_DIR}/docs/html")
|
||||
set(SPHINX_HTML_DIR "${CMAKE_BINARY_DIR}/docs/html")
|
||||
|
||||
# Install documentation
|
||||
INSTALL(DIRECTORY ${SPHINX_HTML_DIR}
|
||||
install(DIRECTORY ${SPHINX_HTML_DIR}
|
||||
DESTINATION share/doc/ceres
|
||||
COMPONENT Doc
|
||||
PATTERN "${SPHINX_HTML_DIR}/*")
|
||||
|
||||
# Building using 'make_docs.py' python script
|
||||
ADD_CUSTOM_TARGET(ceres_docs ALL
|
||||
add_custom_target(ceres_docs ALL
|
||||
python
|
||||
"${CMAKE_SOURCE_DIR}/scripts/make_docs.py"
|
||||
"${CMAKE_SOURCE_DIR}"
|
||||
|
||||
+48
-48
@@ -31,88 +31,88 @@
|
||||
# Only Ceres itself should be compiled with CERES_BUILDING_SHARED_LIBRARY
|
||||
# defined, any users of Ceres will have CERES_USING_SHARED_LIBRARY defined
|
||||
# for them in Ceres' config.h if appropriate.
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
REMOVE_DEFINITIONS(-DCERES_BUILDING_SHARED_LIBRARY)
|
||||
ENDIF()
|
||||
if (BUILD_SHARED_LIBS)
|
||||
remove_definitions(-DCERES_BUILDING_SHARED_LIBRARY)
|
||||
endif()
|
||||
|
||||
ADD_EXECUTABLE(helloworld helloworld.cc)
|
||||
TARGET_LINK_LIBRARIES(helloworld ceres)
|
||||
add_executable(helloworld helloworld.cc)
|
||||
target_link_libraries(helloworld ceres)
|
||||
|
||||
ADD_EXECUTABLE(helloworld_numeric_diff helloworld_numeric_diff.cc)
|
||||
TARGET_LINK_LIBRARIES(helloworld_numeric_diff ceres)
|
||||
add_executable(helloworld_numeric_diff helloworld_numeric_diff.cc)
|
||||
target_link_libraries(helloworld_numeric_diff ceres)
|
||||
|
||||
ADD_EXECUTABLE(helloworld_analytic_diff helloworld_analytic_diff.cc)
|
||||
TARGET_LINK_LIBRARIES(helloworld_analytic_diff ceres)
|
||||
add_executable(helloworld_analytic_diff helloworld_analytic_diff.cc)
|
||||
target_link_libraries(helloworld_analytic_diff ceres)
|
||||
|
||||
ADD_EXECUTABLE(curve_fitting curve_fitting.cc)
|
||||
TARGET_LINK_LIBRARIES(curve_fitting ceres)
|
||||
add_executable(curve_fitting curve_fitting.cc)
|
||||
target_link_libraries(curve_fitting ceres)
|
||||
|
||||
ADD_EXECUTABLE(rosenbrock rosenbrock.cc)
|
||||
TARGET_LINK_LIBRARIES(rosenbrock ceres)
|
||||
add_executable(rosenbrock rosenbrock.cc)
|
||||
target_link_libraries(rosenbrock ceres)
|
||||
|
||||
ADD_EXECUTABLE(curve_fitting_c curve_fitting.c)
|
||||
TARGET_LINK_LIBRARIES(curve_fitting_c ceres)
|
||||
add_executable(curve_fitting_c curve_fitting.c)
|
||||
target_link_libraries(curve_fitting_c ceres)
|
||||
# Force CMake to link curve_fitting_c using the C linker, this is important
|
||||
# when Ceres was compiled using C++11 to ensure that -std=c++11 is not passed
|
||||
# through.
|
||||
SET_TARGET_PROPERTIES(curve_fitting_c PROPERTIES LINKER_LANGUAGE C)
|
||||
set_target_properties(curve_fitting_c PROPERTIES LINKER_LANGUAGE C)
|
||||
# As this is a C file #including <math.h> we have to explicitly add the math
|
||||
# library (libm). Although some compilers (dependent upon options) will accept
|
||||
# the indirect link to libm via Ceres, at least GCC 4.8 on pure Debian won't.
|
||||
IF (NOT MSVC)
|
||||
TARGET_LINK_LIBRARIES(curve_fitting_c m)
|
||||
ENDIF (NOT MSVC)
|
||||
if (NOT MSVC)
|
||||
target_link_libraries(curve_fitting_c m)
|
||||
endif (NOT MSVC)
|
||||
|
||||
ADD_EXECUTABLE(ellipse_approximation ellipse_approximation.cc)
|
||||
TARGET_LINK_LIBRARIES(ellipse_approximation ceres)
|
||||
add_executable(ellipse_approximation ellipse_approximation.cc)
|
||||
target_link_libraries(ellipse_approximation ceres)
|
||||
|
||||
ADD_EXECUTABLE(robust_curve_fitting robust_curve_fitting.cc)
|
||||
TARGET_LINK_LIBRARIES(robust_curve_fitting ceres)
|
||||
add_executable(robust_curve_fitting robust_curve_fitting.cc)
|
||||
target_link_libraries(robust_curve_fitting ceres)
|
||||
|
||||
ADD_EXECUTABLE(simple_bundle_adjuster simple_bundle_adjuster.cc)
|
||||
TARGET_LINK_LIBRARIES(simple_bundle_adjuster ceres)
|
||||
add_executable(simple_bundle_adjuster simple_bundle_adjuster.cc)
|
||||
target_link_libraries(simple_bundle_adjuster ceres)
|
||||
|
||||
ADD_EXECUTABLE(sampled_function sampled_function.cc)
|
||||
TARGET_LINK_LIBRARIES(sampled_function ceres)
|
||||
add_executable(sampled_function sampled_function.cc)
|
||||
target_link_libraries(sampled_function ceres)
|
||||
|
||||
IF (GFLAGS)
|
||||
if (GFLAGS)
|
||||
# The CERES_GFLAGS_NAMESPACE compile definition is NOT stored in
|
||||
# CERES_COMPILE_OPTIONS (and thus config.h) as Ceres itself does not
|
||||
# require gflags, only the tests and examples do.
|
||||
ADD_DEFINITIONS(-DCERES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
add_definitions(-DCERES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
|
||||
ADD_EXECUTABLE(powell powell.cc)
|
||||
TARGET_LINK_LIBRARIES(powell ceres ${GFLAGS_LIBRARIES})
|
||||
add_executable(powell powell.cc)
|
||||
target_link_libraries(powell ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(nist nist.cc)
|
||||
TARGET_LINK_LIBRARIES(nist ceres ${GFLAGS_LIBRARIES})
|
||||
add_executable(nist nist.cc)
|
||||
target_link_libraries(nist ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(more_garbow_hillstrom more_garbow_hillstrom.cc)
|
||||
TARGET_LINK_LIBRARIES(more_garbow_hillstrom ceres ${GFLAGS_LIBRARIES})
|
||||
add_executable(more_garbow_hillstrom more_garbow_hillstrom.cc)
|
||||
target_link_libraries(more_garbow_hillstrom ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(circle_fit circle_fit.cc)
|
||||
TARGET_LINK_LIBRARIES(circle_fit ceres ${GFLAGS_LIBRARIES})
|
||||
add_executable(circle_fit circle_fit.cc)
|
||||
target_link_libraries(circle_fit ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(bundle_adjuster
|
||||
add_executable(bundle_adjuster
|
||||
bundle_adjuster.cc
|
||||
bal_problem.cc)
|
||||
TARGET_LINK_LIBRARIES(bundle_adjuster ceres ${GFLAGS_LIBRARIES})
|
||||
target_link_libraries(bundle_adjuster ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(libmv_bundle_adjuster
|
||||
add_executable(libmv_bundle_adjuster
|
||||
libmv_bundle_adjuster.cc)
|
||||
TARGET_LINK_LIBRARIES(libmv_bundle_adjuster ceres ${GFLAGS_LIBRARIES})
|
||||
target_link_libraries(libmv_bundle_adjuster ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(libmv_homography
|
||||
add_executable(libmv_homography
|
||||
libmv_homography.cc)
|
||||
TARGET_LINK_LIBRARIES(libmv_homography ceres ${GFLAGS_LIBRARIES})
|
||||
target_link_libraries(libmv_homography ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(denoising
|
||||
add_executable(denoising
|
||||
denoising.cc
|
||||
fields_of_experts.cc)
|
||||
TARGET_LINK_LIBRARIES(denoising ceres ${GFLAGS_LIBRARIES})
|
||||
target_link_libraries(denoising ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ADD_EXECUTABLE(robot_pose_mle
|
||||
add_executable(robot_pose_mle
|
||||
robot_pose_mle.cc)
|
||||
TARGET_LINK_LIBRARIES(robot_pose_mle ceres ${GFLAGS_LIBRARIES})
|
||||
target_link_libraries(robot_pose_mle ceres ${GFLAGS_LIBRARIES})
|
||||
|
||||
ENDIF (GFLAGS)
|
||||
endif (GFLAGS)
|
||||
|
||||
+136
-136
@@ -28,7 +28,7 @@
|
||||
#
|
||||
# Author: keir@google.com (Keir Mierle)
|
||||
|
||||
SET(CERES_INTERNAL_SRC
|
||||
set(CERES_INTERNAL_SRC
|
||||
array_utils.cc
|
||||
blas.cc
|
||||
block_evaluate_preparer.cc
|
||||
@@ -119,216 +119,216 @@ SET(CERES_INTERNAL_SRC
|
||||
# install native libraries to lib64 rather than lib. Most distros seem to
|
||||
# follow this convention with a couple notable exceptions (Debian-based and
|
||||
# Arch-based distros) which we try to detect here.
|
||||
IF (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
if (CMAKE_SYSTEM_NAME MATCHES "Linux" AND
|
||||
NOT DEFINED LIB_SUFFIX AND
|
||||
NOT CMAKE_CROSSCOMPILING AND
|
||||
CMAKE_SIZEOF_VOID_P EQUAL "8" AND
|
||||
NOT EXISTS "/etc/debian_version" AND
|
||||
NOT EXISTS "/etc/arch-release")
|
||||
SET(LIB_SUFFIX "64")
|
||||
ENDIF ()
|
||||
set(LIB_SUFFIX "64")
|
||||
endif ()
|
||||
|
||||
# Also depend on the header files so that they appear in IDEs.
|
||||
FILE(GLOB CERES_INTERNAL_HDRS *.h)
|
||||
file(GLOB CERES_INTERNAL_HDRS *.h)
|
||||
|
||||
# Include the specialized schur solvers.
|
||||
IF (SCHUR_SPECIALIZATIONS)
|
||||
FILE(GLOB CERES_INTERNAL_SCHUR_FILES generated/*.cc)
|
||||
ELSE (SCHUR_SPECIALIZATIONS)
|
||||
if (SCHUR_SPECIALIZATIONS)
|
||||
file(GLOB CERES_INTERNAL_SCHUR_FILES generated/*.cc)
|
||||
else (SCHUR_SPECIALIZATIONS)
|
||||
# Only the fully dynamic solver. The build is much faster this way.
|
||||
FILE(GLOB CERES_INTERNAL_SCHUR_FILES generated/*_d_d_d.cc)
|
||||
ENDIF (SCHUR_SPECIALIZATIONS)
|
||||
file(GLOB CERES_INTERNAL_SCHUR_FILES generated/*_d_d_d.cc)
|
||||
endif (SCHUR_SPECIALIZATIONS)
|
||||
|
||||
# Build the list of dependencies for Ceres based on the current configuration.
|
||||
IF (NOT MINIGLOG AND GLOG_FOUND)
|
||||
LIST(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES})
|
||||
ENDIF (NOT MINIGLOG AND GLOG_FOUND)
|
||||
if (NOT MINIGLOG AND GLOG_FOUND)
|
||||
list(APPEND CERES_LIBRARY_PUBLIC_DEPENDENCIES ${GLOG_LIBRARIES})
|
||||
endif (NOT MINIGLOG AND GLOG_FOUND)
|
||||
|
||||
IF (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
if (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
# Define version information for use in Solver::FullReport.
|
||||
ADD_DEFINITIONS(-DCERES_SUITESPARSE_VERSION="${SUITESPARSE_VERSION}")
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${SUITESPARSE_LIBRARIES})
|
||||
ENDIF (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
add_definitions(-DCERES_SUITESPARSE_VERSION="${SUITESPARSE_VERSION}")
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${SUITESPARSE_LIBRARIES})
|
||||
endif (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
|
||||
IF (CXSPARSE AND CXSPARSE_FOUND)
|
||||
if (CXSPARSE AND CXSPARSE_FOUND)
|
||||
# Define version information for use in Solver::FullReport.
|
||||
ADD_DEFINITIONS(-DCERES_CXSPARSE_VERSION="${CXSPARSE_VERSION}")
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CXSPARSE_LIBRARIES})
|
||||
ENDIF (CXSPARSE AND CXSPARSE_FOUND)
|
||||
add_definitions(-DCERES_CXSPARSE_VERSION="${CXSPARSE_VERSION}")
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CXSPARSE_LIBRARIES})
|
||||
endif (CXSPARSE AND CXSPARSE_FOUND)
|
||||
|
||||
IF (BLAS_FOUND AND LAPACK_FOUND)
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${LAPACK_LIBRARIES})
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${BLAS_LIBRARIES})
|
||||
ENDIF (BLAS_FOUND AND LAPACK_FOUND)
|
||||
if (BLAS_FOUND AND LAPACK_FOUND)
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${LAPACK_LIBRARIES})
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${BLAS_LIBRARIES})
|
||||
endif (BLAS_FOUND AND LAPACK_FOUND)
|
||||
|
||||
IF (OPENMP_FOUND)
|
||||
IF (NOT MSVC)
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES gomp)
|
||||
LIST(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
ENDIF (NOT MSVC)
|
||||
ENDIF (OPENMP_FOUND)
|
||||
if (OPENMP_FOUND)
|
||||
if (NOT MSVC)
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES gomp)
|
||||
list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif (NOT MSVC)
|
||||
endif (OPENMP_FOUND)
|
||||
|
||||
SET(CERES_LIBRARY_SOURCE
|
||||
set(CERES_LIBRARY_SOURCE
|
||||
${CERES_INTERNAL_SRC}
|
||||
${CERES_INTERNAL_HDRS}
|
||||
${CERES_INTERNAL_SCHUR_FILES})
|
||||
|
||||
# Primarily for Android, but optionally for others, compile the minimal
|
||||
# glog implementation into Ceres.
|
||||
IF (MINIGLOG)
|
||||
LIST(APPEND CERES_LIBRARY_SOURCE miniglog/glog/logging.cc)
|
||||
ENDIF (MINIGLOG)
|
||||
if (MINIGLOG)
|
||||
list(APPEND CERES_LIBRARY_SOURCE miniglog/glog/logging.cc)
|
||||
endif (MINIGLOG)
|
||||
|
||||
ADD_LIBRARY(ceres ${CERES_LIBRARY_SOURCE})
|
||||
SET_TARGET_PROPERTIES(ceres PROPERTIES
|
||||
add_library(ceres ${CERES_LIBRARY_SOURCE})
|
||||
set_target_properties(ceres PROPERTIES
|
||||
VERSION ${CERES_VERSION}
|
||||
SOVERSION ${CERES_VERSION_MAJOR}
|
||||
)
|
||||
IF (CXX11 AND COMPILER_HAS_CXX11_FLAG)
|
||||
IF (CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
MESSAGE("-- Warning: detected CMake version: ${CMAKE_VERSION} < 2.8.12, "
|
||||
if (CXX11 AND COMPILER_HAS_CXX11_FLAG)
|
||||
if (CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
message("-- Warning: detected CMake version: ${CMAKE_VERSION} < 2.8.12, "
|
||||
"which is the minimum required for compile options to be included in an "
|
||||
"exported CMake target, but CERES_USE_CXX11 is enabled and the detected. "
|
||||
"compiler requires -std=c++11. The client is responsible for adding "
|
||||
"-std=c++11 when using Ceres.")
|
||||
ELSE ()
|
||||
else ()
|
||||
# If Ceres is compiled using C++11, and the compiler requires -std=c++11
|
||||
# to be set, then ensure that this requirement is rolled into the exported
|
||||
# CMake target, s/t client code which uses Ceres will inherit it (if the
|
||||
# CMake version supports it), iff they are NOT compiling for C. We check
|
||||
# for not C, rather than C++ as LINKER_LANGUAGE is often NOTFOUND and then
|
||||
# uses the default (C++).
|
||||
TARGET_COMPILE_OPTIONS(ceres PUBLIC
|
||||
target_compile_options(ceres PUBLIC
|
||||
$<$<NOT:$<STREQUAL:$<TARGET_PROPERTY:LINKER_LANGUAGE>,C>>:-std=c++11>)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
IF (BUILD_SHARED_LIBS)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
# When building a shared library, mark all external libraries as
|
||||
# PRIVATE so they don't show up as a dependency.
|
||||
TARGET_LINK_LIBRARIES(ceres
|
||||
target_link_libraries(ceres
|
||||
LINK_PUBLIC ${CERES_LIBRARY_PUBLIC_DEPENDENCIES}
|
||||
LINK_PRIVATE ${CERES_LIBRARY_PRIVATE_DEPENDENCIES})
|
||||
ELSE (BUILD_SHARED_LIBS)
|
||||
else (BUILD_SHARED_LIBS)
|
||||
# When building a static library, all external libraries are
|
||||
# PUBLIC(default) since the user needs to link to them.
|
||||
# They will be listed in CeresTargets.cmake.
|
||||
SET(CERES_LIBRARY_DEPENDENCIES
|
||||
set(CERES_LIBRARY_DEPENDENCIES
|
||||
${CERES_LIBRARY_PUBLIC_DEPENDENCIES}
|
||||
${CERES_LIBRARY_PRIVATE_DEPENDENCIES})
|
||||
TARGET_LINK_LIBRARIES(ceres ${CERES_LIBRARY_DEPENDENCIES})
|
||||
ENDIF (BUILD_SHARED_LIBS)
|
||||
target_link_libraries(ceres ${CERES_LIBRARY_DEPENDENCIES})
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
|
||||
INSTALL(TARGETS ceres
|
||||
install(TARGETS ceres
|
||||
EXPORT CeresExport
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||
ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
||||
|
||||
IF (BUILD_TESTING AND GFLAGS)
|
||||
if (BUILD_TESTING AND GFLAGS)
|
||||
# The CERES_GFLAGS_NAMESPACE compile definition is NOT stored in
|
||||
# CERES_COMPILE_OPTIONS (and thus config.h) as Ceres itself does not
|
||||
# require gflags, only the tests and examples do.
|
||||
ADD_DEFINITIONS(-DCERES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
add_definitions(-DCERES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||
|
||||
ADD_LIBRARY(gtest gmock_gtest_all.cc gmock_main.cc)
|
||||
ADD_LIBRARY(test_util
|
||||
add_library(gtest gmock_gtest_all.cc gmock_main.cc)
|
||||
add_library(test_util
|
||||
evaluator_test_utils.cc
|
||||
numeric_diff_test_utils.cc
|
||||
test_util.cc)
|
||||
|
||||
IF (MINIGLOG)
|
||||
if (MINIGLOG)
|
||||
# When using miniglog, it is compiled into Ceres, thus Ceres becomes
|
||||
# the library against which other libraries should link for logging.
|
||||
TARGET_LINK_LIBRARIES(gtest ${GFLAGS_LIBRARIES} ceres)
|
||||
TARGET_LINK_LIBRARIES(test_util ceres gtest)
|
||||
ELSE (MINIGLOG)
|
||||
TARGET_LINK_LIBRARIES(gtest ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES})
|
||||
TARGET_LINK_LIBRARIES(test_util ceres gtest ${GLOG_LIBRARIES})
|
||||
ENDIF (MINIGLOG)
|
||||
target_link_libraries(gtest ${GFLAGS_LIBRARIES} ceres)
|
||||
target_link_libraries(test_util ceres gtest)
|
||||
else (MINIGLOG)
|
||||
target_link_libraries(gtest ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES})
|
||||
target_link_libraries(test_util ceres gtest ${GLOG_LIBRARIES})
|
||||
endif (MINIGLOG)
|
||||
|
||||
MACRO (CERES_TEST NAME)
|
||||
ADD_EXECUTABLE(${NAME}_test ${NAME}_test.cc)
|
||||
TARGET_LINK_LIBRARIES(${NAME}_test test_util ceres gtest)
|
||||
ADD_TEST(NAME ${NAME}_test
|
||||
macro (CERES_TEST NAME)
|
||||
add_executable(${NAME}_test ${NAME}_test.cc)
|
||||
target_link_libraries(${NAME}_test test_util ceres gtest)
|
||||
add_test(NAME ${NAME}_test
|
||||
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${NAME}_test
|
||||
--test_srcdir
|
||||
${CMAKE_SOURCE_DIR}/data)
|
||||
ENDMACRO (CERES_TEST)
|
||||
endmacro (CERES_TEST)
|
||||
|
||||
CERES_TEST(array_utils)
|
||||
CERES_TEST(autodiff)
|
||||
CERES_TEST(autodiff_cost_function)
|
||||
CERES_TEST(autodiff_local_parameterization)
|
||||
CERES_TEST(block_jacobi_preconditioner)
|
||||
CERES_TEST(block_random_access_dense_matrix)
|
||||
CERES_TEST(block_random_access_diagonal_matrix)
|
||||
CERES_TEST(block_random_access_sparse_matrix)
|
||||
CERES_TEST(block_sparse_matrix)
|
||||
CERES_TEST(c_api)
|
||||
CERES_TEST(canonical_views_clustering)
|
||||
CERES_TEST(compressed_row_sparse_matrix)
|
||||
CERES_TEST(conditioned_cost_function)
|
||||
CERES_TEST(corrector)
|
||||
CERES_TEST(cost_function_to_functor)
|
||||
CERES_TEST(covariance)
|
||||
CERES_TEST(cubic_interpolation)
|
||||
CERES_TEST(dense_sparse_matrix)
|
||||
CERES_TEST(dynamic_autodiff_cost_function)
|
||||
CERES_TEST(dynamic_compressed_row_sparse_matrix)
|
||||
CERES_TEST(dynamic_numeric_diff_cost_function)
|
||||
CERES_TEST(evaluator)
|
||||
CERES_TEST(gradient_checker)
|
||||
CERES_TEST(gradient_checking_cost_function)
|
||||
CERES_TEST(gradient_problem)
|
||||
CERES_TEST(gradient_problem_solver)
|
||||
CERES_TEST(graph)
|
||||
CERES_TEST(graph_algorithms)
|
||||
CERES_TEST(householder_vector)
|
||||
CERES_TEST(implicit_schur_complement)
|
||||
CERES_TEST(iterative_schur_complement_solver)
|
||||
CERES_TEST(jet)
|
||||
CERES_TEST(levenberg_marquardt_strategy)
|
||||
CERES_TEST(dogleg_strategy)
|
||||
CERES_TEST(line_search_preprocessor)
|
||||
CERES_TEST(local_parameterization)
|
||||
CERES_TEST(loss_function)
|
||||
CERES_TEST(minimizer)
|
||||
CERES_TEST(normal_prior)
|
||||
CERES_TEST(numeric_diff_cost_function)
|
||||
CERES_TEST(ordered_groups)
|
||||
CERES_TEST(parameter_block)
|
||||
CERES_TEST(parameter_block_ordering)
|
||||
CERES_TEST(partitioned_matrix_view)
|
||||
CERES_TEST(polynomial)
|
||||
CERES_TEST(problem)
|
||||
CERES_TEST(program)
|
||||
CERES_TEST(reorder_program)
|
||||
CERES_TEST(residual_block)
|
||||
CERES_TEST(residual_block_utils)
|
||||
CERES_TEST(rotation)
|
||||
CERES_TEST(schur_complement_solver)
|
||||
CERES_TEST(schur_eliminator)
|
||||
CERES_TEST(single_linkage_clustering)
|
||||
CERES_TEST(small_blas)
|
||||
CERES_TEST(solver)
|
||||
ceres_test(array_utils)
|
||||
ceres_test(autodiff)
|
||||
ceres_test(autodiff_cost_function)
|
||||
ceres_test(autodiff_local_parameterization)
|
||||
ceres_test(block_jacobi_preconditioner)
|
||||
ceres_test(block_random_access_dense_matrix)
|
||||
ceres_test(block_random_access_diagonal_matrix)
|
||||
ceres_test(block_random_access_sparse_matrix)
|
||||
ceres_test(block_sparse_matrix)
|
||||
ceres_test(c_api)
|
||||
ceres_test(canonical_views_clustering)
|
||||
ceres_test(compressed_row_sparse_matrix)
|
||||
ceres_test(conditioned_cost_function)
|
||||
ceres_test(corrector)
|
||||
ceres_test(cost_function_to_functor)
|
||||
ceres_test(covariance)
|
||||
ceres_test(cubic_interpolation)
|
||||
ceres_test(dense_sparse_matrix)
|
||||
ceres_test(dynamic_autodiff_cost_function)
|
||||
ceres_test(dynamic_compressed_row_sparse_matrix)
|
||||
ceres_test(dynamic_numeric_diff_cost_function)
|
||||
ceres_test(evaluator)
|
||||
ceres_test(gradient_checker)
|
||||
ceres_test(gradient_checking_cost_function)
|
||||
ceres_test(gradient_problem)
|
||||
ceres_test(gradient_problem_solver)
|
||||
ceres_test(graph)
|
||||
ceres_test(graph_algorithms)
|
||||
ceres_test(householder_vector)
|
||||
ceres_test(implicit_schur_complement)
|
||||
ceres_test(iterative_schur_complement_solver)
|
||||
ceres_test(jet)
|
||||
ceres_test(levenberg_marquardt_strategy)
|
||||
ceres_test(dogleg_strategy)
|
||||
ceres_test(line_search_preprocessor)
|
||||
ceres_test(local_parameterization)
|
||||
ceres_test(loss_function)
|
||||
ceres_test(minimizer)
|
||||
ceres_test(normal_prior)
|
||||
ceres_test(numeric_diff_cost_function)
|
||||
ceres_test(ordered_groups)
|
||||
ceres_test(parameter_block)
|
||||
ceres_test(parameter_block_ordering)
|
||||
ceres_test(partitioned_matrix_view)
|
||||
ceres_test(polynomial)
|
||||
ceres_test(problem)
|
||||
ceres_test(program)
|
||||
ceres_test(reorder_program)
|
||||
ceres_test(residual_block)
|
||||
ceres_test(residual_block_utils)
|
||||
ceres_test(rotation)
|
||||
ceres_test(schur_complement_solver)
|
||||
ceres_test(schur_eliminator)
|
||||
ceres_test(single_linkage_clustering)
|
||||
ceres_test(small_blas)
|
||||
ceres_test(solver)
|
||||
|
||||
# TODO(sameeragarwal): This test should ultimately be made
|
||||
# independent of SuiteSparse.
|
||||
IF (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
CERES_TEST(compressed_col_sparse_matrix_utils)
|
||||
TARGET_LINK_LIBRARIES(compressed_col_sparse_matrix_utils_test
|
||||
if (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
ceres_test(compressed_col_sparse_matrix_utils)
|
||||
target_link_libraries(compressed_col_sparse_matrix_utils_test
|
||||
${SUITESPARSE_LIBRARIES})
|
||||
ENDIF (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
endif (SUITESPARSE AND SUITESPARSE_FOUND)
|
||||
|
||||
CERES_TEST(symmetric_linear_solver)
|
||||
CERES_TEST(triplet_sparse_matrix)
|
||||
CERES_TEST(trust_region_minimizer)
|
||||
CERES_TEST(trust_region_preprocessor)
|
||||
CERES_TEST(unsymmetric_linear_solver)
|
||||
CERES_TEST(visibility)
|
||||
CERES_TEST(visibility_based_preconditioner)
|
||||
ceres_test(symmetric_linear_solver)
|
||||
ceres_test(triplet_sparse_matrix)
|
||||
ceres_test(trust_region_minimizer)
|
||||
ceres_test(trust_region_preprocessor)
|
||||
ceres_test(unsymmetric_linear_solver)
|
||||
ceres_test(visibility)
|
||||
ceres_test(visibility_based_preconditioner)
|
||||
|
||||
# Put the large end to end test last.
|
||||
CERES_TEST(system)
|
||||
ENDIF (BUILD_TESTING AND GFLAGS)
|
||||
ceres_test(system)
|
||||
endif (BUILD_TESTING AND GFLAGS)
|
||||
|
||||
Reference in New Issue
Block a user