@@ -146,8 +146,48 @@ ctest -VV # -VV is optional since it enables verbose output
146146```
147147
148148### Bazel
149-
150- Please refer to [ hedronvision/bazel-make-cc-https-easy] ( https://github.com/hedronvision/bazel-make-cc-https-easy ) .
149+ Please refer to [ hedronvision/bazel-make-cc-https-easy] ( https://github.com/hedronvision/bazel-make-cc-https-easy ) or
150+
151+ ` cpr ` can be added as an extension by adding the following lines to your bazel MODULE file (tested with Bazel 8). Edit the versions as needed.
152+ ``` starlark
153+ bazel_dep(name = " curl" , version = " 8.8.0.bcr.3" )
154+ bazel_dep(name = " platforms" , version = " 0.0.11" )
155+ bazel_dep(name = " zlib" , version = " 1.3.1.bcr.5" )
156+ bazel_dep(name = " boringssl" , version = " 0.20250212.0" )
157+ bazel_dep(name = " rules_foreign_cc" , version = " 0.14.0" )
158+
159+ http_archive = use_repo_rule(" @bazel_tools//tools/build_defs/repo:http.bzl" , " http_archive" )
160+ http_archive(
161+ name = " cpr" ,
162+ url = " https://github.com/libcpr/cpr/archive/refs/tags/1.11.2.tar.gz" ,
163+ strip_prefix = " cpr-1.11.2" ,
164+ sha256 = " 3795a3581109a9ba5e48fbb50f9efe3399a3ede22f2ab606b71059a615cd6084" ,
165+ build_file_content = """
166+ load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
167+
168+ filegroup(
169+ name = "srcs",
170+ srcs = glob(["**"], ["bazel-*/**"]),
171+ visibility = ["//visibility:public"],
172+ )
173+
174+ cmake(
175+ name = "cpr",
176+ cache_entries = {
177+ },
178+ tags = ["requires-network"],
179+ includes = ["include/cpr"],
180+ lib_source = ":srcs",
181+ out_shared_libs = select({
182+ "@platforms//os:macos": ["libcpr.dylib"],
183+ "@platforms//os:windows": ["libcpr.dll"],
184+ "//conditions:default": ["libcpr.so.1"],
185+ }),
186+ visibility = ["//visibility:public"],
187+ )
188+ """
189+ )
190+ ```
151191
152192### Packages for Linux Distributions
153193
0 commit comments