I am writing a project in C using the ZeroMQ library. I need to use a static library. CMakeLists.txt:
cmake_minimum_required(VERSION 3.17)
project(client C CXX)
set(CMAKE_C_STANDARD 99)
find_library(czmq_location NAMES libczmq.a)
message(STATUS ${czmq_location})
add_library(czmq STATIC IMPORTED)
set_target_properties(czmq PROPERTIES IMPORTED_LOCATION ${czmq_location})
add_executable(client client.c ft_lib_c/clib.c ft_lib_c/clib.h ft_lib_c/itoa.c ft_lib_c/itoa.h)
target_link_libraries(client czmq )
However, when building, I get a lot of errors -_-:
CMakeFiles/client.dir/client.c.o: In function `main':
/home/neleps/MMS_radar_projects/master/client/client.c:18: undefined reference to `zmq_ctx_new'
/home/neleps/MMS_radar_projects/master/client/client.c:20: undefined reference to `zmq_socket'
/home/neleps/MMS_radar_projects/master/client/client.c:22: undefined reference to `zmq_connect'
....
That is, the functions from the library are not visible . What am I doing wrong?
Thank you in advance for your help :)