-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
73 lines (59 loc) · 1.92 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
cmake_minimum_required(VERSION 3.19)
project(hyprquery VERSION 0.1.0)
# Set the C++ standard
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set policy for CMP0048
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()
# Set policy for CMP0127
if(POLICY CMP0127)
cmake_policy(SET CMP0127 NEW)
endif()
# Suppress developer warnings
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1)
# Add FetchContent module
include(FetchContent)
include(ExternalProject)
# Set the output directory for the binary
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/release)
# Download and configure nlohmann_json
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.10.5
)
FetchContent_MakeAvailable(nlohmann_json)
# Download and configure spdlog
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.8.5
)
FetchContent_MakeAvailable(spdlog)
# Download and configure CLI11
FetchContent_Declare(
cli11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11.git
GIT_TAG v1.9.1
)
FetchContent_MakeAvailable(cli11)
# Download and configure hyprlang
ExternalProject_Add(
hyprlang
GIT_REPOSITORY https://github.com/hyprwm/hyprlang.git
GIT_TAG main
CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/hyprlang_install -DPKG_CONFIG_PATH=${CMAKE_BINARY_DIR}/hyprutils_install/lib/pkgconfig
BUILD_COMMAND ${CMAKE_COMMAND} --build . --target install -j
INSTALL_COMMAND ""
)
# Add the executable
add_executable(hyq src/main.cpp)
# Include hyprlang header
target_include_directories(hyq PRIVATE ${hyprlang_SOURCE_DIR}/include)
# Link the hyprlang library
add_dependencies(hyq hyprlang)
target_link_libraries(hyq PRIVATE ${CMAKE_BINARY_DIR}/hyprlang_install/lib/libhyprlang.so)
# Link nlohmann_json, spdlog, and CLI11 to the executable
target_link_libraries(hyq PRIVATE nlohmann_json::nlohmann_json spdlog::spdlog CLI11::CLI11)