Link many small libraries in CMake

Viewed 39

I am writing a c++ library composed of a lot of small libraries. I decided to have one folder by library in each having CMakeLists.txt.

So I would have something like that :

add_library(LIBRARY_NAME LIBRARY_NAME.cpp LIBRARY_NAME.h)

include_directories(// I add the directories where my target libraries are)
target_link_libraries(// I add the used libraries in this library)

in each folder (library) CMakeLists.txt.

It's working but doesn't feel right. I have a lot of sub libraries so I have to write the above code each time and add all the used libraries each time..

My question is simple: Am I right?

0 Answers
Related