-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathCMakeLists.txt
62 lines (51 loc) · 1.25 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
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 3.0)
project(cstl)
include(CMakeDependentOption)
set(CMAKE_CXX_STANDARD 11)
set(CSTL_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "cstl library root directory" FORCE)
cmake_dependent_option(BUILD_CSTL_TESTING
"Build both cstl library and testing or build Library only"
ON "CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR" OFF)
if (UNIX)
add_definitions(-Wall -Werror -ggdb3 -std=c90 -Wextra -pedantic)
add_definitions("-D_DEFAULT_SOURCE -D_GNU_SOURCE")
endif()
if (MSVC)
add_compile_options(/wd4996)
endif()
set(CSTL_SRC_FILES
inc/c_algorithms.h
inc/c_array.h
inc/c_deque.h
inc/c_errors.h
inc/c_iterator.h
inc/c_stl_lib.h
inc/c_list.h
inc/c_map.h
inc/rb-tree.h
inc/c_set.h
src/c_algorithms.c
src/c_array.c
src/c_deque.c
src/c_list.c
src/c_map.c
src/rb-tree.c
src/c_set.c
src/c_util.c
)
set(CSTL_TEST_FILES
test/t_c_algorithms.c
test/t_c_array.c
test/t_c_deque.c
test/t_c_map.c
test/t_c_rb.c
test/t_c_set.c
test/t_c_slist.c
test/t_clib.c
)
include_directories(inc)
add_library(cstl STATIC ${CSTL_SRC_FILES})
if (BUILD_CSTL_TESTING)
add_executable(test-cstl ${CSTL_TEST_FILES})
target_link_libraries(test-cstl cstl)
endif()