Dependency Mappings
When migrating from CMake, rebaze needs to know how to translate CMake dependencies to Bazel targets.
Types of Dependencies
Section titled “Types of Dependencies”CMake projects reference dependencies in several ways:
| CMake Pattern | Example | Mapping Section |
|---|---|---|
-l flag | -lz, -lssl | system_libraries |
| Plain name | gtest, boost | plain_libraries |
| Package::Component | OpenSSL::SSL | packages |
| Implicit | pthread, m | implicit_system_libs |
System Libraries
Section titled “System Libraries”Map -l flags to Bazel targets:
[mappings.system_libraries]z = "@zlib"zlib = "@zlib"ssl = "@openssl//:ssl"crypto = "@openssl//:crypto"curl = "@curl"Plain Libraries
Section titled “Plain Libraries”Map plain library names (without -l or ::):
[mappings.plain_libraries]gtest = "@googletest//:gtest"gtest_main = "@googletest//:gtest_main"gmock = "@googletest//:gmock"benchmark = "@google_benchmark//:benchmark"CMake Packages
Section titled “CMake Packages”Map find_package() targets using patterns:
[mappings.packages.Boost]target_pattern = "@boost//:{component}"
[mappings.packages.Boost.components]filesystem = "@boost//:filesystem"system = "@boost//:system"The {component} placeholder is replaced with the actual component name.
Example: OpenSSL
Section titled “Example: OpenSSL”[mappings.packages.OpenSSL]target_pattern = "@openssl//:{component}"
[mappings.packages.OpenSSL.components]SSL = "@openssl//:ssl"Crypto = "@openssl//:crypto"Maps:
OpenSSL::SSL→@openssl//:sslOpenSSL::Crypto→@openssl//:crypto
Implicit System Libraries
Section titled “Implicit System Libraries”Libraries provided by the system:
[mappings]implicit_system_libs = ["pthread", "c", "m", "dl", "rt"]These are silently ignored during migration.
Ignored Libraries
Section titled “Ignored Libraries”Libraries to skip completely:
[mappings]ignored_libraries = ["fmt", "spdlog", "Threads::Threads"]Transitive Dependencies
Section titled “Transitive Dependencies”Define dependencies that should be pulled in transitively:
[mappings.transitive_deps]glib = ["pcre2", "libffi", "zlib"]curl = ["zlib", "openssl"]Priority Order
Section titled “Priority Order”When resolving a dependency:
ignored_libraries- Skip if listedimplicit_system_libs- Skip if listed-lprefix →system_libraries::separator →packages- Plain name →
plain_libraries - Default → Warning, dependency skipped