build(cmake): setup cmake build file

This commit is contained in:
Mineplay5780 2025-11-27 19:48:19 +01:00
parent f65d980956
commit 96a120e74e
2 changed files with 21 additions and 0 deletions

1
.gitignore vendored
View file

@ -66,3 +66,4 @@ CTestTestfile.cmake
_deps _deps
CMakeUserPresets.json CMakeUserPresets.json
./build

20
CMakeLists.txt Normal file
View file

@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.10)
project(cosms-core C)
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED ON)
include_directories(${PROJECT_SOURCE_DIR}/include)
file(GLOB_RECURSE SRC_FILES "${PROJECT_SOURCE_DIR}/Src/*.c")
add_library(cosms-core STATIC ${SRC_FILES})
add_executable(cosms-core-test ${PROJECT_SOURCE_DIR}/Tests/Main.c)
target_include_directories(cosms-core-test PRIVATE ${PROJECT_SOURCE_DIR}/Tests)
target_link_libraries(cosms-core-test cosms-core)
if (MSVC)
target_compile_options(cosms-core PRIVATE /W4 /Zl)
else()
target_compile_options(cosms-core PRIVATE -wall -Wextra -pedantic)
endif()