Use GBM_LDFLAGS to get all link options
If gbm is install in a non-standard path, setting PKG_CONFIG_PATH will allow pkg_check_modules(GBM) to succeed but then the CHECK_FUNCTION_EXISTS checks will fail because they only pass "-lgbm".
Using ${GBM_LDFLAGS} will add all the needed flags (including -L/path/to/gbm/)