Native shared library linking

Hi,

I’m wondering is there a way to prepend linker arguments in native builds ( i mean cpp plugin )?

for example , i have for shared library

-shared
-Wl,-soname,libSomeLib.so
-o

and i want to prepend here

-Wl,–no-undefined
-shared
-Wl,-soname,libSomeLib.so
-o

I think you want to add linker arguments manually. You can do so like this:

model {
    components {
        myLib(NativeLibrarySpec) {
            binaries.withType(SharedLibraryBinarySpec) {
                linker.args '--no-undefined'
            }
        }
    }
}

If you want to do this for all libraries, you can do it like so:

model {
    binaries {
        withType(SharedLibraryBinarySpec) {
            linker.args '--no-undefined'
        }
    }
}

I’m not sure about the order the arguments are added though.

Hope this helps.