3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-07-15 03:25:43 +00:00

fix(bazel): pin CMake library installs to lib

rules_foreign_cc expects libraries under its default lib output directory.
GNUInstallDirs may instead select lib64, causing Bazel to reject an
otherwise successful CMake build because its declared output is missing.

Share the default CMake arguments between the static and dynamic targets
and set CMAKE_INSTALL_LIBDIR to lib.
This commit is contained in:
Simon Scatton 2026-07-14 15:32:58 +02:00
parent eae0530675
commit 048de2605b

View file

@ -16,10 +16,14 @@ filegroup(
srcs = glob(["**"]), srcs = glob(["**"]),
) )
_DEFAULT_CMAKE_GENERATE_ARGS = [
"-G Ninja",
"-D CMAKE_INSTALL_LIBDIR=lib", # Matches rules_foreign_cc's default out_lib_dir.
]
cmake( cmake(
name = "z3_dynamic", name = "z3_dynamic",
generate_args = [ generate_args = _DEFAULT_CMAKE_GENERATE_ARGS + [
"-G Ninja",
"-D Z3_EXPORTED_TARGETS=", # prevents installation, leaving symlinks between dylibs intact on copy "-D Z3_EXPORTED_TARGETS=", # prevents installation, leaving symlinks between dylibs intact on copy
], ],
lib_source = ":all_files", lib_source = ":all_files",
@ -44,8 +48,7 @@ cmake(
cmake( cmake(
name = "z3_static", name = "z3_static",
generate_args = [ generate_args = _DEFAULT_CMAKE_GENERATE_ARGS + [
"-G Ninja",
"-D BUILD_SHARED_LIBS=OFF", "-D BUILD_SHARED_LIBS=OFF",
"-D Z3_BUILD_LIBZ3_SHARED=OFF", "-D Z3_BUILD_LIBZ3_SHARED=OFF",
], ],