Reputation: 15
I'm using cmocka with Bazel and I want to import cmocka library in my test files (for c embedded code) like <cmocka.h> but I'm always getting: cmocka.h: No such file or directory.
my Build is:
cc_library(
name = "mock",
srcs = ["mock_i2c.c"],
deps = [":src"],
visibility = ["//visibility:public"],
linkstatic = True,
copts = ["-I test/cmocka/include"],
)
Upvotes: 0
Views: 177
Reputation: 1304
There is a includes attribute for that case, also you need to add your headers to hdrs
attribute:
cc_library(
name = "mock",
srcs = ["mock_i2c.c"],
deps = [":src"],
hdrs = glob(["test/cmocka/include/**/*.h"]),
visibility = ["//visibility:public"],
linkstatic = True,
includes= ["test/cmocka/include"],
)
Upvotes: 0