-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (78 loc) · 2.68 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
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required (VERSION 2.6)
project (CGenerator)
cmake_policy(SET CMP0063 NEW)
set(CMAKE_C_VISIBILITY_PRESET default)
set(CMAKE_CXX_VISIBILITY_PRESET default)
set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
set(CMAKE_BUILD_TYPE Debug)
set(pkgName "dadapush_public_api")
find_package(CURL 7.58.0 REQUIRED)
if(CURL_FOUND)
include_directories(${CURL_INCLUDE_DIR})
set(PLATFORM_LIBRARIES ${PLATFORM_LIBRARIES} ${CURL_LIBRARIES} )
else(CURL_FOUND)
message(FATAL_ERROR "Could not find the CURL library and development files.")
endif()
set(SRCS
src/list.c
src/apiKey.c
src/apiClient.c
external/cJSON.c
model/action.c
model/message_object.c
model/message_push_request.c
model/message_push_response.c
model/page_response_of_message_object.c
model/result.c
model/result_of_message_object.c
model/result_of_message_push_response.c
model/result_of_page_response_of_message_object.c
api/DaDaPushMessageAPI.c
)
set(HDRS
include/apiClient.h
include/list.h
include/keyValuePair.h
external/cJSON.h
model/action.h
model/message_object.h
model/message_push_request.h
model/message_push_response.h
model/page_response_of_message_object.h
model/result.h
model/result_of_message_object.h
model/result_of_message_push_response.h
model/result_of_page_response_of_message_object.h
api/DaDaPushMessageAPI.h
)
# Add library with project file with projectname as library name
add_library(${pkgName} SHARED ${SRCS} ${HDRS})
# Link dependent libraries
target_link_libraries(${pkgName} ${CURL_LIBRARIES} )
#install library to destination
install(TARGETS ${pkgName} DESTINATION ${CMAKE_INSTALL_PREFIX})
# Setting file variables to null
set(SRCS "")
set(HDRS "")
## This section shows how to use the above compiled libary to compile the source files
## set source files
#set(SRCS
# unit-tests/manual-PetAPI.c
# unit-tests/manual-StoreAPI.c
# unit-tests/manual-UserAPI.c
# unit-tests/manual-order.c
# unit-tests/manual-user.c)
##set header files
#set(HDRS
#)
## loop over all files in SRCS variable
#foreach(SOURCE_FILE ${SRCS})
# # Get only the file name from the file as add_executable doesnot support executable with slash("/")
# get_filename_component(FILE_NAME_ONLY ${SOURCE_FILE} NAME_WE)
# # Remove .c from the file name and set it as executable name
# string( REPLACE ".c" "" EXECUTABLE_FILE ${FILE_NAME_ONLY})
# # Add executable for every source file in SRCS
# add_executable(unit-${EXECUTABLE_FILE} ${SOURCE_FILE})
# # Link above created libary to executable and dependent libary curl
# target_link_libraries(unit-${EXECUTABLE_FILE} ${CURL_LIBRARIES} ${pkgName} )
#endforeach(SOURCE_FILE ${SRCS})