forked from Azure/azure-iot-sdk-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
125 lines (101 loc) · 4.03 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#Copyright (c) Microsoft. All rights reserved.
#Licensed under the MIT license. See LICENSE file in the project root for full license information.
#this is CMakeLists for iothub_service_client
if(NOT ${use_http})
message("iothub service client needs HTTP support - use_http option was ${use_http}")
return()
endif()
compileAsC99()
set(iothub_service_client_c_files
./src/iothub_deviceconfiguration.c
./src/iothub_devicemethod.c
./src/iothub_devicetwin.c
./src/iothub_messaging.c
./src/iothub_messaging_ll.c
./src/iothub_registrymanager.c
./src/iothub_sc_version.c
./src/iothub_service_client_auth.c
../iothub_client/src/iothub_message.c
)
set(iothub_service_client_h_files
./inc/iothub_deviceconfiguration.h
./inc/iothub_devicemethod.h
./inc/iothub_devicetwin.h
./inc/iothub_messaging.h
./inc/iothub_messaging_ll.h
./inc/iothub_registrymanager.h
./inc/iothub_sc_version.h
./inc/iothub_service_client_auth.h
../iothub_client/inc/iothub_message.h
)
include_directories(${SHARED_UTIL_INC_FOLDER})
include_directories(${UAMQP_INC_FOLDER})
include_directories(${UAMQP_INCLUDES})
set(IOTHUB_SERVICE_CLIENT_INC_FOLDER ${CMAKE_CURRENT_LIST_DIR}/inc CACHE INTERNAL "This is the include folder for iothub_service_client" FORCE)
include_directories(${CMAKE_CURRENT_LIST_DIR}/../deps/parson ${IOTHUB_SERVICE_CLIENT_INC_FOLDER} ${CMAKE_CURRENT_LIST_DIR}/../iothub_client/inc)
IF(WIN32)
#windows needs this define
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-DGB_MEASURE_MEMORY_FOR_THIS -DGB_DEBUG_ALLOC)
ENDIF(WIN32)
add_library(iothub_service_client ${iothub_service_client_c_files} ${iothub_service_client_h_files})
set(install_libs iothub_service_client)
if (${build_as_dynamic})
add_library(iothub_service_client_dll SHARED ${iothub_service_client_c_files} ${iothub_service_client_h_files} ./src/iothub_service_client.def)
linkSharedUtil(iothub_service_client_dll)
target_link_libraries(iothub_service_client_dll uamqp parson)
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
target_link_libraries(iothub_service_client_dll
"-Wl,--exclude-libs,libparson.a"
)
endif()
set_target_properties(iothub_service_client_dll PROPERTIES
OUTPUT_NAME "iothub_service_client"
ARCHIVE_OUTPUT_NAME "iothub_service_client_dll_import"
ENABLE_EXPORTS YES
WINDOWS_EXPORT_ALL_SYMBOLS YES
PDB_NAME "iothub_service_client_dll"
VERSION ${IOT_SDK_VERSION}
SOVERSION ${IOT_SDK_VERION_MAJOR}
BUILD_WITH_INSTALL_RPATH TRUE
)
set (install_libs ${install_libs} iothub_service_client_dll)
endif()
setSdkTargetBuildProperties(iothub_service_client)
if(NOT ${nuget_e2e_tests})
target_link_libraries(iothub_service_client uamqp parson)
else()
target_link_libraries(iothub_service_client parson)
endif()
if (NOT ${ARCHITECTURE} STREQUAL "ARM")
if (NOT ${skip_samples})
add_subdirectory(samples)
endif()
endif()
if(NOT IN_OPENWRT)
# Disable tests for OpenWRT
if(${run_unittests})
add_subdirectory(tests)
endif()
endif()
if(${use_installed_dependencies})
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR "lib")
endif()
if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR)
set(CMAKE_INSTALL_INCLUDEDIR "include")
endif()
install(TARGETS iothub_service_client EXPORT azure_iot_sdksTargets
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/../bin
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot
)
install(FILES ${iothub_service_client_h_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/azureiot)
else()
install(FILES ${iothub_service_client_h_files}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/iothub_service_client)
install(TARGETS ${install_libs}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()