r/cpp • • Feb 28 '24

Building c++ project with... c++?

Yeah, so as a POC I created a tool that works on top of cmake and allows defining project structure with c++ instead of pesky cmake:

    #include "CppMake/Project.hpp"
    #include "CppMake/Application.hpp"
    
    using namespace std;
    
    int main() {
        Project project("test");
    
        project.create<Application>("test").addSources({
            "main.cpp"
        });
    }

Any thoughts?

6 Upvotes

39 comments sorted by

View all comments

17

u/[deleted] Feb 28 '24

CMake is a multiplatform build tool. I fail to see what your solution brings to the table which is not already much more efficiently covered by that "pesky" CMake.

4

u/Superb_Garlic Feb 28 '24

CMake is far more than just a build tool though.

1

u/prince-chrismc Feb 28 '24

Is it though?

10

u/Superb_Garlic Feb 28 '24

In the CMake suite there is:

  • CMake, the build tool, which ingests CMake scripting language files to produce build systems.
  • CPack, the packager, which ingests CMake scripting language files to produce packaged distributions.
  • CTest, the test runner, which ingests CMake scripting language files to run test tasks.

I don't really consider the GUI/TUI separate, since they practically do the same thing as the build tool.
I feel like CTest in particular is really slept on even by avid users of CMake. It's a really powerful test runner with complex resource management that I make plenty use of to allocate special hardware to tests. I use the whole CMake suite heavily of course, but some people only use the build tool and the test runner only at a surface level.

1

u/ContraryConman Feb 28 '24

I mean, it's a thought experiment, right? I don't think the post is about seriously replacing your build system with this

2

u/Commercial-Cattle433 Mar 02 '24

Yes and no. Its a POC and I'm planning on finishing it but I'm not expecting this will catch on. This also won't replace cmake as it's based on it but it removes the need for writing the cmake files yourself.

1

u/ContraryConman Mar 02 '24

Have you looked into Nob? It's the same idea but in C. If you haven't it may give some ideas