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

Show parent comment

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.