2
0
Fork 0
mirror of https://github.com/bazel-contrib/rules_foreign_cc synced 2024-12-03 02:52:58 +00:00
rules_foreign_cc/examples/cmake_synthetic/BUILD.bazel
James Sharpe b136e6c52d
Add config for building with spawn_strategy=standalone (#603)
* Add config for building with spawn_strategy=standalone

* Always build RELEASE configuration to avoid having to select for the output due to change in artifact names for debug builds

* Fix for copy_contents_to_dir and symlink_contents_to_dir on macOS as per #512

* Update name of test files
2021-05-05 17:47:25 -07:00

51 lines
1.2 KiB
Python

load("@bazel_skylib//rules:build_test.bzl", "build_test")
load("@rules_cc//cc:defs.bzl", "cc_test")
load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
cmake(
name = "liba",
generate_args = ["-GNinja"],
# Demonstrate non-alphanumeric name
lib_name = "liba++",
lib_source = "//cmake_synthetic/liba:a_srcs",
postfix_script = "cp -p $$INSTALLDIR$$/lib/liba.a $$INSTALLDIR$$/lib/liba++.a",
)
cmake(
name = "libb",
generate_args = ["-GNinja"],
lib_source = "//cmake_synthetic/libb:b_srcs",
deps = [":liba"],
)
cmake(
name = "lib_with_duplicate_transitive_bazel_deps",
cache_entries = {
"LIBA_DIR": "$$EXT_BUILD_DEPS$$",
"LIBB_DIR": "$$EXT_BUILD_DEPS$$",
},
generate_args = ["-GNinja"],
lib_name = "libc",
lib_source = "//cmake_synthetic/libc:c_srcs",
deps = [
"//cmake_synthetic/liba:lib_a_bazel",
"//cmake_synthetic/libb:lib_b_bazel",
],
)
build_test(
name = "test_bazel_transitive_deps",
targets = [":lib_with_duplicate_transitive_bazel_deps"],
)
cc_test(
name = "test_libs",
srcs = [
"test_libb.cpp",
],
deps = [
# liba should come from transitive dependencies
":libb",
],
)