8.4.3. Local Analyses with CMake and Eclipse¶
8.4.3.1. Background¶
Your project is built using cmake and you are using the IDE Eclipse with the Axivion Eclipse Plugin.
8.4.3.2. What can be configured?¶
You can setup
analysis of your project on your local development machine, in contrast to the analysis on the CI server
analysis of a single file and display of warnings in Eclipse
8.4.3.3. What needs to be done?¶
The recommend approach to set Local Build and Single File Analysis is:
Using
CMake, setup a separate out-of-source build tree with one of the generators forGNU makeor forninja. See CMake for details.Specify
-DCMAKE_EXPORT_COMPILE_COMMANDS=1when callingCMake(or putset(CMAKE_EXPORT_COMPILE_COMMANDS Yes)inside yourCMakeconguration files) to have it generate a filecompile_commands.jsonthat can be used to re-run the compilation of a single unit.Install the Axivion Eclipse Plugin (follow instructions in Eclipse Plugin). Make sure to configure
BAUHAUS_CONFIGin the project settings to point to your project configuration. This will select the compiler profile and the set of stylechecks to be run.Follow the instructions for the Eclipse Plugin’s Makefile Integration to setup the single-file analysis
Enable the “Make Command for Single File” (using the check box on the right).
“Build Working Directory”: set to the same directory as the option
/Project/directoryconfigured inaxivion_config.(Note: use Eclipse variables to specify this relative to e.g. the root directory of the Eclipse project like
${project_loc}/..).“Source Basepath”: use the same value as for “Build Working Directory”.
Configure “Make Command for Single File” to:
build_compile_commands --single_file ${axivion_ir_file}.${axivion_src_ext} <path-to-build-tree>/compile_commands.jsonusing the
CMake-generated out-of-source build directory as<path-to-build-tree>(can be relative to “Build Working Directory”).