summaryrefslogtreecommitdiff
path: root/test/CMakeLists.txt
blob: a508f6ad116968471ac96c3d506841b1074b460d (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
49
50
51
52
53
54
55
if(MSVC)
  if(MSVC_VERSION LESS "1900")
    # < VS2015, no "/utf-8" option, can not build test
    return()
  endif()
endif()

enable_testing()

add_executable(test_utf8 test_utf8.c)
target_link_libraries(test_utf8 onig)
if(MSVC)
  target_compile_options(test_utf8 PRIVATE /utf-8)
endif(MSVC)

add_executable(test_syntax test_syntax.c)
target_link_libraries(test_syntax onig)
if(MSVC)
  target_compile_options(test_syntax PRIVATE /utf-8)
endif(MSVC)

add_executable(test_options test_options.c)
target_link_libraries(test_options onig)
if(MSVC)
  target_compile_options(test_options PRIVATE /utf-8)
endif(MSVC)

if(NOT MSVC)
  # EUC
  add_executable(testc testc.c)
  target_link_libraries(testc onig)
  if (CMAKE_C_COMPILER_ID MATCHES "Clang|GNU")
	target_compile_options(testc PRIVATE -Wall -Wno-invalid-source-encoding)
  endif()
endif(NOT MSVC)

if(ENABLE_POSIX_API)
  add_executable(testp testp.c)
  target_link_libraries(testp onig)
endif()

add_executable(testcu testu.c)
target_link_libraries(testcu onig)

add_executable(test_regset test_regset.c)
target_link_libraries(test_regset onig)
if(MSVC)
  target_compile_options(test_regset PRIVATE /utf-8)
endif(MSVC)

add_executable(test_back test_back.c)
target_link_libraries(test_back onig)
if(MSVC)
  target_compile_options(test_back PRIVATE /utf-8)
endif(MSVC)