mons/mons_math/CMakeLists.txt

44 lines
1010 B
CMake

cmake_minimum_required(VERSION 3.14)
project(mons_math LANGUAGES C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
set(CMAKE_BUILD_TYPE "Debug")
add_library(mons_math
SHARED
./src/mat2.c
./src/mat3.c
./src/mat4.c
./src/vec2.c
./src/vec3.c
./src/vec4.c
./src/util.c
./src/quat.c
)
target_include_directories(mons_math PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/include"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
target_compile_options(mons_math PRIVATE -coverage)
target_link_options(mons_math PRIVATE -coverage)
target_link_libraries(mons_math PUBLIC m)
include(CTest)
function(TESTCASE NAME)
add_executable(test_${NAME} ./tests/${NAME}.c)
target_link_libraries(test_${NAME} PUBLIC mons_math)
add_test(
NAME ${NAME}
COMMAND $<TARGET_FILE:test_${NAME}>
)
endfunction()
testcase(vec2_ops)
testcase(vec3_ops)
testcase(vec4_ops)
# testcase(mat2_ops)
# testcase(mat3_ops)
# testcase(mat4_ops)