cmake_minimum_required(VERSION 3.10) project(fatfs) if(NOT FATFS_CONFIG_DIRECTORY) message(FATAL_ERROR "FATFS_CONFIG_DIRECTORY should be defined") elseif(NOT EXISTS ${FATFS_CONFIG_DIRECTORY}/ffconf.h) message(FATAL_ERROR "ffconf.h should be included in the directory.") endif() set(FATFS_SRCS "source/ff.c" "source/ffunicode.c" ) set(FATFS_INCS "include" ) add_library(${PROJECT_NAME} ${FATFS_SRCS}) target_include_directories(${PROJECT_NAME} PUBLIC ${FATFS_INCS} ${FREERTOS_CONFIG_FILE_DIRECTORY})