2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-11-28 08:43:26 +00:00
rules_foreign_cc/examples/cmake_with_bazel_transitive/BUILD.bazel
UebelAndre 32e222aeff
Enable more examples tests on windows (#718)
* Enable examples tests on windows

* Fixed windows absolute paths being treated as relative.

* Escape windows backslashes for sed replacement

* Improve `//cmake_hello_world_lib/static:libhello` example
2021-07-14 09:37:35 -07:00

36 lines
1.1 KiB
Python

load("@rules_cc//cc:defs.bzl", "cc_test")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
# Example of the cmake_external target built with Bazel-built dependency
cmake(
name = "cmake_libb",
cache_entries = {
# CMake's find_package wants to find cmake config for liba,
# which we do not have -> disable search
"CMAKE_DISABLE_FIND_PACKAGE_LIBA": "True",
# as currently we copy all libraries, built with Bazel, into $EXT_BUILD_DEPS/lib
# and the headers into $EXT_BUILD_DEPS/include
"LIBA_DIR": "$EXT_BUILD_DEPS",
},
generate_args = ["-GNinja"],
lib_source = "//cmake_with_bazel_transitive/libb:b_srcs",
out_static_libs = select({
"//:windows": ["libb.lib"],
"//conditions:default": ["libb.a"],
}),
# This library is with public visibility, we can reuse it here.
deps = ["//cmake_synthetic/liba:lib_a_bazel"],
)
# And cc_test built with cmake_external dependency and transitive Bazel dependency
cc_test(
name = "test",
srcs = [
"test_libb.cpp",
],
deps = [
# liba should come from transitive dependencies
":cmake_libb",
],
)