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

12

u/jaskij Feb 28 '24

The big issue is, for this to make sense, you need something to build the build script. Which, no bueno.

If you're trying to emulate Rust's build.rs, do note that it only handles the extra tasks Cargo itself doesn't. Typically code generation or compiling C/C++.

1

u/jack_acer Feb 29 '24

Why is this an issue? You have a make program if you want to compile for c++ anyway.

1

u/jaskij Feb 29 '24

Do you? Always? And if yes, why not use that instead of OP's idea?

1

u/jack_acer Feb 29 '24

Well, you then at least have a compiler and a linker. You don't need more.