I have installed mosquitto lib
in my Rpi using this tutorial.
/usr/local/bin
has mosquitto_pub and mosquitto_sub
and the mosquitto server deamon is in /usr/local/sbin
.
Then trying to link the library in my cmake file as follow.
cmake_minimum_required(VERSION 2.6)
PROJECT(MosquittoTest)
# The version number.
set (VERSION_MAJOR 1)
set (VERSION_MINOR 0)
include_directories("${PROJECT_BINARY_DIR}")
# Linked libariries
#For MQTT
#location of raspicam's cmake file is /usr/src/raspicam-0.1.3/build
link_directories(/usr/local/sbin)
target_link_libraries (MosquittoTest mosquitto)
ADD_EXECUTABLE(MosquittoTest MosquittoTest.cpp)
# add the install targets
install (TARGETS MosquittoTest DESTINATION bin)
install (FILES MosquittoInterface.h DESTINATION include)
Then I have error as Can't specify link library for target MosquittoTest.
Somebody has link the mosquitto lib in gcc make as
CC = gcc
CFLAGS = -I
DEPS = mosquitto.h
LIBS = -llibmosquitto
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
make: test.c
$(CC) -m32 -Wall -o $@ $^ $(CFLAGS) $(LIBS)
.PHONY: clean
What could be wrong with my cmake file?