-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
56 lines (46 loc) · 1.23 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
cmake_minimum_required(VERSION 3.10)
# set the project name
project(libhack)
# add source files to build shared library
add_library(hack SHARED
src/main.c
src/process.c
src/init.c
src/process.h
src/consts.h
src/init.h
src/logger.c
src/logger.h
src/types.c
src/types.h
)
add_executable(unit_test
src/unit_test.c
src/main.c
src/process.c
src/init.c
src/process.h
src/logger.c
src/types.c
)
set(CMAKE_C_STANDARD 17)
if (CMAKE_COMPILER_IS_GNUCC)
target_compile_options(hack PRIVATE -Wall -Wextra)
target_compile_options(unit_test PRIVATE --coverage -fprofile-arcs -ftest-coverage)
target_link_libraries(unit_test gcov)
endif()
# configure target properties
set_target_properties(hack
PROPERTIES ARCHIVE_OUTPUT_NAME hack
)
# configure dll exporting
add_definitions(-DDLL_EXPORT -DDEBUG)
if(WIN32)
message(STATUS "generating makefile for windows target")
target_link_libraries(hack psapi shlwapi)
target_link_libraries(unit_test psapi shlwapi)
elseif(UNIX)
message(STATUS "generating makefile for unix target")
target_link_libraries(hack procps)
target_link_libraries(unit_test procps)
endif()