CMake: checks linux kernel headers

This commit is contained in:
Carter Li
2026-06-13 08:26:27 +08:00
committed by 李通洲
parent 17914dc29e
commit ebb0cf77bd
2 changed files with 13 additions and 0 deletions
+7
View File
@@ -63,6 +63,13 @@ endif()
include(CheckIncludeFile)
if(LINUX)
CHECK_INCLUDE_FILE("linux/version.h" HAVE_LINUX_VERSION_H)
if(NOT HAVE_LINUX_VERSION_H)
message(FATAL_ERROR "Linux headers (linux/version.h) not found! Please install linux-headers package.")
endif()
endif()
#####################
# Configure options #
#####################
+6
View File
@@ -17,6 +17,9 @@
#else
#include <signal.h>
#endif
#if __linux__
#include <linux/version.h>
#endif
FFinstance instance; // Global singleton
@@ -190,6 +193,9 @@ void ffDestroyInstance(void) {
// Must be in a file compiled with the libfastfetch target, because the FF_HAVE* macros are not defined for the executable targets
void ffListFeatures(void) {
fputs(
#if __linux__
"linux-headers " FF_STR(LINUX_VERSION_MAJOR) "." FF_STR(LINUX_VERSION_PATCHLEVEL) "." FF_STR(LINUX_VERSION_SUBLEVEL) "\n"
#endif
#if FF_HAVE_THREADS
"threads\n"
#endif