Using Bazel 2.2, how I can I build against external library, for example in my case I would like to build against boost (pre-built for MS VC++ 2019) , the question is this possible in Bazel?
Given that the local path to boost library is c:\boost_1_72_0, in which there are three folders bin, include and lib
If so how is it possible to tell the compiler and linker:
- path to include files
- path to lib files
- boost library specific .lib files to link (i.e. boost_context-vc142-mt-x64-1_72.lib)
I've tried the below cc_library but unfortunately it didn't work.
cc_library(
name = "boost",
srcs = glob(["*.lib"]),
hdrs = glob(["*.hpp", "*.*", "*"] + ["boost/*.hpp"] + ["boost/*/*.hpp"]),
includes = [
"C:/boost_1_72_0/include"
],
linkopts = ["-pthread","-LC:/boost_1_72_0/lib"],
visibility = ["//visibility:public"],
)
cc_binary(
name = "hello-bazel",
srcs = ["main.cpp", "SomeClass.h", "SomeClass.cpp"],
deps = [":boost"],
)