# FindBoost.cmake seems to work but adds no include folders to compile line when linked against

**URL:** https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923
**Category:** Usage
**Created:** [April 18, 2023, 3:26am UTC](https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923 "2023-04-18T03:26:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Rich\_von\_Lehe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rich_von_lehe/32/307_2.png) [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)
#### Post date: [April 18, 2023, 3:26am UTC](https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923/1 "2023-04-18T03:26:14Z")

</div>

I’m getting boost 1.77 thru conan for my small project. It is downloaded fine and seems to exist in its entirety in my conan cache. My CMakeLists.txt has a find\_package line:

`find_package(Boost COMPONENTS thread system REQUIRED)`

which succeeds (i.e. Boost\_FOUND is true)  
later I link against boost headers as well as system and thread like this:

```auto
target_link_libraries(gameplay
    PUBLIC
    Boost::boost
    PRIVATE
    Boost::system
    Boost::thread
    )

```

and this all passes CMake configuration.

However, it appears no useful include directories are being added on the compile line for files that are part of the gameplay library. My own project’s cpp and h files can’t find the likes of `<boost/statechart/asynchronous_state_machine.hpp>` or `boost/asio.hpp`.

I get messages during CMake configuration like `-- Conan: Component target declared Boost::boost` so I’m not sure how to debug this.  
I added:

```auto
get_property(propVal TARGET Boost::boost PROPERTY INCLUDE_DIRECTORIES)
message(STATUS "Boost::boost include dirs: ${propVal}")

```

and it comes back empty. I’m really just looking for hints on how to debug what’s going wrong here.

---

<div class="post-metadata">

### Author: ![adaldev](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/9dc877/32.png) [@adaldev](https://discourse.cmake.org/u/adaldev)
#### Post date: [April 18, 2023, 8:05am UTC](https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923/2 "2023-04-18T08:05:14Z")

</div>

Hi,

Can you check what are the defined variables after find\_package. You may use:

```cmake
get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
  message(STATUS "${_variableName}=${${_variableName}}")
endforeach()
execute_process(COMMAND "${CMAKE_COMMAND}" "-E" "environment")

```

Regards

---

<div class="post-metadata">

### Author: ![Rich\_von\_Lehe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rich_von_lehe/32/307_2.png) [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)
#### Post date: [April 18, 2023, 1:39pm UTC](https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923/3 "2023-04-18T13:39:38Z")

</div>

Thanks! The amount of information that snippet provides is very helpful. One thing I overlooked, and that your debugging suggestion helped me see, is that it’s not actually using FindBoost.cmake from the CMake distribution, it’s using the conan-provided BoostConfig.cmake found in the folder I ran `conan install` from. I am currently looking there to see if the boost::boost target is significantly different than what FindBoost.cmake creates.

---

<div class="post-metadata">

### Author: ![Rich\_von\_Lehe](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rich_von_lehe/32/307_2.png) [@Rich\_von\_Lehe](https://discourse.cmake.org/u/Rich_von_Lehe)
#### Post date: [April 18, 2023, 2:42pm UTC](https://discourse.cmake.org/t/findboost-cmake-seems-to-work-but-adds-no-include-folders-to-compile-line-when-linked-against/7923/4 "2023-04-18T14:42:32Z")

</div>

Ultimately I discovered the issue after viewing the INTERFACE\_INCLUDE\_DIRECTORIES instead of the INCLUDE\_DIRECTORIES. This was set properly, but had a generator expression that set the value to empty unless the CONFIG was Release. So I needed to run my `conan install` with a profile that specifically called out Debug in order to match my project’s build settings.
