Issue
I have a CMake project that creates an interface library with (only showing the critical section of CMakeLists.txt):
...
add_subdirectory(part1)
add_subdirectory(part2)
add_subdirectory(part3)
add_library(part_interface INTERFACE)
target_link_libraries(part_interface INTERFACE
part1
part2
part3
)
...
Each of the subdirecties [lib1, lib2, lib3] contains a CMakeLists.txt that allows to build the different librairies.
I do not see how I could organize a generic conanfile.py to create a package for such an interface library? I would like it to pack all the sub-libraries as well as a global one (libinterface)?
I saw in the documentation the notion of components but I do not see how I could have something that would bind all the sub-libraries without having itself some sources? Should I have a conanfile.py for each sub-library?
Thanks in advance for your help
Solution
just my two cents on how the design should work
I do not see how I could organize a generic conanfile.py to create a package for such an interface library? I would like it to pack all the sub-libraries as well as a global one (libinterface)?
Strictly speaking components aren't exactly a packing thing, ALL libraries are available by package, The package is always complete and include all components binaries.
how I could have something that would bind all the sub-libraries without having itself some sources
you will have to write your own conanfile.py to explain to the pkg system how your build system works, as mentioned in that ticket, components are an "advance" use-case after-all.
Should I have a conanfile.py for each sub-library
No. You should only have 1 class implementing ConanFile per package
Answered By - haleyk Answer Checked By - Pedro (WPSolving Volunteer)