I've installed this lib (<https://github.com/eclip...
# kotlin-native
m
I've installed this lib (https://github.com/eclipse/paho.mqtt.c) and it's files are:
Copy code
$ ls /usr/local/lib

libpaho-mqtt3a.so    libpaho-mqtt3a.so.1.0  libpaho-mqtt3as.so.1    libpaho-mqtt3c.so    libpaho-mqtt3c.so.1.0  libpaho-mqtt3cs.so.1
libpaho-mqtt3a.so.1  libpaho-mqtt3as.so     libpaho-mqtt3as.so.1.0  libpaho-mqtt3c.so.1  libpaho-mqtt3cs.so     libpaho-mqtt3cs.so.1.0

$ ls /usr/local/include

MQTTAsync.h  MQTTClient.h  MQTTClientPersistence.h
I want to use it in my K/N app, like here: https://www.eclipse.org/paho/files/mqttdoc/MQTTClient/html/pubsync.html.
mqtt.def
that I created is:
Copy code
headers = MQTTClient.h MQTTClientPersistence.h
compilerOpts.linux = -I/usr/local/include
linkerOpts.linux = -L/usr/local/lib -lpaho-mqtt3c
And the non-working (fails with Kotlin NPE) bit of config from CMake is:
Copy code
konanc_library_search(paho-mqtt3c MQTTClient.h)
cinterop(
        NAME mqtt
        DEF_FILE mqtt.def
        COMPILER_OPTS "-I ${PAHO_MQTT3C_INCLUDE_DIR}"
)
In Gradle I used a config like this:
Copy code
interop("mqtt") {
	target("linux") {
		includeDirs("/usr/local/include")
	}
}
And it worked, but IntelliJ IDEA has no autocompletion for generated
mqtt.kt
, so I decided to try CLion. How can I include the lib? I guess I need to tell it the path to search the header, but I don't know how to do that in CMake...