Linking library with cmake C++

2019-08-24 18:12发布

问题:

I'm trying to incorporate libevdev into my project. I cloned the source into a subdirectory in my project and included the given header. But as I want to compile, I get a linker error

undefined reference to `libevdev_new_from_fd'

I tried to add the following to my CMakeLists.txt:

add_library (evdevlib libevdev/libevdev/libevdev.c)
target_link_libraries(${PROJECT_NAME} evdevlib)

but now its missing some config.h. What am I missing?

标签: c++ cmake linker