Skip to main content
Version: 2.18 (deprecated)

cc-infer


Options controlling which dependencies will be inferred for CC targets.

Backend: pants.backend.experimental.cc

Config section: [cc-infer]

Basic options

include_from_source_roots

--[no-]cc-infer-include-from-source-roots
PANTS_CC_INFER_INCLUDE_FROM_SOURCE_ROOTS
pants.toml
[cc-infer]
include_from_source_roots = <bool>
default: True

Infer a target's dependencies by trying to include relative to source roots.

An example where this may be useful is if you have a a file at root/include/mylib/foo.h which may be referenced via #include "mylib/foo.h". This option will allow you to correctly infer dependencies if you have a source root at root/{include} and searching for mylib/foo.h relative to the that source root.

The inferred files take part in compilation, and the source root is added to the compilation include search path (https://clang.llvm.org/docs/ClangCommandLineReference.html#include-path-management) with command line arguments prefixed by the '-I' flag.

includes

--[no-]cc-infer-includes
PANTS_CC_INFER_INCLUDES
pants.toml
[cc-infer]
includes = <bool>
default: True

Infer a target's dependencies by parsing #include statements from sources.

Advanced options

None

Deprecated options

None

None