I have a question regarding CMake-based projects with shared internal libraries.
I currently have the following codebase:
RootFolder
CMakeLists.txt
Lib1
|- lib1.cpp
|- lib1.h
|- CMakeLists.txt
App1
|- app1.cpp
|- app1.h
|- CMakeLists.txt
App2
|- app2.cpp
|- app2.h
|- CMakeLists.txt
Both App1 and App2 need to link against Lib1. I was able to set up my CMakeLists files to make it work in a case where both App1 and App2 can link against the same version of Lib1.
However, here is the case I cannot resolve: Say I make some breaking changes to the Lib1 interface, which implies that App1 and App2 need to be modified in order to compile. However, for some reason, I can only update App1 according to Lib1 updates.
But say, I also need to modify App2, while keeping the previous Lib1 version.
How can I manage this situation?
Lib1
that, by definition of a "breaking" change, breaks bothApp1
andApp2
, then it seems pretty clear thatApp1
andApp2
both need changing. If your statement "However, for some reason, I can only update App1 according to Lib1 updates." really means "some management, political, or whimsical mandate prevents me from updatingApp2
" , then your only choice seems a fork and separate lib. I'll admit, after reading this twice, I don't have a clue what you're trying to do, so I'll wait patiently for someone that has better decipherment skills.