1
- cmake_minimum_required (VERSION 3.10 )
2
- project (hyprquery )
1
+ cmake_minimum_required (VERSION 3.19 )
2
+ project (hyprquery VERSION 0.1.0 )
3
3
4
4
# Set the C++ standard
5
5
set (CMAKE_CXX_STANDARD 23 )
6
6
set (CMAKE_CXX_STANDARD_REQUIRED True )
7
7
8
- # Include directories
9
- include_directories (/usr/include )
8
+ # Set policy for CMP0048
9
+ if (POLICY CMP0048 )
10
+ cmake_policy (SET CMP0048 NEW )
11
+ endif ()
12
+
13
+ # Set policy for CMP0127
14
+ if (POLICY CMP0127 )
15
+ cmake_policy (SET CMP0127 NEW )
16
+ endif ()
17
+
18
+ # Suppress developer warnings
19
+ set (CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 )
10
20
11
21
# Add FetchContent module
12
22
include (FetchContent )
23
+ include (ExternalProject )
13
24
14
25
# Download and configure nlohmann_json
15
26
FetchContent_Declare (
@@ -35,11 +46,25 @@ FetchContent_Declare(
35
46
)
36
47
FetchContent_MakeAvailable (cli11 )
37
48
49
+ # Download and configure hyprlang
50
+ ExternalProject_Add (
51
+ hyprlang
52
+ GIT_REPOSITORY https://github.com/hyprwm/hyprlang.git
53
+ GIT_TAG main
54
+ CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/hyprlang_install
55
+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --target install -j
56
+ INSTALL_COMMAND ""
57
+ )
58
+
38
59
# Add the executable
39
60
add_executable (hyq src/main.cpp )
40
61
62
+ # Include hyprlang header
63
+ target_include_directories (hyq PRIVATE ${hyprlang_SOURCE_DIR} /include )
64
+
41
65
# Link the hyprlang library
42
- target_link_libraries (hyq PRIVATE hyprlang )
66
+ add_dependencies (hyq hyprlang )
67
+ target_link_libraries (hyq PRIVATE ${CMAKE_BINARY_DIR} /hyprlang_install/lib/libhyprlang.so )
43
68
44
69
# Link nlohmann_json, spdlog, and CLI11 to the executable
45
70
target_link_libraries (hyq PRIVATE nlohmann_json::nlohmann_json spdlog::spdlog CLI11::CLI11 )
0 commit comments