# Gradle cpp-library, how to define linker args

**URL:** <https://discuss.gradle.org/t/gradle-cpp-library-how-to-define-linker-args/35196>\
**Category:** Help/Discuss\
**Created:** [March 10, 2020, 5:19am UTC](https://discuss.gradle.org/t/gradle-cpp-library-how-to-define-linker-args/35196 "2020-03-10T05:19:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wavesonics](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/wavesonics/32/8359_2.png) [@Wavesonics](https://discuss.gradle.org/u/Wavesonics)\
**Post date:** [March 10, 2020, 5:19am UTC](https://discuss.gradle.org/t/gradle-cpp-library-how-to-define-linker-args/35196/1 "2020-03-10T05:19:56Z")

</div>

I’m trying to compile a shared library, but it depends on a pre-build library which provides (_on windows_) `.lib` files.

I’ve managed to point it to the header files, but can’t figure out how to point the linker to the lib file.

Here’s what I’ve got so far:

```
plugins {
	id("cpp-library")
	  id("visual-studio")
}

library {
  targetMachines.set(listOf(machines.linux.x86_64,
	machines.windows.x86, machines.windows.x86_64,
	machines.macOS.x86_64))
  
  linkage.set(listOf(Linkage.SHARED))

  privateHeaders.from(file("godot-cpp/godot_headers/"), file("godot-cpp/include"), file("godot-cpp/include/core"), file("godot-cpp/include/gen"))
}

```

I’ve found lots of docs, but most are for groovy, and other don’t specify the context to use them in. So I’ve seen code like `linkVarriant {}` but `linkDebug {}` is not recognized anywhere.

If I could define the pre-build library as a dependency, including it’s headers, and binaries and such, that’d be great. But all of the syntax I’ve seen for doing so doesn’t compile. Maybe it’s because I’m using kts files? Or maybe it’s for an older version of gradle? I don’t know.

I’m on Gradle 6.2.2

Any help would be greatly appreciated!
