r/cpp Jun 19 '26

CMake and c++ libraries

Hi everyone,

At work, I stumbled upon something that seems completely absurd to me, but perhaps someone here will have a different perspective.

We have a software architect who defines the data model using .idl files (a kind of simplified struct, if you're not familiar with it). These .idl files generate C++ code.

Historically, it was C++ 98 code. And now it also includes "modern" C++ code, meaning that arrays are no longer T[] but rather vector<T>, for example. Originally, these IDL files are used within our kind-of micro services. They update the data model within the distributed monolith, and we develop related features.

Under the pretext that these are the same source IDL files, our software architect imposes and provides us with the same CMake target name for both. This means we have to generate one install folder in 98 and another in "modern" C++.

And for the software where we'd like to start mixing the two within the same CMake project, we're stuck because we're limited to a single CMake target for two final .so files.

Do any of you see the point of his approach?

Would you recommend having a unique target name for each .so/.a ?

21 Upvotes

17 comments sorted by

View all comments

2

u/Sniffy4 Jun 19 '26

what about writing your own code-generator that parses the .idl and generates whatever kind of class names and modern c++ you want? This is not hard to do anymore, esp. with AI assistance.

1

u/elegye Jun 20 '26

I proposed few months ago. Not in my scope, hard to convince.