summaryrefslogtreecommitdiff
path: root/unittest/CMakeLists.txt
blob: 2a3edf0dabeb4e924940032c54ee07e9be3d16e0 (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
56
57
58
59
60
61
62
63
set(
  source_files
  TestUtil.cpp
  main.cpp
  test_Args.cpp
  test_AtomicFile.cpp
  test_Config.cpp
  test_Depfile.cpp
  test_Hash.cpp
  test_Stat.cpp
  test_Util.cpp
  test_argprocessing.cpp
  test_ccache.cpp
  test_compopt.cpp
  test_compression_types.cpp
  test_core_MsvcShowIncludesOutput.cpp
  test_core_Statistics.cpp
  test_core_StatisticsCounters.cpp
  test_core_StatsLog.cpp
  test_hashutil.cpp
  test_storage_local_StatsFile.cpp
  test_storage_local_util.cpp
  test_util_BitSet.cpp
  test_util_Bytes.cpp
  test_util_Duration.cpp
  test_util_LockFile.cpp
  test_util_TextTable.cpp
  test_util_TimePoint.cpp
  test_util_Tokenizer.cpp
  test_util_XXH3_128.cpp
  test_util_XXH3_64.cpp
  test_util_expected.cpp
  test_util_file.cpp
  test_util_path.cpp
  test_util_string.cpp
  test_util_zstd.cpp
)

if(INODE_CACHE_SUPPORTED)
  list(APPEND source_files test_InodeCache.cpp)
endif()

if(WIN32)
  list(APPEND source_files test_bsdmkstemp.cpp test_Win32Util.cpp)
endif()

file(GLOB headers *.hpp)
list(APPEND source_files ${headers})

add_executable(unittest ${source_files})

if(MSVC)
  # Turn off /Zc:preprocessor for this test because it triggers a bug in some older Windows 10 SDK headers.
  set_source_files_properties(test_Stat.cpp PROPERTIES COMPILE_FLAGS /Zc:preprocessor-)
endif()

target_link_libraries(
  unittest
  PRIVATE standard_settings standard_warnings ccache_framework third_party)

target_include_directories(unittest PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${ccache_SOURCE_DIR}/src)

add_test(NAME unittest COMMAND unittest)