This repository was archived by the owner on Aug 21, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
61 lines (49 loc) · 1.71 KB
/
CMakeLists.txt
File metadata and controls
61 lines (49 loc) · 1.71 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
cmake_minimum_required(VERSION 3.15)
# Set the project name
project(FunixProductionsCore VERSION 1.0.0 LANGUAGES CXX)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add the library
add_library(FunixProductionsCore SHARED
src/dto/ApiDTO.cpp
src/exceptions/ApiBadRequestException.cpp
src/exceptions/ApiException.cpp
src/exceptions/ApiForbiddenException.cpp
src/exceptions/ApiNotFoundException.cpp
src/exceptions/ApiUnauthorizedException.cpp
)
target_include_directories(FunixProductionsCore PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
# Find and link CURL
find_package(CURL REQUIRED)
target_link_libraries(FunixProductionsCore CURL::libcurl)
# Find and link nlohmann-json (header-only library)
find_package(nlohmann_json REQUIRED)
target_link_libraries(FunixProductionsCore nlohmann_json::nlohmann_json)
# Export the library target to make it reusable
install(TARGETS FunixProductionsCore
EXPORT FunixProductionsCoreTargets
DESTINATION lib
)
install(DIRECTORY include/ DESTINATION include)
# Export the library target to make it reusable
install(EXPORT FunixProductionsCoreTargets
FILE FunixProductionsCoreTargets.cmake
NAMESPACE FunixProductions::
DESTINATION lib/cmake/FunixProductionsCore
)
# Export the include directory
install(EXPORT FunixProductionsCoreTargets
FILE FunixProductionsCoreTargets.cmake
NAMESPACE FunixProductions::
DESTINATION lib/cmake/FunixProductionsCore
)
# Optionally enable testing
option(ENABLE_TESTS "Enable testing" ON)
if(ENABLE_TESTS)
enable_testing()
add_subdirectory(tests)
endif()