I just noticed a thing. While my lib build without error, while checking the built mylib.a I noticed that none of libB.a symbols are available.
In order to link the built libB to mine I used the following command:
ExternalProject_Get_property(LIBB SOURCE_DIR)
target_link_libraries(${PROJECT_NAME} PUBLIC ${SOURCE_DIR}/libB.a)
target_include_directories(${PROJECT_NAME} PUBLIC ${SOURCE_DIR}/liB_include)
using nm -gC mylib.a | grep <specific libB symbols> none are displayed.
I also noticed that building a program that includes mylib result in a
make[2]: *** No rule to build target « mylib/${SOURCE_DIR}/libB.a », required for « project ». Stopping.
mylib.a looks to be an archive library so it doesn’t have a linking step. None of the symbols of libB would be expected to show up. If you made mylib a shared library then there is usually a linking step and you would see the libB symbols. I don’t think CMake supports combining archive files.