diff --git a/CMakeLists.txt b/CMakeLists.txt index 9fb42a8..8fabfbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ endif() option(BUILD_TESTS "Build test" OFF) option(BUILD_DEMO "Build demo programs" OFF) option(BUILD_EXAMPLE "Build example programs" OFF) -option(BUILD_WITH_TBB "Build with TBB support" ON) +option(BUILD_WITH_TBB "Build with TBB support" OFF) option(BUILD_WITH_OPENMP "Build with OpenMP support" ON) option(BUILD_WITH_CUDA "Build with GPU support" OFF) option(BUILD_WITH_CUDA_MULTIARCH "Build with CUDA multi-architecture support" OFF) diff --git a/cmake/FindGTSAM.cmake b/cmake/FindGTSAM.cmake index 692ac5f..4d86850 100644 --- a/cmake/FindGTSAM.cmake +++ b/cmake/FindGTSAM.cmake @@ -12,16 +12,25 @@ find_library(GTSAM_UNSTABLE_LIB NAMES gtsam_unstable HINTS /usr/local/lib /usr/lib DOC "GTSAM_UNSTABLE libraries") -find_library(TBB_LIB NAMES tbb - HINTS /usr/local/lib /usr/lib - DOC "TBB libraries") -find_library(TBB_MALLOC_LIB NAMES tbbmalloc - HINTS /usr/local/lib /usr/lib - DOC "TBB malloc libraries") +if(GTSAM_LIB AND GTSAM_UNSTABLE_LIB) + set(GTSAM_LIBRARIES ${GTSAM_LIB} ${GTSAM_UNSTABLE_LIB}) +endif() -if(GTSAM_LIB AND GTSAM_UNSTABLE_LIB AND TBB_LIB) - set(GTSAM_LIBRARIES ${GTSAM_LIB} ${GTSAM_UNSTABLE_LIB} ${TBB_LIB} ${TBB_MALLOC_LIB}) +if(GTSAM_POINTS_USE_TBB) + find_library(TBB_LIB NAMES tbb + HINTS /usr/local/lib /usr/lib + DOC "TBB libraries") + + find_library(TBB_MALLOC_LIB NAMES tbbmalloc + HINTS /usr/local/lib /usr/lib + DOC "TBB malloc libraries") + + if(TBB_LIB AND TBB_MALLOC_LIB) + set(GTSAM_LIBRARIES ${GTSAM_LIBRARIES} ${TBB_LIB} ${TBB_MALLOC_LIB}) + else() + message(FATAL_ERROR "TBB libraries not found") + endif() endif() add_library(GTSAM::GTSAM INTERFACE IMPORTED GLOBAL)