0

I find tons of descriptions how to generate a compilation database (especially compile_commands.json) for a C/C++ project. But the other way round: how to use it as input for a build via make or similar from command line?

  • You seem to have a chicken & egg problem there. You need to be able to build the project in order to construct a compilation database. Once you have a build system that can do that, how is it useful to use the CDB to generate a build system? – John Bollinger Mar 24 '22 at 21:24
  • Did you use an IDE to create the compile_commands.json for you? If you did it probably has the ability to create a makefile too. – Jerry Jeremiah Mar 24 '22 at 21:26
  • I created the database on Windows (Visual Studio 2019) from given project.sln, want to use it with makefiles or similar on Mac (never ever VS Code). That simple. – Alexander Stippler Mar 24 '22 at 21:32
  • It shouldn't be (too) hard to come up with a script that will parse the JSON and execute the commands. – Eugene Sh. Mar 24 '22 at 21:48
  • Probably not complicated. But I really wonder why compilation is not a normal use case for a COMPILATION-database ;). – Alexander Stippler Mar 25 '22 at 09:34

0 Answers0