-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
50 lines (34 loc) · 1.31 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
cmake_minimum_required(VERSION 3.11)
project(IZ2 C)
set(CMAKE_C_STANDARD 99)
set(SOURCE_FILES "main.c")
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
# Add ./data files
file(GLOB DATA_FILES "data/*.txt")
file(COPY ${DATA_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/data)
set(FILE "file")
set(VECTOR "vector")
set(CMAKE_BUILD_TYPE Debug)
# Static lib
if (static)
set(VECTOR_SOURCE_DIR "./include/vector_static")
add_subdirectory(${VECTOR_SOURCE_DIR} lib)
target_include_directories(${PROJECT_NAME} PUBLIC ${VECTOR_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} ${VECTOR})
# Dynamic lib
elseif (dynamic)
set(VECTOR_SOURCE_DIR "./include/vector_dynamic")
add_subdirectory(${VECTOR_SOURCE_DIR} lib)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${DCMAKE_CC_COMPILER} -pthread")
target_include_directories(${PROJECT_NAME} PUBLIC ${VECTOR_SOURCE_DIR})
target_link_libraries(${PROJECT_NAME} ${VECTOR})
endif ()
if (test)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${LCOV_COMPILE_FLAGS} -pthread -coverage -lgcov -g -Wall -Werror")
set(CMAKE_CXX_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${LCOV_LINK_FLAGS} -pthread")
endif ()
set(TESTS_DIR "./tests")
if (test)
add_subdirectory(${TESTS_DIR})
endif ()