Gradle: Link against installed version of CUnit in unit testing
<p>I have swapped to gradle as my new build system for C++ (althought I previously used it with java). Now, when I tried to link against CUnit for the test cases with a build file like</p>

<pre><code>apply plugin: 'cpp'
apply plugin: 'cunit'

model {
  platforms {
    x64 {
      architecture "x86_64"
    }
  }
  repositories {
    libs(PrebuiltLibraries) {
      cunit {}
    }
  }
  components {
    smartio(NativeLibrarySpec) {
      targetPlatform "x64"
      sources {
        cpp {
          source {
            srcDir 'src/smartio/cpp'
            include '**/*.cpp'
          }
          exportedHeaders {
            srcDir 'src/smartio/headers'
          }
        }
      }
    }
  }
  binaries {
    all {
      cppCompiler.args "-std=c++1y"
    }
    withType(CUnitTestSuiteBinarySpec) {
      lib library: "cunit", linkage: 'api'
    }
  }
}
</code></pre>

<p>I still get the following output from gradle:</p>

<pre><code>D:\\devel\\git\\SmartIO\\build\\objs\\smartioTestCUnitExe\\smartioTestCpp\\102afk7z0mm9rbcvlxwqfb3lp\\CUnitMain.obj:CUnitMain.cpp:(.text+0x4b): undefined reference to `CU_assertImplementation'
D:\\devel\\git\\SmartIO\\build\\objs\\smartioTestCUnitExe\\smartioTestCpp\\102afk7z0mm9rbcvlxwqfb3lp\\CUnitMain.obj:CUnitMain.cpp:(.text+0x4b): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `CU_assertImplementation'
// ... omitted for brevity
D:\\devel\\git\\SmartIO\\build\\objs\\smartioTestCUnitExe\\smartioTestCunitLauncher\\e5tc4yn4yrorgux3jajanhtly\\gradle_cunit_main.obj:gradle_cunit_main.c:(.text+0x22): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `CU_get_number_of_failures'
D:\\devel\\git\\SmartIO\\build\\objs\\smartioTestCUnitExe\\smartioTestCunitLauncher\\e5tc4yn4yrorgux3jajanhtly\\gradle_cunit_main.obj:gradle_cunit_main.c:(.text+0x3c): undefined reference to `CU_get_failure_list'
</code></pre>

<p>Basically this tells me that gradle can't seem to find the library cunit but doesn't care to tell me about it. However, when I build it from the console, everything works fine. My example test file, nothing special:</p>

<pre><code>#include &lt;CUnit/Basic.h&gt;
#include &lt;CUnit/CUnit.h&gt;
#include &lt;CUnit/Console.h&gt;

int suite_init(void) {
    return 0;
}

int suite_clean(void) {
    return 0;
}

void test_example(void) {
    CU_ASSERT(3 == 2);
}

void gradle_cunit_register() {
    CU_pSuite mySuite = CU_add_suite("operator tests", suite_init, suite_clean);
    CU_add_test(mySuite, "test", test_example);
}

#ifdef OUTSIDE_GRADLE
int main() {
    CU_initialize_registry();
    gradle_cunit_register();
    CU_console_run_tests();
}
#endif
</code></pre>

<p>Can someone tell me what I'm missing and how I am able to use the version of cunit that is preinstalled on my system?</p>