2.1. Compiling and Linking Client Code

The build system installs not only header files and the actual library, but also a pkg-config file. The following assumes that the path <install prefix>/lib/pkgconfig has been added to the environment variable PKG_CONFIG_PATH.

When compiling code using libMØD then the following scheme can be used:

g++ $(pkg-config --cflags mod) <normal compilation arguments>

Linking can be done in the same way:

g++ <normal linking arguments> $(pkg-config --libs mod)

And as a Makefile fragment (download):

PKG_CONFIG_PATH := ${PKG_CONFIG_PATH}:<installation path>/lib/pkgconfig
CPPFLAGS        := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags mod)
CXXFLAGS        := -std=c++11
LDLIBS          := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --libs mod)

test: test.o
    $(CXX) -o test test.o $(LDLIBS)