# Libraries built outside the catkin workspace

**URL:** https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375
**Category:** Usage
**Tags:** os:linux, gen:makefiles
**Created:** [November 6, 2023, 5:20pm UTC](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375 "2023-11-06T17:20:16Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tanmayd26](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tanmayd26/32/3899_2.png) [@tanmayd26](https://discourse.cmake.org/u/tanmayd26)
#### Post date: [November 6, 2023, 5:20pm UTC](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375/1 "2023-11-06T17:20:16Z")

</div>

I am facing error with the include directories in my cmake. I tried all the scopes possible but still get this error. The GTSAM library is in shared folder “/usr/local/include” but still I am facing error.

```auto
CMake Error at autorally/autorally_core/src/StateEstimator/CMakeLists.txt:18 (target_include_directories):
  Cannot specify include directories for target "SYSTEM" which is not built
  by this project.

```

CMakeList.txt (Line1 18 target\_include\_directories)

```auto
# SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/include/boost")
# SET(CMAKE_LIBRARY_PATH $(CMAKE_LIBRARY_PATH) "")
list(APPEND CMAKE_PREFIX_PATH "/usr/share/cmake")
list(APPEND CMAKE_PREFIX_PATH "/usr/include/boost")
list(APPEND CMAKE_PREFIX_PATH "/usr/include/tbb")
find_package(Eigen3 REQUIRED)
find_package(GeographicLib REQUIRED)
find_package(TBB REQUIRED)
find_package (Boost REQUIRED COMPONENTS system filesystem thread chrono date_time atomic serialization regex timer)
include_directories(SYSTEM ${Boost_LIBRARY_DIRS})

include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(SYSTEM ${EIGEN3_INCLUDE_DIR})

find_package(GTSAM)
if(GTSAM_FOUND)
  find_package(TBB)
  target_include_directories(SYSTEM ${GTSAM_INCLUDE_DIR} "/usr/local/include" ${Boost_INCLUDE_DIRS} ) 

  add_executable(StateEstimator StateEstimator.cpp)
message(==========${GeographicLib_LIBRARY_DIRS}/${GeographicLib_LIBRARIES})
  target_link_libraries(StateEstimator ${catkin_LIBRARIES} ${ROS_LIBRARIES} gtsam ${GeographicLib_LIBRARY_DIRS}/libGeographic.so ${TBB_LIBRARIES} ar_diagnostics ${Boost_LIBRARIES})
  add_dependencies(StateEstimator autorally_msgs_gencpp)

  install(TARGETS StateEstimator
          ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
          LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
          RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
endif()

```

---

<div class="post-metadata">

### Author: ![tanmayd26](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tanmayd26/32/3899_2.png) [@tanmayd26](https://discourse.cmake.org/u/tanmayd26)
#### Post date: [November 7, 2023, 2:56pm UTC](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375/2 "2023-11-07T14:56:40Z")

</div>

Anyone @robert.maynard

---

<div class="post-metadata">

### Author: ![hsattler](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/h/59ef9b/32.png) [@hsattler](https://discourse.cmake.org/u/hsattler)
#### Post date: [November 8, 2023, 8:30am UTC](https://discourse.cmake.org/t/libraries-built-outside-the-catkin-workspace/9375/3 "2023-11-08T08:30:29Z")

</div>

For target\_include\_directories() you need to specify the target name as first argument but SYSTEM ist not a target name. Maybe read the documentation of this cmake command again.
