Problem: I'm struggling to build against an external dependency included with angle brackets.
Background: I have a header file which includes the Eigen library as so:
#include <Eigen/Dense>
This is installed locally on the system as an external dependency. For various reasons, modifying how dependencies are installed isn't a realistic option currently.
So I need a consistent encapsulate external dependencies as Bazel targets. Currently I'm working on a header only target that looks like this:
cc_library(
name = "my_library",
hdrs = [ "some/local/header.h"],
textual_hdrs = ["@system_deps//:eigen3"],
deps = ["@system_deps//:eigen3"],
)
This is based on my understanding that (1) non-.h files need to be in textual_hdrs and (2) the fact that it definitely doesn't see it when it's not part of deps. But I admit I'm grasping in the dark here.
This of course points at my WORKSPACE:
new_local_repository(
name = "system_deps".
path = "/usr/include/eigen3",
build_file_content = """
cc_library(
name="eigen3",
textual_hrds = glob["Eigen/*"]),
visibility = ["//visibility:public"],
)
""",
)
Result: error: 'Eigen/Dense' file not found with blah blah
(This occurs when my header file is include somewhere else.)
Interestingly it does somehow find Eigen/Dense, as it complains (correctly) it can't find another file included. Not sure if
So: what's the right way to do this? I've read other similar questions but haven't quite grasped how to encapsulate these external dependencies.
Does the attribute cc_binary.includes help?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With