blob: ff3c8cc772d71f66773c2abf5b0da307d155896b (
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
64
65
66
67
68
69
70
71
|
add_library("kstd" STATIC)
add_library("libs::kstd" ALIAS "kstd")
if(CMAKE_CROSSCOMPILING)
set(KSTD_LIBC_SYMBOLS
"abort"
"strlen"
"memcmp"
"memcpy"
)
set(KSTD_LIBC_SOURCES
"src/libc/stdlib.cpp"
"src/libc/string.cpp"
)
endif()
target_sources("kstd" PRIVATE
${KSTD_LIBC_SOURCES}
"src/os/error.cpp"
"src/mutex.cpp"
)
file(GLOB_RECURSE KSTD_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "include/kstd/*")
target_sources("kstd" PUBLIC
FILE_SET HEADERS
BASE_DIRS "include"
FILES
${KSTD_HEADERS}
)
target_include_directories("kstd" PUBLIC
"include"
)
if(CMAKE_CROSSCOMPILING)
list(TRANSFORM KSTD_LIBC_SYMBOLS PREPEND "-Wl,--undefined=")
target_link_options("kstd" INTERFACE ${KSTD_LIBC_SYMBOLS})
endif()
if(NOT CMAKE_CROSSCOMPILING)
add_executable("kstd_tests"
"tests/src/flat_map.cpp"
"tests/src/vector.cpp"
"tests/src/os_panic.cpp"
)
target_include_directories("kstd_tests" PRIVATE
"tests/include"
)
target_link_libraries("kstd_tests" PRIVATE
"Catch2::Catch2WithMain"
"libs::kstd"
)
set_target_properties("kstd_tests" PROPERTIES
C_CLANG_TIDY ""
CXX_CLANG_TIDY ""
EXCLUDE_FROM_ALL NO
)
enable_coverage("kstd")
enable_coverage("kstd_tests")
catch_discover_tests("kstd_tests")
endif()
|