Imported Upstream version 1.7.6
[platform/upstream/harfbuzz.git] / test / api / CMakeLists.txt
1 if (HB_HAVE_GLIB)
2   file (READ "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am" MAKEFILEAM)
3   extract_make_variable (TEST_PROGS ${MAKEFILEAM})
4
5   list (APPEND TEST_PROGS
6     test-ot-tag
7     test-c
8     test-cplusplus
9   )
10
11   if (HB_HAVE_FREETYPE)
12     list (APPEND TEST_PROGS test-ot-math)
13   endif ()
14
15   foreach (test_name IN ITEMS ${TEST_PROGS})
16     if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.c)
17       add_executable (${test_name} ${test_name}.c)
18     elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.cc)
19       add_executable (${test_name} ${test_name}.cc)
20     else ()
21       message (FATAL_ERROR "No source file found for test ${test_name}")
22     endif ()
23     target_link_libraries (${test_name} harfbuzz harfbuzz-subset)
24     add_test (${test_name} ${test_name})
25   endforeach ()
26   set_tests_properties (${TEST_PROGS} PROPERTIES ENVIRONMENT
27     "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}"
28   )
29 endif ()