diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2026-10-06 02:17:37 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-10-06 02:17:37 +0300 |
| commit | d33028de8b8b520dfde12d9d9d01f4cd576f23b3 (patch) | |
| tree | 242dcc8c207dfa314a1a82890ca68536c51da7d9 /cmake/install-kernel-module.cmake | |
| parent | 50c54c477624d5a9b668225fde2b9844d362760a (diff) | |
| parent | dbc9d0fb6863026b16f4805709acc7e4977d7e66 (diff) | |
| download | accel-ppp-d33028de8b8b520dfde12d9d9d01f4cd576f23b3.tar.gz accel-ppp-d33028de8b8b520dfde12d9d9d01f4cd576f23b3.zip | |
Merge pull request #358 from nuclearcat/fix/kernel-module-install
cmake: fix kernel module installation
Diffstat (limited to 'cmake/install-kernel-module.cmake')
| -rw-r--r-- | cmake/install-kernel-module.cmake | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/cmake/install-kernel-module.cmake b/cmake/install-kernel-module.cmake new file mode 100644 index 00000000..1350e7c9 --- /dev/null +++ b/cmake/install-kernel-module.cmake @@ -0,0 +1,35 @@ +if (NOT DEFINED KERNEL_BUILD_DIR OR KERNEL_BUILD_DIR STREQUAL "") + message(FATAL_ERROR "Kernel build directory is not set") +endif () + +if (NOT DEFINED KERNEL_MODULE_BUILD_DIR OR + KERNEL_MODULE_BUILD_DIR STREQUAL "") + message(FATAL_ERROR "Kernel module build directory is not set") +endif () + +set(_install_command + make -C "${KERNEL_BUILD_DIR}" + "M=${KERNEL_MODULE_BUILD_DIR}" + modules_install +) + +# DESTDIR is the conventional CMake staging root. The kernel build system +# uses INSTALL_MOD_PATH for the same purpose, so propagate it explicitly. +if (NOT "$ENV{DESTDIR}" STREQUAL "") + list(APPEND _install_command "INSTALL_MOD_PATH=$ENV{DESTDIR}") +endif () + +execute_process( + COMMAND ${_install_command} + RESULT_VARIABLE _install_result +) + +if (NOT "${_install_result}" STREQUAL "0") + message(FATAL_ERROR + "Failed to install kernel module from " + "${KERNEL_MODULE_BUILD_DIR} (exit status: ${_install_result})" + ) +endif () + +unset(_install_command) +unset(_install_result) |
