1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
When importing a local library's header using two soft-links to relative
destinations it's also possible to define a single soft-link to the absolute
location of the directory containing the library's headers. There's no
compelling reason for using relative or absolute destinations. Maybe if the
relative path specification becomes complex using the absolute destination is
slightly more attractive.
Using the tt(~/project/main.cc) from the previous section define a soft-link
to the absolute location of the library's tt(hdrs) sub-directory in the
project's tt(gcm.cache) sub-directory (note: here no comma is used):
verb( ln -s ~/support/locallib/hdrs gcm.cache)
Next compile tt(main.cc) using
verb(g++ -c -fmodules-ts -isystem ~/support/locallib/hdrs main.cc)
itemization(
it() In tt(gcm.cache) the full path to tt(hdrs) is not required, but at least
first sub-directory name must be be specified (since tt(~/...) refers to
the user's home directory, which commonly begins at tt(/home/...) the link
could be defined as tt(ln -s /home gcm.cache/)).
it() The soft-link name itself can freely be chosen and doesn't have to be
equal to the final destination. E.g., after defining the links
verb( ln -s ~/support/locallib/hdrs /tmp/locallib
ln -s /tmp gcm.cache)
the compilation command is:
verb( g++ -c -fmodules-ts -isystem /tmp/locallib main.cc)
)
|