Imported Upstream version 1.8.1
[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     if (WIN32)
25       set_property (TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
26       add_test (NAME ${test_name} COMMAND ${test_name})
27     else (WIN32)
28       add_test (${test_name} ${test_name})
29     endif (WIN32)
30   endforeach ()
31   set_tests_properties (${TEST_PROGS} PROPERTIES ENVIRONMENT
32     "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}"
33   )
34 endif ()