mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
34 lines
1.0 KiB
CMake
34 lines
1.0 KiB
CMake
# Set the minimum required CMake version
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# Define the project name and language
|
|
project(FMTools LANGUAGES C)
|
|
|
|
# Set the C standard (you can adjust this based on your project needs)
|
|
set(CMAKE_C_STANDARD 99)
|
|
set(CMAKE_C_STANDARD_REQUIRED YES)
|
|
|
|
# Find all C source files in the src/ directory
|
|
file(GLOB SRC_FILES "src/*.c")
|
|
|
|
# Find all C source files in the lib/ directory
|
|
file(GLOB LIB_FILES "lib/*.c")
|
|
|
|
# Create a library to hold all object files from lib/
|
|
add_library(libfm OBJECT ${LIB_FILES})
|
|
|
|
# Linker flags for libraries
|
|
set(LINK_LIBS "-lpulse -lpulse-simple -lm -lasound")
|
|
|
|
# Loop through each file in src and create an executable
|
|
foreach(SRC_FILE ${SRC_FILES})
|
|
# Get the filename without the directory and extension
|
|
get_filename_component(EXEC_NAME ${SRC_FILE} NAME_WE)
|
|
|
|
# Create the executable from each source file
|
|
add_executable(${EXEC_NAME} ${SRC_FILE})
|
|
|
|
# Link the necessary libraries and object files from lib/
|
|
target_link_libraries(${EXEC_NAME} PRIVATE libfm ${LINK_LIBS})
|
|
endforeach()
|