cc_library to include header files from different folder

391 views
Skip to first unread message

Uma Patil

unread,
Mar 27, 2023, 7:23:55 PM3/27/23
to bazel-discuss
Hi Everyone,

I want to include the header files present in different folders in my cc_library. This the structure of my project and app1.c uses ipc/ipc.h and /../bsp/ipc/foo.h but the #inlcude has only files names and no relative path to the files. And I don't have access to the source code to change the #inlcude in c program. So I want to write BUILD file for app1 to include header files from different folders. I tried this but it's not working. Could anyone please help me to achieve this.

cc_library(
  name = "app1",
  srcs = ["app1.c"],
  hdrs = glob(["ipc/*.h"]),
  copts = ["-I$(execpath //ipc:ipc)"],
#   deps = ["//examples/PDS/app/ipc:ipc"],
  visibility = ["//visibility:public"],

)

My Project Structure:

app/

    data_app/

              app1.c

              BUILD

    App1/

               foo.c

              BUILD

    ipc/

              ipc.h

    BUILD

    App.c


Bsp/

   Ipc/

       Foo.h



Thank you,

Uma


Ziad

unread,
Mar 28, 2023, 4:16:35 AM3/28/23
to bazel-discuss
you will need to expose the headers via targets and then use labels
Reply all
Reply to author
Forward
0 new messages