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

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:


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:

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.


Can you check what are the defined variables after find_package. You may use:

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


1 Like

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.

1 Like

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.