Developing Linux drivers with CLion. Follow
I'm having some trouble getting CMake to build Linux Kernel Modules. There are some headers I need that aren't in the path expected for the linux headers. I have the headers on my computer, but the headers are located per each installed kernel, rather than under /usr/include/linux
What I currently have for CMake:
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
project(driver)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
set(HEADERS
razerchromacommon.h
razercommon.h
razerfirefly_driver.h
razerkbd_driver.h
razermouse_driver.h)
set(SOURCE
razerchromacommon.c
razercommon.c
razerfirefly_driver.c
razerkbd_driver.c
razermouse_driver.c)
#execute_process(COMMAND uname -r
# RESULT_VARIABLE INSTALLED_KERNEL)
#message(${INSTALLED_KERNEL})
#set(INCLUDE_DIRS
# /usr/lib/modules/${INSTALLED_KERNEL}/build/include/linux/usb/)
#include_directories(${INCLUDE_DIRS})
add_executable(driver ${HEADERS} ${SOURCE})
Would just calling the Linux kernel kbuild work with CLion?
Please sign in to leave a comment.
So, I've had some success with finding headers. The only problem is the current CMakeLists I have going would need all of the current kernels headers and preprocessor variables. I'm going to see if I can get kbuild working through cmake. Does anyone know if having CMake call KBuild would work with CLion?
Here's what I have so far:
Did you manage to solve this issue eventually? I'm trying to do the same thing without any success.