diff --git a/CMakeLists.txt b/CMakeLists.txt index 9276c054a..16db37c4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -148,6 +148,7 @@ find_package(TBB) # Set up variables if we're using TBB if(TBB_FOUND AND GTSAM_WITH_TBB) set(GTSAM_USE_TBB 1) # This will go into config.h + include_directories(BEFORE ${TBB_INCLUDE_DIRS}) set(GTSAM_TBB_LIBRARIES "") if(TBB_DEBUG_LIBRARIES) foreach(lib ${TBB_LIBRARIES}) @@ -260,7 +261,7 @@ endif() # Include boost - use 'BEFORE' so that a specific boost specified to CMake # takes precedence over a system-installed one. -include_directories(BEFORE ${TBB_INCLUDE_DIRS} ${Boost_INCLUDE_DIR}) +include_directories(BEFORE ${Boost_INCLUDE_DIR}) # Add includes for source directories 'BEFORE' boost and any system include # paths so that the compiler uses GTSAM headers in our source directory instead diff --git a/gtsam_extra.cmake.in b/gtsam_extra.cmake.in index 70330fbb7..4eccddfb3 100644 --- a/gtsam_extra.cmake.in +++ b/gtsam_extra.cmake.in @@ -8,3 +8,11 @@ set (GTSAM_VERSION_STRING "@GTSAM_VERSION_STRING@") set (GTSAM_USE_TBB @GTSAM_USE_TBB@) set (GTSAM_DEFAULT_ALLOCATOR @GTSAM_DEFAULT_ALLOCATOR@) + +if("@GTSAM_USE_TBB@") + list(INSERT GTSAM_INCLUDE_DIR 0 "@TBB_INCLUDE_DIRS@") # Insert at beginning of list so that GTSAM still comes last +endif() + +if("@GTSAM_USE_EIGEN_MKL@") + list(INSERT GTSAM_INCLUDE_DIR 0 "@MKL_INCLUDE_DIR@") # Insert at beginning of list so that GTSAM still comes last +endif()