generated from parthux1/project_preset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
53 lines (38 loc) · 1.23 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
# Version requirement
# for .23 for FILESETS
cmake_minimum_required(VERSION 3.23)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/tooling/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "Vcpkg toolchain file")
project(ntfy-lib VERSION 0.1.1 DESCRIPTION "ntfy API for C++")
option(ntfy_build_example "Build Example" OFF)
add_library(ntfy SHARED)
add_subdirectory(include)
add_subdirectory(src)
set_target_properties(ntfy PROPERTIES VERSION ${PROJECT_VERSION})
# install rules
include(GNUInstallDirs)
install(TARGETS ntfy
EXPORT ntfy-libConfig
FILE_SET HEADERS
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(EXPORT
ntfy-libConfig
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/ntfy-lib"
NAMESPACE ntfy-lib::
)
# dependencies
find_package(nlohmann_json REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(spdlog REQUIRED)
find_package(cpr REQUIRED)
target_link_libraries(ntfy PRIVATE
spdlog::spdlog
yaml-cpp::yaml-cpp
cpr::cpr
nlohmann_json::nlohmann_json)
# build examples if flag is set
if (ntfy_build_example)
add_subdirectory(example)
endif ()