I am having trouble finding a way to linking the czmq library when using CMake. I can compile code using the czmq library with gcc myprog.c -lczmq
just fine.
My project structure looks like this:
src/...
include/...
build/...
CMakeLists.txt
The src/
folder contains the .c
files and corresponding .h
files. The include/
folder contains the library header.
My current CmakeLists.txt
looks like this:
cmake_minimum_required(VERSION 3.10)
project(mylib)
set(CMAKE_BUILD_TYPE Release)
#Header
include_directories(include)
#Src files, GLOB allows for wildcard additions
file(GLOB SOURCES "src/*c")
#Generate the shared library from the sources
add_library(mylib SHARED ${SOURCES})
#Set location for the library installation
install(TARGETS mylib DESTINATION .)