# Cpp library: build task compiles only debug variant

**URL:** <https://discuss.gradle.org/t/cpp-library-build-task-compiles-only-debug-variant/32398>\
**Category:** Help/Discuss\
**Created:** [July 11, 2019, 4:12pm UTC](https://discuss.gradle.org/t/cpp-library-build-task-compiles-only-debug-variant/32398 "2019-07-11T16:12:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreasFagschlunger](https://avatars.discourse-cdn.com/v4/letter/a/fbc32d/32.png) [@AndreasFagschlunger](https://discuss.gradle.org/u/AndreasFagschlunger)\
**Post date:** [July 11, 2019, 4:12pm UTC](https://discuss.gradle.org/t/cpp-library-build-task-compiles-only-debug-variant/32398/1 "2019-07-11T16:12:06Z")

</div>

Hi!  
I’m using Gradle 5.5 and cpp-library-plugin for a simple native library. And I don’t know why but by default `gradle build` only assembles a `debug` version. I have to call `gradlew assembleReleaseX86-64` to get a `release` version.

Does someone know how I can do debug and release builds?

```gradle
plugins {
    `cpp-library`
}

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

extensions.configure<CppLibrary> {
    privateHeaders.from(file("C:/Program Files/Java/jdk1.8.0_171/include"), file("C:/Program Files/Java/jdk1.8.0_171/include/win32"))
}

tasks.withType(LinkSharedLibrary::class.java).configureEach {
    linkerArgs.add("Crypt32.lib")
}

```

---

<div class="post-metadata">

**Author:** ![thombentley](https://avatars.discourse-cdn.com/v4/letter/t/898d66/32.png) [@thombentley](https://discuss.gradle.org/u/thombentley)\
**Post date:** [October 25, 2019, 7:03pm UTC](https://discuss.gradle.org/t/cpp-library-build-task-compiles-only-debug-variant/32398/2 "2019-10-25T19:03:42Z")

</div>

That is the default behavior. You need to use this task.  
You need to use assembleRelease  
[https://docs.gradle.org/5.5.1/userguide/cpp\_library\_plugin.html#sec:cpp\_library\_tasks](https://docs.gradle.org/5.5.1/userguide/cpp_library_plugin.html#sec:cpp_library_tasks)
