Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Managing include paths and macros in 'Core Build' projects.

Am Dienstag, 4. Oktober 2022, 10:20:59 CEST schrieb Waterlander, Erwin:
> Hi,
> Great! That is exactly what I need.
> I see there is already some scanning done before the first build. I guess

For CMake core build: When a user opens a source code editor, the indexer asks 
for the IScannerInfo object of the corresponding resource, independently 
whether a build happened or not. This is also the case on workbench startup, 
when an editor view is restored.
Thats why scanning the compile_commands.json file may happen before the first 
build. This would not cause problems, if a compile_commands.json is ther from 
an older workbench session.

> the default Toolchain selected in the launch configuration build settings
> is used to get some initial include paths. How can I change the core build

The default toolchain is not used for scanning in CMake core build projects, 
the compile_commands.json is parsed to get source file/cmakelists.txt specific 
include paths and macros. 
Compiler built-ins are retrieved by running the compiler and make it spit out 
its built-ins.

> project's default toolchain?
> I see that the CMakeBuildConfiguration and StandardBuildConfiguration

CMakeBuildConfiguration ignores the Eclipse toolchains.

> classes are responsible for building the core build cmake and makefile
> projects. I do not see yet how exactly the build output is captured,
> > Hi,
> > 
> > So this means that if I you run different C compilers, with their own
> > specific macros and includes, on different source files in a single
> > build from the same CMake file, you still get correct syntax
> > highlighting for all the source files. Right?

To clarify: From the point of feeding the CDT indexer: Yes.
The tricky part would be to tell cmake to use the custom compiler for a given 
file 'abc.c' and the default compiler for any other C-source file. Cmake's 
target properties might help here [1].
OTOH, cmake's toolchain feature might be used to switch the default C-compiler 



Cd wrttn wtht vwls s mch trsr.

Back to the top