Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what's difference between cc_library and cc_import

Tags:

bazel

what's difference between cc_library and cc_import when import prebuild so library.

I noticed that

  1. cc_library can use multi library but cc_import can just use one.
  2. cc_library can use strip_include_prefix but cc_import not.
like image 890
daohu527 Avatar asked Oct 27 '25 09:10

daohu527


1 Answers

The difference between cc_library and cc_import is that the first one is intended to compile a shared library (.so/.dll files) and make it available as a dependency for other targets, such as executables or tests. It essentially requires you to have your whole library source code and builds from scratch, meanwhile cc_import is used to link prebuild libraries that already exist in your system. This way, you can use external dependencies like Boost or Qt and do not need to do a clean build of those libraries.

like image 99
Владислав Король Avatar answered Oct 29 '25 08:10

Владислав Король