-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
63 lines (49 loc) · 1.62 KB
/
CMakeLists.txt
File metadata and controls
63 lines (49 loc) · 1.62 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
cmake_minimum_required(VERSION 3.26)
# Set the name of the project (the exec file)
SET(MY_PROJECT_NAME WindowsClientTest)
project(${MY_PROJECT_NAME})
# Set the C++ version
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
# Set the path to for the local software installation
set(LOCAL_SOFTWARE_DIR /usr/local)
# Include directories for the locally installed header files
include_directories(${LOCAL_SOFTWARE_DIR}/include ${Boost_INCLUDE_DIRS})
# Include link directories for libraries
link_directories(${LOCAL_SOFTWARE_DIR}/lib)
include(FetchContent)
# Fetch httplib
FetchContent_Declare(httplib
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git
GIT_TAG master
)
FetchContent_MakeAvailable(httplib)
# Fetch nlohmann/json
FetchContent_Declare(json
GIT_REPOSITORY https://github.com/ArthurSonzogni/nlohmann_json_cmake_fetchcontent
GIT_TAG master
)
FetchContent_MakeAvailable(json)
# Source files
set(SOURCES
ClipboardManager.cpp
ClipboardManager.h
main.cpp
ClipboardContent.cpp
ClipboardContent.h
NetworkConnection.cpp
NetworkConnection.h
)
# Create the executable
add_executable(${MY_PROJECT_NAME} ${SOURCES})
# Link against the libraries
target_link_libraries(${PROJECT_NAME}
httplib::httplib
nlohmann_json::nlohmann_json
)
# Set the RPATH to include the library directory
set_target_properties(${MY_PROJECT_NAME} PROPERTIES
INSTALL_RPATH ${LOCAL_SOFTWARE_DIR}/lib
INSTALL_RPATH_USE_LINK_PATH TRUE
)