boost consumption, its internal dependencies

Use case : incorporating building some boost libraries via External Project, so no find_package (since also cross build scenarios), Afterwards in the same CMakeLists.txt I can either turn them into:

  1. imported targets ==> doesn’t work since they are not build yet, and consumer CMakeLists.txt give warnings
  2. turn them into interface libraries => this works fine, except for one problem. I am doing something similar like FindBoost.cmake, that is i also try to model the interdependencies, eg boost::thread depends on boost::chronoe,date_time,atomic and for example boost::iostreams on zip (build with zip). Off course the only way to specify are INTERFACE specification, which means telling the user of the boost library in case to also link with the dependencies (my use case : all static libraries). So far so good, however the linker sometimes has issues, because the order itself is not correct, it is not taking into account that boost::thread depends on the other ones, and as such should come first to the linker command before its dependencies(similar for the iostreams versus zip).

How can this be done correctly ?

to be clear the super workspace pattern is something not to be used, it would complicate the entire setup drastically, so also not find_package is considered ok.

While I understand not wanting to do that, it sounds like FetchContent is the better solution for you then. Using ExternalProject to build dependencies you want to use find_package for as well isn’t really going to work out very often.