forked from goToMain/libosdp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
77 lines (64 loc) · 2.43 KB
/
CMakeLists.txt
File metadata and controls
77 lines (64 loc) · 2.43 KB
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
#
# Copyright (c) 2019-2025 Siddharth Chandrasekaran <sidcha.dev@gmail.com>
#
# SPDX-License-Identifier: Apache-2.0
#
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
cmake_policy(SET CMP0063 NEW)
# Generate compile_commands.json for IDE support
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(libosdp VERSION 3.1.0)
set(PROJECT_AUTHOR "Siddharth Chandrasekaran")
set(PROJECT_AUTHOR_EMAIL "sidcha.dev@gmail.com")
set(PROJECT_YEAR "2019")
set(PROJECT_ORG "goToMain")
set(PROJECT_URL "https://github.com/goToMain/libosdp/")
set(PROJECT_HOMEPAGE "https://libosdp.sidcha.dev/")
set(PROJECT_DESCRIPTION "Open Supervised Device Protocol (OSDP) Library")
set(PROJECT_LICENSE "Apache License, Version 2.0 (Apache-2.0)")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
## Options
option(OPT_OSDP_PACKET_TRACE "Enable raw packet trace for diagnostics" OFF)
option(OPT_OSDP_DATA_TRACE "Enable command/reply data buffer tracing" OFF)
option(OPT_OSDP_SKIP_MARK_BYTE "Don't send the leading mark byte (0xFF)" OFF)
option(OPT_DISABLE_PRETTY_LOGGING "Don't colorize log ouputs" OFF)
option(OPT_BUILD_SANITIZER "Enable different sanitizers during build" OFF)
option(OPT_BUILD_STATIC "Build static library" ON)
option(OPT_BUILD_SHARED "Build shared library" ON)
option(OPT_OSDP_STATIC_PD "Setup PD single statically" OFF)
option(OPT_OSDP_LIB_ONLY "Only build the library" OFF)
option(OPT_BUILD_BARE_METAL "Build library for bare metal targets" OFF)
## Includes
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(AddCCompilerFlag)
include(GitInfo)
include(BuildType)
## Global settings
if(NOT MSVC)
add_compile_options(-Wall -Wextra)
endif()
if (OPT_BUILD_BARE_METAL)
add_compile_options(-D__BARE_METAL__)
else()
include(GNUInstallDirs)
endif()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_WARN_DEPRECATED ON)
# Each subdirectory has it's own CMakeLists.txt
include(GitSubmodules)
add_subdirectory(src)
if (NOT OPT_OSDP_STATIC_PD AND NOT OPT_OSDP_LIB_ONLY AND NOT MSVC)
add_subdirectory(utils)
add_subdirectory(tests/unit-tests)
add_subdirectory(examples/c)
add_subdirectory(examples/cpp)
add_subdirectory(doc)
endif()
## uninstall target
add_custom_target(uninstall
COMMAND xargs rm < ${CMAKE_BINARY_DIR}/install_manifest.txt
)
## include package rules at last
include(CreatePackages)