Native Build linking between subprojects and disabling shared Library

I have two questions.
First in the modle for the cpp plugin. How do I disable the ${component.name} SharedLibrary and stop if from showing up in gradle task list.

tasks.whenTaskAdded {task ->
	if(task.name.contains("embeddedSharedLibrary")) {
        task.enabled = false
    }
}

Works, however, I still get it in the task list, and it create a shared object in the build directory.

Second Question, I can use the following with cpp-library plugin to link between two subprojects.

dependencies {
	implementation project(':ErrorReporter')
}

In the Building native software section under model it has the following:

model {
    components {
        main(NativeExecutableSpec) {
            sources {
               c.lib library: "hello"
            }
        }
    }
}

When I try that with my project as follows.

sources {
                cpp {
                    source {
			lib library: ':ErrorReporter', linkage: 'static'
                        srcDir "src/main/cpp"                    
                        include "**/*.cpp"
                    }
                    exportedHeaders {
                        srcDir "src/main/public"
                    }
                }
            }

I get

> Could not locate library ':ErrorReporter' required by 'embedded' in project ':BatteryUARTMsg'.

How do I create those dependencies?