-
Notifications
You must be signed in to change notification settings - Fork 11
/
CMakeLists.txt
81 lines (69 loc) · 1.92 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
project("Phev" C)
cmake_minimum_required(VERSION 3.0)
include(splint.cmake)
set (CMAKE_C_STANDARD 11)
if (UNIX)
add_definitions (-D__unix__)
endif()
option(SPLINT_HAS_A_FATAL "if YES, splint warnings will halt the build." NO)
option(WANT_SPLINT "enable splint on sources" YES)
mark_as_advanced(SPLINT_HAS_A_FATAL)
set(SPLINT_COMMAND splint${CMAKE_EXECUTABLE_SUFFIX} CACHE FILEPATH "the location of the splint executable.")
mark_as_advanced(SPLINT_COMMAND)
find_library(MSG_CORE msg_core "/usr/local/lib")
find_library(CJSON cjson)
option(BUILD_TESTS "Build the test binaries")
set(PHEV_SRCS
src/phev_register.c
src/phev_pipe.c
src/phev_core.c
src/phev_service.c
src/phev_model.c
src/phev_tcpip.c
src/phev.c
)
add_library(phev STATIC
${PHEV_SRCS}
)
# FIXME: this should be handled via "subdirectory"
#include_directories(${INCLUDE_DIRECTORIES} ${CMAKE_SOURCE_DIR}/external/msg-core/include ${CMAKE_SOURCE_DIR}/external /usr/local/include)
target_include_directories(phev PUBLIC ${CMAKE_SOURCE_DIR}/external/msg-core/include ${CMAKE_SOURCE_DIR}/external /usr/local/include)
add_splint(phev
${PHEV_SRCS}
)
if(${BUILD_TESTS})
find_package(unity)
include(CTest)
add_subdirectory(test)
endif()
if(WIN32)
target_link_libraries(phev LINK_PUBLIC
msg_core
cjson
mswsock
advapi32
ws2_32
)
else()
target_link_libraries (phev LINK_PUBLIC
${MSG_CORE}
${CJSON}
)
endif()
set_property(TARGET phev PROPERTY C_STANDARD 11)
target_include_directories(phev PUBLIC include /usr/local /usr/local/include)
install(
TARGETS
phev
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install (FILES
include/phev.h
include/phev_service.h
include/phev_core.h
include/phev_pipe.h
include/phev_model.h
include/phev_register.h
DESTINATION include/
)