From b84c6efe51949cb5c248b4c989a0a0239fe6d535 Mon Sep 17 00:00:00 2001 From: Ellon Paiva Mendes Date: Thu, 3 Oct 2019 13:56:26 +0200 Subject: [PATCH 1/3] Bump version to 4.0.2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b0457cb1c..1c9f0639a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ endif() # Set the version number for the library set (GTSAM_VERSION_MAJOR 4) set (GTSAM_VERSION_MINOR 0) -set (GTSAM_VERSION_PATCH 0) +set (GTSAM_VERSION_PATCH 2) math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}") set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}") From 0760858aab942c03b438cfbfe89cab326d83cfb4 Mon Sep 17 00:00:00 2001 From: Ellon Paiva Mendes Date: Thu, 3 Oct 2019 17:45:58 +0200 Subject: [PATCH 2/3] Install GTSAMConfigVersion.cmake --- cmake/GtsamMakeConfigFile.cmake | 28 ++++++++++++++++++++++++++-- gtsam_extra.cmake.in | 5 ++--- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/cmake/GtsamMakeConfigFile.cmake b/cmake/GtsamMakeConfigFile.cmake index 74081b58a..2fff888ef 100644 --- a/cmake/GtsamMakeConfigFile.cmake +++ b/cmake/GtsamMakeConfigFile.cmake @@ -20,13 +20,37 @@ function(GtsamMakeConfigFile PACKAGE_NAME) set(EXTRA_FILE "_does_not_exist_") endif() + # GTSAM defines its version variable as GTSAM_VERSION_STRING while other + # projects may define it as _VERSION. Since this file is + # installed on the system as part of GTSAMCMakeTools and may be useful in + # external projects, we need to handle both cases of version variable naming + # here. + if(NOT DEFINED ${PACKAGE_NAME}_VERSION AND DEFINED ${PACKAGE_NAME}_VERSION_STRING) + set(${PACKAGE_NAME}_VERSION ${${PACKAGE_NAME}_VERSION_STRING}) + endif() + + # Version file + include(CMakePackageConfigHelpers) + write_basic_package_version_file( + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}ConfigVersion.cmake" + VERSION ${${PACKAGE_NAME}_VERSION} + COMPATIBILITY SameMajorVersion + ) + + # Config file file(RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${DEF_INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/include") file(RELATIVE_PATH CONF_REL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/${DEF_INSTALL_CMAKE_DIR}" "${CMAKE_INSTALL_PREFIX}/lib") configure_file(${GTSAM_CONFIG_TEMPLATE_PATH}/Config.cmake.in "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake" @ONLY) message(STATUS "Wrote ${PROJECT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake") - # Install config and exports files (for find scripts) - install(FILES "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/${DEF_INSTALL_CMAKE_DIR}") + # Install config, version and exports files (for find scripts) + install( + FILES + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}Config.cmake" + "${PROJECT_BINARY_DIR}/${PACKAGE_NAME}ConfigVersion.cmake" + DESTINATION + "${CMAKE_INSTALL_PREFIX}/${DEF_INSTALL_CMAKE_DIR}" + ) install(EXPORT ${PACKAGE_NAME}-exports DESTINATION ${DEF_INSTALL_CMAKE_DIR}) endfunction() diff --git a/gtsam_extra.cmake.in b/gtsam_extra.cmake.in index b7990b3cc..8a9a13648 100644 --- a/gtsam_extra.cmake.in +++ b/gtsam_extra.cmake.in @@ -1,8 +1,7 @@ # Extra CMake definitions for GTSAM -set (GTSAM_VERSION_MAJOR @GTSAM_VERSION_MAJOR@) -set (GTSAM_VERSION_MINOR @GTSAM_VERSION_MINOR@) -set (GTSAM_VERSION_PATCH @GTSAM_VERSION_PATCH@) +# All version variables are handled by GTSAMConfigVersion.cmake, except these +# two below. We continue to set them here in case someone uses them set (GTSAM_VERSION_NUMERIC @GTSAM_VERSION_NUMERIC@) set (GTSAM_VERSION_STRING "@GTSAM_VERSION_STRING@") From 0aaf496b6dae7e7e7785e1886e81b95539855d1e Mon Sep 17 00:00:00 2001 From: Jose Luis Blanco-Claraco Date: Mon, 7 Oct 2019 11:15:31 +0200 Subject: [PATCH 3/3] Remove obsolete cmake FindXX modules. Exported config files are preferred over modules, and easier to maintain. --- cmake/obsolete/FindGTSAM.cmake | 88 ------------------------- cmake/obsolete/FindGTSAM_UNSTABLE.cmake | 88 ------------------------- 2 files changed, 176 deletions(-) delete mode 100644 cmake/obsolete/FindGTSAM.cmake delete mode 100644 cmake/obsolete/FindGTSAM_UNSTABLE.cmake diff --git a/cmake/obsolete/FindGTSAM.cmake b/cmake/obsolete/FindGTSAM.cmake deleted file mode 100644 index 895eb853b..000000000 --- a/cmake/obsolete/FindGTSAM.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# This is FindGTSAM.cmake -# DEPRECIATED: Use config file approach to pull in targets from gtsam -# CMake module to locate the GTSAM package -# -# The following cache variables may be set before calling this script: -# -# GTSAM_DIR (or GTSAM_ROOT): (Optional) The install prefix OR source tree of gtsam (e.g. /usr/local or src/gtsam) -# GTSAM_BUILD_NAME: (Optional) If compiling against a source tree, the name of the build directory -# within it (e.g build-debug). Without this defined, this script tries to -# intelligently find the build directory based on the project's build directory name -# or based on the build type (Debug/Release/etc). -# -# The following variables will be defined: -# -# GTSAM_FOUND : TRUE if the package has been successfully found -# GTSAM_INCLUDE_DIR : paths to GTSAM's INCLUDE directories -# GTSAM_LIBS : paths to GTSAM's libraries -# -# NOTES on compiling against an uninstalled GTSAM build tree: -# - A GTSAM source tree will be automatically searched for in the directory -# 'gtsam' next to your project directory, after searching -# CMAKE_INSTALL_PREFIX and $HOME, but before searching /usr/local and /usr. -# - The build directory will be searched first with the same name as your -# project's build directory, e.g. if you build from 'MyProject/build-optimized', -# 'gtsam/build-optimized' will be searched first. Next, a build directory for -# your project's build type, e.g. if CMAKE_BUILD_TYPE in your project is -# 'Release', then 'gtsam/build-release' will be searched next. Finally, plain -# 'gtsam/build' will be searched. -# - You can control the gtsam build directory name directly by defining the CMake -# cache variable 'GTSAM_BUILD_NAME', then only 'gtsam/${GTSAM_BUILD_NAME} will -# be searched. -# - Use the standard CMAKE_PREFIX_PATH, or GTSAM_DIR, to find a specific gtsam -# directory. - -# Get path suffixes to help look for gtsam -if(GTSAM_BUILD_NAME) - set(gtsam_build_names "${GTSAM_BUILD_NAME}/gtsam") -else() - # lowercase build type - string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_suffix) - # build suffix of this project - get_filename_component(my_build_name "${CMAKE_BINARY_DIR}" NAME) - - set(gtsam_build_names "${my_build_name}/gtsam" "build-${build_type_suffix}/gtsam" "build/gtsam") -endif() - -# Use GTSAM_ROOT or GTSAM_DIR equivalently -if(GTSAM_ROOT AND NOT GTSAM_DIR) - set(GTSAM_DIR "${GTSAM_ROOT}") -endif() - -if(GTSAM_DIR) - # Find include dirs - find_path(GTSAM_INCLUDE_DIR gtsam/inference/FactorGraph.h - PATHS "${GTSAM_DIR}/include" "${GTSAM_DIR}" NO_DEFAULT_PATH - DOC "GTSAM include directories") - - # Find libraries - find_library(GTSAM_LIBS NAMES gtsam - HINTS "${GTSAM_DIR}/lib" "${GTSAM_DIR}" NO_DEFAULT_PATH - PATH_SUFFIXES ${gtsam_build_names} - DOC "GTSAM libraries") -else() - # Find include dirs - set(extra_include_paths ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" "${PROJECT_SOURCE_DIR}/../gtsam" /usr/local/include /usr/include) - find_path(GTSAM_INCLUDE_DIR gtsam/inference/FactorGraph.h - PATHS ${extra_include_paths} - DOC "GTSAM include directories") - if(NOT GTSAM_INCLUDE_DIR) - message(STATUS "Searched for gtsam headers in default paths plus ${extra_include_paths}") - endif() - - # Find libraries - find_library(GTSAM_LIBS NAMES gtsam - HINTS ${CMAKE_INSTALL_PREFIX}/lib "$ENV{HOME}/lib" "${PROJECT_SOURCE_DIR}/../gtsam" /usr/local/lib /usr/lib - PATH_SUFFIXES ${gtsam_build_names} - DOC "GTSAM libraries") -endif() - -# handle the QUIETLY and REQUIRED arguments and set GTSAM_FOUND to TRUE -# if all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GTSAM DEFAULT_MSG - GTSAM_LIBS GTSAM_INCLUDE_DIR) - - - - diff --git a/cmake/obsolete/FindGTSAM_UNSTABLE.cmake b/cmake/obsolete/FindGTSAM_UNSTABLE.cmake deleted file mode 100644 index 42cc9c8b0..000000000 --- a/cmake/obsolete/FindGTSAM_UNSTABLE.cmake +++ /dev/null @@ -1,88 +0,0 @@ -# This is FindGTSAM_UNSTABLE.cmake -# DEPRECIATED: Use config file approach to pull in targets from gtsam -# CMake module to locate the GTSAM_UNSTABLE package -# -# The following cache variables may be set before calling this script: -# -# GTSAM_UNSTABLE_DIR (or GTSAM_UNSTABLE_ROOT): (Optional) The install prefix OR source tree of gtsam_unstable (e.g. /usr/local or src/gtsam_unstable) -# GTSAM_UNSTABLE_BUILD_NAME: (Optional) If compiling against a source tree, the name of the build directory -# within it (e.g build-debug). Without this defined, this script tries to -# intelligently find the build directory based on the project's build directory name -# or based on the build type (Debug/Release/etc). -# -# The following variables will be defined: -# -# GTSAM_UNSTABLE_FOUND : TRUE if the package has been successfully found -# GTSAM_UNSTABLE_INCLUDE_DIR : paths to GTSAM_UNSTABLE's INCLUDE directories -# GTSAM_UNSTABLE_LIBS : paths to GTSAM_UNSTABLE's libraries -# -# NOTES on compiling against an uninstalled GTSAM_UNSTABLE build tree: -# - A GTSAM_UNSTABLE source tree will be automatically searched for in the directory -# 'gtsam_unstable' next to your project directory, after searching -# CMAKE_INSTALL_PREFIX and $HOME, but before searching /usr/local and /usr. -# - The build directory will be searched first with the same name as your -# project's build directory, e.g. if you build from 'MyProject/build-optimized', -# 'gtsam_unstable/build-optimized' will be searched first. Next, a build directory for -# your project's build type, e.g. if CMAKE_BUILD_TYPE in your project is -# 'Release', then 'gtsam_unstable/build-release' will be searched next. Finally, plain -# 'gtsam_unstable/build' will be searched. -# - You can control the gtsam build directory name directly by defining the CMake -# cache variable 'GTSAM_UNSTABLE_BUILD_NAME', then only 'gtsam/${GTSAM_UNSTABLE_BUILD_NAME} will -# be searched. -# - Use the standard CMAKE_PREFIX_PATH, or GTSAM_UNSTABLE_DIR, to find a specific gtsam -# directory. - -# Get path suffixes to help look for gtsam_unstable -if(GTSAM_UNSTABLE_BUILD_NAME) - set(gtsam_unstable_build_names "${GTSAM_UNSTABLE_BUILD_NAME}/gtsam_unstable") -else() - # lowercase build type - string(TOLOWER "${CMAKE_BUILD_TYPE}" build_type_suffix) - # build suffix of this project - get_filename_component(my_build_name "${CMAKE_BINARY_DIR}" NAME) - - set(gtsam_unstable_build_names "${my_build_name}/gtsam_unstable" "build-${build_type_suffix}/gtsam_unstable" "build/gtsam_unstable") -endif() - -# Use GTSAM_UNSTABLE_ROOT or GTSAM_UNSTABLE_DIR equivalently -if(GTSAM_UNSTABLE_ROOT AND NOT GTSAM_UNSTABLE_DIR) - set(GTSAM_UNSTABLE_DIR "${GTSAM_UNSTABLE_ROOT}") -endif() - -if(GTSAM_UNSTABLE_DIR) - # Find include dirs - find_path(GTSAM_UNSTABLE_INCLUDE_DIR gtsam_unstable/base/DSF.h - PATHS "${GTSAM_UNSTABLE_DIR}/include" "${GTSAM_UNSTABLE_DIR}" NO_DEFAULT_PATH - DOC "GTSAM_UNSTABLE include directories") - - # Find libraries - find_library(GTSAM_UNSTABLE_LIBS NAMES gtsam_unstable - HINTS "${GTSAM_UNSTABLE_DIR}/lib" "${GTSAM_UNSTABLE_DIR}" NO_DEFAULT_PATH - PATH_SUFFIXES ${gtsam_unstable_build_names} - DOC "GTSAM_UNSTABLE libraries") -else() - # Find include dirs - set(extra_include_paths ${CMAKE_INSTALL_PREFIX}/include "$ENV{HOME}/include" "${PROJECT_SOURCE_DIR}/../gtsam" /usr/local/include /usr/include) - find_path(GTSAM_UNSTABLE_INCLUDE_DIR gtsam_unstable/base/DSF.h - PATHS ${extra_include_paths} - DOC "GTSAM_UNSTABLE include directories") - if(NOT GTSAM_UNSTABLE_INCLUDE_DIR) - message(STATUS "Searched for gtsam_unstable headers in default paths plus ${extra_include_paths}") - endif() - - # Find libraries - find_library(GTSAM_UNSTABLE_LIBS NAMES gtsam_unstable - HINTS ${CMAKE_INSTALL_PREFIX}/lib "$ENV{HOME}/lib" "${PROJECT_SOURCE_DIR}/../gtsam" /usr/local/lib /usr/lib - PATH_SUFFIXES ${gtsam_unstable_build_names} - DOC "GTSAM_UNSTABLE libraries") -endif() - -# handle the QUIETLY and REQUIRED arguments and set GTSAM_UNSTABLE_FOUND to TRUE -# if all listed variables are TRUE -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(GTSAM_UNSTABLE DEFAULT_MSG - GTSAM_UNSTABLE_LIBS GTSAM_UNSTABLE_INCLUDE_DIR) - - - -