Skip to content

Commit

Permalink
Fix test target on macOS with Bazel@HEAD (#475)
Browse files Browse the repository at this point in the history
* Fix test target on macOS with Bazel@HEAD

supports_dynamic_linker feature was removed from cc toolchain for macOS,
cc_binary should be used to build shared library.

Context: bazelbuild/bazel#4341 (comment)

* Fix test on Windows
  • Loading branch information
meteorcloudy authored Jan 26, 2021
1 parent 4d4acaa commit 8ae4651
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions examples/cmake_with_data/lib_b/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load("@rules_cc//cc:defs.bzl", "cc_binary")

cc_library(
cc_binary(
name = "lib_b",
srcs = ["src/lib_b.cpp"],
hdrs = ["src/lib_b.h"],
linkstatic = False,
srcs = [
"src/lib_b.cpp",
"src/lib_b.h",
],
linkshared = True,
visibility = ["//cmake_with_data:__pkg__"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main(int argc, char* argv[])
{
// Make sure the expectd shared library is available
#ifdef _WIN32
test_opening_file(".\\cmake_with_data\\lib_b\\lib_b.lib");
test_opening_file(".\\cmake_with_data\\lib_b\\lib_b.dll");
#else
test_opening_file("./cmake_with_data/lib_b/liblib_b.so");
#endif
Expand Down

0 comments on commit 8ae4651

Please sign in to comment.