libcoap-1.pc: fix pkg-config include path

This change excludes the coap subdirectory from the include path
reported by pkg-config --cflags to avoid name conflicts with other
installed packages. Applications now must add the prefix 'coap/'
to include directives for libcoap header files, e.g.

  #include <coap/coap.h>

Jean-Claude Michelou has reported this problem in Bug #82 [1].

[1] https://github.com/obgm/libcoap/issues/82

A minimal Makefile now could look be written as:

  PKG_LIBCOAP=libcoap-1
  CPPFLAGS=$(shell pkg-config --cflags-only-I $(PKG_LIBCOAP)) -DWITH_POSIX
  LDFLAGS=$(shell pkg-config --libs-only-L $(PKG_LIBCOAP))
  LDLIBS=$(shell pkg-config --libs-only-l $(PKG_LIBCOAP))
This commit is contained in:
Olaf Bergmann committed 2017-06-01 12:33:04 +02:00
1 parent 0b3f31a1bb
commit 6d7ba61ae0
7 files changed
+11 -11

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@
if BUILD_EXAMPLES
# picking up the default warning CFLAGS into AM_CFLAGS
AM_CFLAGS = -isystem$(top_builddir)/include/coap -I$(top_srcdir)/include/coap $(WARNING_CFLAGS) -std=c99
AM_CFLAGS = -isystem$(top_builddir)/include -I$(top_srcdir)/include $(WARNING_CFLAGS) -std=c99
# etsi_iot_01 and tiny are missing
bin_PROGRAMS = coap-client coap-server coap-rd
+1 -1
View File
@@ -23,7 +23,7 @@
#include <arpa/inet.h>
#include <netdb.h>
#include "coap.h"
#include <coap/coap.h>
#include "coap_list.h"
int flags = 0;
+3 -3
View File
@@ -34,9 +34,9 @@
#include <signal.h>
#include "coap_config.h"
#include "utlist.h"
#include "resource.h"
#include "coap.h"
#include <coap/utlist.h>
#include <coap/resource.h>
#include <coap/coap.h>
#define COAP_RESOURCE_CHECK_TIME 2
+2 -2
View File
@@ -26,8 +26,8 @@
#include <signal.h>
#include "coap_config.h"
#include "resource.h"
#include "coap.h"
#include <coap/resource.h>
#include <coap/coap.h>
#define COAP_RESOURCE_CHECK_TIME 2
+2 -2
View File
@@ -13,8 +13,8 @@
#include <stdio.h>
#include <string.h>
#include "debug.h"
#include "mem.h"
#include <coap/debug.h>
#include <coap/mem.h>
#include "coap_list.h"
+1 -1
View File
@@ -11,7 +11,7 @@
#ifndef _COAP_LIST_H_
#define _COAP_LIST_H_
#include "utlist.h"
#include <coap/utlist.h>
typedef struct coap_list_t {
struct coap_list_t *next;
+1 -1
View File
@@ -8,4 +8,4 @@ Description: C-Implementation of CoAP.
Version: @PACKAGE_VERSION@
URL: @PACKAGE_URL@
Libs: -L${libdir} -lcoap-@LIBCOAP_API_VERSION@
Cflags: -I${includedir}/coap
Cflags: -I${includedir}