Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boostless GTSAM built requires Boost as dependency #1791

Closed
laxnpander opened this issue Aug 8, 2024 · 1 comment · Fixed by #1846
Closed

Boostless GTSAM built requires Boost as dependency #1791

laxnpander opened this issue Aug 8, 2024 · 1 comment · Fixed by #1846
Labels
bug Bug report

Comments

@laxnpander
Copy link

Description

I built GTSAM without boost, yet linking it in my application leads to CMake looking for Boost. This is the CMake error:

CMake Error at C:/Program Files/CMake/share/cmake-3.30/Modules/FindPackageHandleStandardArgs.cmake:233 (message):
  Could NOT find Boost (missing: Boost_INCLUDE_DIR)

This is the GTSAMConfig.cmake:

# - Config file for GTSAM
# It defines the following variables
#  GTSAM_INCLUDE_DIR - include directories for GTSAM

# Compute paths
get_filename_component(OUR_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
if(EXISTS "${OUR_CMAKE_DIR}/CMakeCache.txt")
  # In build tree
  set(GTSAM_INCLUDE_DIR C:/Users/cipadmin/Documents/Workspace/spear/3rd/gtsam CACHE PATH "GTSAM include directory")
else()
  # Find installed library
  set(GTSAM_INCLUDE_DIR "${OUR_CMAKE_DIR}/../include" CACHE PATH "GTSAM include directory")
endif()

# Find dependencies, required by cmake exported targets:
include(CMakeFindDependencyMacro)
# Allow using cmake < 3.8
if(${CMAKE_VERSION} VERSION_LESS "3.8.0")
find_package(Boost  COMPONENTS )
else()
find_dependency(Boost  COMPONENTS )
endif()

if(0)
    find_dependency(TBB 4.4 COMPONENTS tbb tbbmalloc)
endif()

if(OFF)
find_dependency(Eigen3 REQUIRED)
endif()

# Load exports
include(${OUR_CMAKE_DIR}/GTSAM-exports.cmake)

# Load project-specific flags, if present
if(EXISTS "${OUR_CMAKE_DIR}/gtsam_extra.cmake")
	include("${OUR_CMAKE_DIR}/gtsam_extra.cmake")
endif()

message(STATUS "GTSAM include directory:  ${GTSAM_INCLUDE_DIR}")

Steps to reproduce

  1. Build GTSAM with the following commands:
cmake .. -DGTSAM_USE_BOOST_FEATURES=OFF -DGTSAM_ENABLE_BOOST_SERIALIZATION=OFF -DCMAKE_INSTALL_PREFIX=../cmake-install/ -DCMAKE_BUILD_TYPE=Release  -DGTSAM_BUILD_UNSTABLE=OFF -DGTSAM_BUILD_PYTHON=OFF
  1. Link GTSAM in another CMake project

Expected behavior

It should not link to Boost if it is built without Boost.

Environment

Windows 10

Additional information

@ProfFan
Copy link
Collaborator

ProfFan commented Aug 10, 2024

Ah yes, there should be a conditional in the config file...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants