summaryrefslogtreecommitdiff
path: root/libs/cglm/test/CMakeLists.txt
blob: 26fef9c1db95dfe9cdea9c9416d826b3e8b89a93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
cmake_minimum_required(VERSION 3.8.2)

# List all files containing tests. (Change as needed)
set(TESTFILES
  runner.c
  src/test_euler.c
  src/test_bezier.c
  src/test_cam.c
  src/test_cam_lh_zo.c
  src/test_cam_rh_zo.c
  src/test_cam_lh_no.c
  src/test_cam_rh_no.c
  src/test_struct.c
  src/test_clamp.c
  src/test_common.c
  src/tests.c
  )

set(TEST_MAIN tests)
set(TEST_RUNNER_PARAMS "")

add_executable(${TEST_MAIN} ${TESTFILES})
target_compile_definitions(${TEST_MAIN} PRIVATE CGLM_DEFINE_PRINTS=1)

if(NOT MSVC)
  target_link_libraries(${TEST_MAIN} PRIVATE m)
endif()

target_link_libraries(${TEST_MAIN} PRIVATE cglm)
target_include_directories(${TEST_MAIN} PRIVATE
  ${CMAKE_CURRENT_LIST_DIR}/include
  ${CMAKE_CURRENT_LIST_DIR}/src
  )

set_target_properties(${TEST_MAIN} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR})

if(LDFLAGS)
  target_compile_options(${TEST_MAIN} PRIVATE ${LDFLAGS})
endif()

add_test(
    NAME cglm.${TEST_MAIN}
    COMMAND ${TEST_MAIN} ${TEST_RUNNER_PARAMS})

add_custom_target(check
  make
  COMMAND ${CMAKE_CTEST_COMMAND} -V
  DEPENDS cglm)