and good day to you all. For a while, I've been working on a game engine using c++ 23 together with cmake. For now, what I've been doing is having one huge CMakeLists.txt that included files from all submodules in one large target_sources declaration. It looks like this:
target sources(main
PRIVATE
FILE_SET CXX_MODULES FILES
"module1/file1"
"module1/file2"
...
"module1/fileN"
"module2/file1"
...
"moduleM/fileN"
)
As to not blow this up, I've stacked multiple classes in singular files, when what I really want is for each of them to be in their own separate files. The implementation .cpp files are added in the same manner, using add_executable. What is the correct way of doing this? Could I maybe make a separate CMakeLists.txt for each submodule?
The other problem I'm having with this approach is compiling the project. I am working on this project on 2 computers, each of them running a different distro of linux. Making both of them have the same tooling required for compilation was really long and bothersome. And if I ever wanted to use another computer, or allow users to compile my code themselves, this wouldn't cut it. Can I somehow ship my tooling along with the project? I've heard of using docker containers for this, how exactly would I start with it? Is this what is being used in the industry? Would I also have to ship my container with the project?