cc_library name with path elements

14 views
Skip to first unread message

Gabriel Schulhof

unread,
May 4, 2021, 1:56:04 PMMay 4
to bazel-discuss
Hi, all!

When I write

cc_library(
    name = "some/path/to/the-library",
    srcs = [ "some/path/to/the-library.c" ],
    ...
)

I expect it to produce

some/path/to/libthe-library.so

not

some/path/to/some/path/to/libthe-library.so

Why does it do this? Is this a bug? Is this intentional?

I know I could add a BUILD file into some/path/to where I write

cc_library(
    name = "the-library",
    srcs = [ "the-library.c" ],
    ...
)

and that would probably produce a library at the expected location, but for a very good reason, namely that some/path/to is initially a tarball being expanded by a genrule as part of the build process, in my project I have to place the BUILD file a few directory levels up from where I need the library.

So, aside from a kludgy genrule that moves the resulting .so file to where it belongs, is there anything else I can do?

Please let me know, and thank you in advance for your advice,

Best regards,



Gabriel
Reply all
Reply to author
Forward
0 new messages