I'm designing a collection of libraries that can be linked in my other C++ projects. In order to make the collection easy to use I want to either be able to link to individual libraries, or link to one master library that contains all of the others. How can I specify this in a CMakeLists.txt file?
For example:
add_library(library1 SHARED
    file1.cpp
    file2.cpp
)
add_library(library2 SHARED
    file3.cpp
    file4.cpp
)
# Define a master library that contains both of the others
add_library(master_library SHARED
    library1
    library2
)
Is there a proper way to get this functionality with CMake?
EDIT:
This question is not a duplicate of: CMake: Is it possible to build an executable from only static libraries and no source?
This has to do with shared libraries only and has nothing to do with static libraries or executables.
 
     
    