Search code examples
c++linuxbjam

Boost-bjam: link result with precompiled library


What should I put into my jamroot.jam file so that libAPLibrary.so is linked with the result of MyProject compilation?

root
  |-MyProject
  |   |-jamroot.jam
  |
  |-AnotherProject
      |-lib
          |-libAPLibrary.so 

Solution

  • if the library libAPLibrary.so is already compiled one you should declare it and the link it against the project, this way:

    lib libAPLibrary : : 
        # watch out for empty spaces, they are mandatory
        <file>../AnotherProject/lib/libAPLibrary.so ;
    
    exe MyProject
        : 
            # your project sources here
            # this is a generic filter but you 
            # can replace it with file names
            [ glob *.c* ] 
    
            # external libraries
            libAPLibrary
    ;