Native libraries an cpp-unit-test

I’m creating my first native Gradle project that is creating a shared library. I am using the cpp-unit-test plugin that contains a simple console app that dynamically loads the library and gets its entry points. I am struggling to get Gradle not to include the objects that were built on my library task. I’ve attempted various iterations of the following, with nothing linked.

unitTest {

// Set the target operating system and architecture for this library

targetMachines = [

    machines.linux.x86_64,

    machines.windows.x86_64

]

binaries.configureEach {

    def compileTask = compileTask.get()

     if (toolChain instanceof VisualCpp) {

         compileTask.compilerArgs = ["-W2", "-Od", "-Z7", "-EHsc", "-Gd", "-DMSWIN", "-DPROGRESSCORE","/D _DEBUG", "/D _CONSOLE", "/D _UNICODE", "/D UNICODE", "/Gm-", "/EHsc", "/RTC1", "/MDd", "/GS", "/permissive-", "/Zc:wchar_t", "/Zc:forScope", "/Zc:inline"]

    } else if (toolChain instanceof GccCompatibleToolChain) {

        compileTask.compilerArgs = ["-x", "c", "-std=c11", "-DMSCLIENT_EXPORTS", "-DPROGRESSCORE"]

    }

    def linkTask = linkTask.get()

    if (toolChain instanceof GccCompatibleToolChain) {

        linkTask.linkerArgs = ["-nodefaultlibs", "-lc", "-lrdkafka"]

    }

    else if (toolChain instanceof VisualCpp) {

        linkTask.source(fileTree(dir: "build/obj/test", include: "**/*.obj"))

        linkTask.linkerArgs = ["-nodefaultlib:msvcrt.lib", "-nodefaultlib:msvcmrt.lib", "-nodefaultlib:libcpmt.lib", "-nodefaultlib:libcmt.lib", "-nodefaultlib:libc.lib"]

    }

}

}

Any suggestions or examples would be appreciated.

Dave