-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
49 lines (34 loc) · 1.2 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.15)
project(clibs)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
set(SANITIZERS -fsanitize=address,undefined)
add_link_options(${SANITIZERS})
add_compile_options(${SANITIZERS})
message(STATUS "Enabled sanitizers with: ${SANITIZERS}")
endif()
# --- Adding libraries ---
add_subdirectory(bstr)
add_subdirectory(vec)
add_subdirectory(flag)
target_link_libraries(flag PRIVATE bstr vec)
add_subdirectory(base64)
# --- Executables ---
add_executable(bstr_test bstr/maintest.c)
target_link_libraries(bstr_test bstr)
add_executable(vec_test vec/maintest.c)
target_link_libraries(vec_test vec)
add_executable(flag_test flag/maintest.c)
target_link_libraries(flag_test flag)
add_executable(base64_test base64/maintest.c)
target_link_libraries(base64_test base64)
# --- Testing ---
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)
add_test(NAME bstr COMMAND bstr_test)
add_test(NAME vec COMMAND vec_test)
add_test(NAME flag COMMAND flag_test)
add_test(NAME base64 COMMAND base64_test)
endif()