-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
91 lines (75 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
CMAKE_MINIMUM_REQUIRED(VERSION 3.25 FATAL_ERROR)
PROJECT(fleet-http-client C CXX)
IF (TARGET fleet-http-client-static)
RETURN()
ENDIF ()
SET(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
SET(CMAKE_INSTALL_RPATH "$ORIGIN")
SET(CMAKE_CXX_STANDARD 20)
SET(FLEET_HTTP_CLIENT_VERSION 2.0.0)
INCLUDE(CheckPIESupported)
CHECK_PIE_SUPPORTED()
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
OPTION(BRINGAUTO_TESTS "Enable tests" OFF)
OPTION(BRINGAUTO_PACKAGE "Package creation" OFF)
OPTION(BRINGAUTO_INSTALL "Enable install" OFF)
OPTION(BRINGAUTO_SYSTEM_DEP "Enable system dependencies" OFF)
OPTION(BRINGAUTO_SAMPLES "Enable build of sample app, not used in project" OFF)
OPTION(BRINGAUTO_INSTALL_IMPORTED_DEPS "Enable installation of imported deps" OFF)
IF(BRINGAUTO_PACKAGE)
IF(NOT BRINGAUTO_INSTALL)
SET(BRINGAUTO_INSTALL ON CACHE BOOL "Forced install due to BRINGAUTO_PACKAGE=ON" FORCE)
MESSAGE(WARNING "BRINGAUTO_INSTALL is switched to on because of BRINGAUTO_PACKAGE=ON")
ENDIF()
ENDIF()
FIND_PACKAGE(CMLIB
COMPONENTS CMDEF CMUTIL STORAGE
REQUIRED
)
IF(NOT BRINGAUTO_SYSTEM_DEP)
INCLUDE(cmake/Dependencies.cmake)
ENDIF()
FIND_PACKAGE(fleet-protocol-interface 2.0.0 REQUIRED)
FIND_PACKAGE(fleet-protocol-cxx-helpers-static 1.1.1 REQUIRED)
SET(BUILD_SHARED_LIBS OFF)
ADD_SUBDIRECTORY("lib/bringauto-fleet-http-client-generated")
IF(BRINGAUTO_SAMPLES)
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/example/)
ENDIF()
FILE(GLOB_RECURSE source_files "src/*")
CMDEF_ADD_LIBRARY(
LIBRARY_GROUP fleet-http-client
TYPE SHARED
SOURCES ${source_files}
INCLUDE_DIRECTORIES ${CMAKE_CURRENT_LIST_DIR}/include/
INSTALL_INCLUDE_DIRECTORIES "include/"
VERSION ${FLEET_HTTP_CLIENT_VERSION}
)
TARGET_LINK_LIBRARIES(fleet-http-client-shared
PUBLIC
fleet-protocol-interface::common-headers-interface
fleet-protocol-cxx-helpers-static::fleet-protocol-cxx-helpers-static
bringauto-fleet-http-client-generated-shared
)
IF(BRINGAUTO_TESTS)
ENABLE_TESTING()
ADD_SUBDIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/test/)
ENDIF()
IF (BRINGAUTO_INSTALL)
CMDEF_INSTALL(
TARGET fleet-http-client-shared
NAMESPACE fleet-http-client-shared::
)
IF(BRINGAUTO_INSTALL_IMPORTED_DEPS)
BA_PACKAGE_DEPS_IMPORTED(fleet-http-client-shared)
ENDIF()
ENDIF ()
IF (BRINGAUTO_PACKAGE)
CMDEF_PACKAGE(
MAIN_TARGET fleet-http-client-shared
VERSION ${FLEET_HTTP_CLIENT_VERSION}
)
SET(CPACK_GENERATOR ZIP)
SET(CPACK_PACKAGE_CONTACT "BringAuto s.r.o. <[email protected]>")
INCLUDE(CPack)
ENDIF ()