CMakeLists.txt 950 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
if (HB_HAVE_GLIB)
  file (READ "${CMAKE_CURRENT_SOURCE_DIR}/Makefile.am" MAKEFILEAM)
  extract_make_variable (TEST_PROGS ${MAKEFILEAM})

  list (APPEND TEST_PROGS
    test-ot-tag
    test-c
    test-cplusplus
  )

  if (HB_HAVE_FREETYPE)
    list (APPEND TEST_PROGS test-ot-math)
  endif ()

  foreach (test_name IN ITEMS ${TEST_PROGS})
K
Khaled Hosny 已提交
16 17 18 19 20
    if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.c)
      add_executable (${test_name} ${test_name}.c)
    elseif (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${test_name}.cc)
      add_executable (${test_name} ${test_name}.cc)
    else ()
21
      message (FATAL_ERROR "No source file found for test ${test_name}")
K
Khaled Hosny 已提交
22
    endif ()
23
    target_link_libraries (${test_name} harfbuzz harfbuzz-subset)
K
Khaled Hosny 已提交
24 25
    add_test (${test_name} ${test_name})
  endforeach ()
26
  set_tests_properties (${TEST_PROGS} PROPERTIES ENVIRONMENT
K
Khaled Hosny 已提交
27
    "G_TEST_SRCDIR=${CMAKE_CURRENT_SOURCE_DIR};G_TEST_BUILDDIR=${CMAKE_CURRENT_BINARY_DIR}"
28 29
  )
endif ()