Robert Ramey wrote:
1) The first lines show
mkdir __build cd __build cmake .. cmake --build .
Does this presume that one starts from the library directory? Does this syntax work for out of source tree builds? That is, would the following work?
mkdir /temp/__build cd /temp/__build cmake .. cmake --build .
You can put your binary directory wherever you like, but then you need to pass the correct source directory at the `cmake ..` point, because `..` is no longer the source directory.
2) BOOST_INCLUDE_LIBRARY
I would like my CMakeLists.txt file to explicitly list the direct antecedent libraries (dependencies - bad word usage). So I'd expect to see something like
add_directory(../filesystem) add_directory(../regex)
This can only work if your library is the root project. If it's not, you can't just add_subdirectory your dependencies, because the root project may use more than one Boost library. If each of these tries to add_subdirectory other Boost libraries, there will be duplication and things are not going to work. In fact things are not going to work even in your case (if all libraries did what you're trying to do) because `filesystem` may perform `add_subdirectory(regex)` and then your own `add_subdirectory(regex)` will fail. As a general rule, subprojects should never use add_subdirectory for their dependencies. The intended use of BOOST_INCLUDE_LIBRARIES is from the Boost root: mkdir __build__ && cd __build__ cmake -DBOOST_INCLUDE_LIBRARIES=serialization .. This tells the superproject to perform the necessary add_subdirectory calls for Serialization and its dependencies.