How to link with static library from same dub file

507 Views Asked by At

I have a dub.json file that looks like:

{
    "name": "myProject",

    "configurations":
    [
        {
            "name": "myLib",
            "targetType": "staticLibrary",

            "sourcePaths": ["myLibSrcDir"],
            "importPaths": ["myLibSrcDir"],
            "targetPath": "build",
        },

        {
            "name": "myExe",
            "targetType": "executable",

            "sourcePaths": ["myLibSrcDir"],
            "importPaths": ["myLibSrcDir"],
            "targetPath": "build",

            "libs": ["$PACKAGE_DIR/build/myLib.a"]
        }
    ]
}

When I build with dub --config=myExe I get the following linker error: cannot find -l/home/myUser/myProject/build/myLib.a even if the library is there.

How may I link a static library generated in the same dub file? I think this is a pretty common case (library + test/sample executables), but I couldn't find any samples.

0

There are 0 best solutions below