This commit is contained in:
2025-03-21 15:07:00 +01:00
parent 96571390b2
commit 3540881edb
7 changed files with 211 additions and 324 deletions
+1 -12
View File
@@ -1,35 +1,24 @@
# 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")
# 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})
target_compile_options(${EXEC_NAME} PRIVATE -O1)
target_compile_options(${EXEC_NAME} PRIVATE -O2 -Wall -Wextra -Werror -Wno-unused-parameter)
# Link the necessary libraries and object files from lib/
target_link_libraries(${EXEC_NAME} PRIVATE libfm ${LINK_LIBS})
install(TARGETS ${EXEC_NAME}