Understand has many options for generating accurate projects. Accurate projects help leverage the full potential of the C/C++ Strict parser. Buildspy actively constructs the Understand database by directly modifying the .udb file. As an alternative, most build systems have the capability to save their compile commands to a log file. There are several of those logging formats that Understand can read in order to create a project definition. The most robust are the compile_commands.json files that CMAKE generates. These have all of the same information that buildspy captures, making them useful for the Strict parser. The main difference as far as Understand is concerned, is that this information is saved to a text file instead of actively interacting with the udb like Buildspy. An option has been added to the Understand New Project wizard that allows the user to make an Understand project directly from one of these json files.
The option is also available with our command line tool Und using the add command.
( und -db path/to/db.udb create -languages C++ add path/to/build/dir/compile_commands.json settings -c++AddFoundFilesToProject on analyze )
Every time the code is compiled, the json file is automatically updated by the build system – with no impact on Understand. Then in the user’s Understand project, you can hit Analyze and that json file is scanned for changes and, if there are any, the project is reanalyzed. No opening or closing of Understand is needed.
Up until recently this option was only available to projects built with CMAKE, but we found an open source project named BEAR that generates the same json files for non-CMAKE build systems. It has been tested and works great.