The cscoco Command Manual Page

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
ARGUMENTS
EXAMPLE
SEE ALSO
AUTHOR

NAME

cscoco - generate CScout workspace from a compilation database

SYNOPSIS

cscoco [-h] [-n project_name] [compile_commands.json]

DESCRIPTION

cscoco reads a compilation database in the compile_commands.json format and translates each translation unit into a CScout workspace file (.cs). The generated workspace is written to standard output. Each C translation unit is mapped to a block containing preprocessor settings (defines and include paths) and processing directives. Only C source files (.c) are processed; C++ files are skipped.

The resulting workspace file can be passed to cscout(1) for static analysis.

For the location of the workaround headers, see csmake(1).

OPTIONS

-h, --help

Display a brief usage message and exit.

-n, --name project_name

An optional project name to use in the #pragma project directive. If not specified, the name of the directory above the build directory is used, or "project" if reading from standard input.

ARGUMENTS

compile_commands.json

The compilation database to read, generated by tools such as CMake, Bear, Meson, Bazel’s extractor, or Clang’s -MJ compiler option. If not specified, or if specified as -, cscoco reads from standard input.

EXAMPLE

To generate a CScout workspace file from a CMake build:

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build .
cscoco build/compile_commands.json > project.cs

Alternatively, from a Meson build:

meson setup build
cscoco build/compile_commands.json > project.cs

For Makefile-based projects without native compilation database support, the database can be generated using Bear:

bear -- make
cscoco compile_commands.json > project.cs

Alternatively, Clang’s -MJ compiler option can be used to output compilation database fragments, which are then concatenated into a valid JSON array:

clang -MJ main.o.json -c main.c
(echo "["; cat main.o.json | sed ’$s/,$//’; echo "]") > compile_commands.json
cscoco compile_commands.json > project.cs

This will create a project.cs file, which can then be processed by CScout:

cscout project.cs

SEE ALSO

cscout(1), csmake(1), cssplit(1)

Clang JSON Compilation Database Format: https://clang.llvm.org/docs/JSONCompilationDatabase.html

AUTHOR

(C) Copyright 2026 Diomidis Spinellis and Ujjwal Aggarwal.