-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
51 lines (41 loc) · 1.33 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
cmake_minimum_required(VERSION 3.21)
project(benoni VERSION 0.0.1 LANGUAGES CXX DESCRIPTION "Networking library")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# C++ standard
set(CMAKE_CXX_STANDARD 20)
option(BENONI_TESTS "Build the Benoni tests" OFF)
option(BENONI_EXAMPLES "Build the Benoni examples" OFF)
option(BENONI_INSTALL "Install Benoni" ON)
string(TOLOWER ${CMAKE_SYSTEM_NAME} LOWER_SYSTEM_NAME)
set(BENONI_TARGET ${PROJECT_NAME}_${LOWER_SYSTEM_NAME})
if(APPLE)
add_subdirectory(src/apple)
elseif(WIN32)
add_subdirectory(src/win32)
elseif(UNIX)
find_package(LibSoup REQUIRED)
add_subdirectory(src/linux)
endif()
set_target_properties(${BENONI_TARGET} PROPERTIES PUBLIC_HEADER ${PROJECT_SOURCE_DIR}/include/benoni/http.h)
if(BENONI_INSTALL)
include(GNUInstallDirs)
install(TARGETS ${BENONI_TARGET}
EXPORT benoni
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
COMPONENT benoni
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
COMPONENT benoni)
install(EXPORT benoni
DESTINATION "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/cmake"
COMPONENT benoni)
endif()
if(BENONI_EXAMPLES)
add_subdirectory(examples)
endif()
if(BENONI_TESTS)
enable_testing()
add_subdirectory(test/unit)
if(PROJECT_IS_TOP_LEVEL)
add_subdirectory(test/packaging)
endif()
endif()