diff --git a/legacy/builder/gcc_preproc_runner.go b/legacy/builder/gcc_preproc_runner.go index 4f425737552..e831108561e 100644 --- a/legacy/builder/gcc_preproc_runner.go +++ b/legacy/builder/gcc_preproc_runner.go @@ -57,6 +57,7 @@ func GCCPreprocRunnerForDiscoveringIncludes(ctx *types.Context, sourceFilePath * func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths.Path, targetFilePath *paths.Path, includes paths.PathList) (*exec.Cmd, error) { properties := ctx.BuildProperties.Clone() + properties.Set("build.library_discovery_phase", "1") properties.SetPath(constants.BUILD_PROPERTIES_SOURCE_FILE, sourceFilePath) properties.SetPath(constants.BUILD_PROPERTIES_PREPROCESSED_FILE_PATH, targetFilePath) @@ -77,8 +78,6 @@ func prepareGCCPreprocRecipeProperties(ctx *types.Context, sourceFilePath *paths // to create a /dev/null.d dependency file, which won't work. cmd.Args = utils.Filter(cmd.Args, func(a string) bool { return a != "-MMD" }) - cmd.Args = append(cmd.Args, "-DARDUINO_LIB_DISCOVERY_PHASE") - return cmd, nil } diff --git a/legacy/builder/setup_build_properties.go b/legacy/builder/setup_build_properties.go index b8ebd9b5e83..1579180ceba 100644 --- a/legacy/builder/setup_build_properties.go +++ b/legacy/builder/setup_build_properties.go @@ -67,6 +67,7 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error { buildProperties.Set("build.fqbn", ctx.FQBN.String()) buildProperties.Set("ide_version", ctx.ArduinoAPIVersion) buildProperties.Set("runtime.os", properties.GetOSSuffix()) + buildProperties.Set("build.library_discovery_phase", "0") if ctx.OptimizeForDebug { if buildProperties.ContainsKey("compiler.optimization_flags.debug") {