0

I am using gn as make system, and I have a shared libS which deps libA and libB, but I want to functions in libA are not linked into libS ( it will be linked into main ) while functions libB are linked into libS.

My problem is:

  1. If I use deps or public deps for libA, the include path will be added ( it is what I want) but all functions will also be linked too ( it is not what I want)
  2. If I use data_deps, the functions will not be linked (I want), but the include path will not be added too ( not I want )
Hui.Li
  • 399
  • 4
  • 18

1 Answers1

0

If you only want libS to have libA's include paths, you can use a config.

//path/to/libA/BUILD.gn:

config("config") {
  include_dirs = [ "include" ]
}

static_library("libA") {
  public_configs = [ ":config" ]
  sources = [ ... ]
  # etc
}

//path/to/libS/BUILD.gn:

shared_library("libS") {
  configs = [ "//path/to/libA:config" ]
  deps = [ "//path/to/libB" ]
}

This way GN will add -Ipath/to/libA to the compile lines for the sources in libS, but not add anything from libA to the link line.

Charles Nicholson
  • 888
  • 1
  • 8
  • 21