summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMake/FindJsonC.cmake17
-rw-r--r--CMakeLists.txt7
2 files changed, 20 insertions, 4 deletions
diff --git a/CMake/FindJsonC.cmake b/CMake/FindJsonC.cmake
new file mode 100644
index 00000000..2ca0df39
--- /dev/null
+++ b/CMake/FindJsonC.cmake
@@ -0,0 +1,17 @@
1# - Find json-c
2# Find the json-c libraries
3#
4# This module defines the following variables:
5# JSONC_FOUND - True if JSONC is found
6# JSONC_LIBRARIES - JSONC libraries
7# JSONC_INCLUDE_DIRS - JSONC include directories
8#
9
10find_package(PkgConfig)
11pkg_check_modules(PC_JSONC QUIET JSONC)
12find_path(JSONC_INCLUDE_DIRS NAMES json-c/json.h HINTS ${PC_JSONC_INCLUDE_DIRS})
13find_library(JSONC_LIBRARIES NAMES json-c HINTS ${PC_JSONC_LIBRARY_DIRS})
14
15include(FindPackageHandleStandardArgs)
16find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARIES JSONC_INCLUDE_DIRS)
17mark_as_advanced(JSONC_LIBRARIES JSONC_INCLUDE_DIRS)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e30b52e0..aad7f54d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,15 +22,14 @@ find_package(XKBCommon REQUIRED)
22find_package(WLC REQUIRED) 22find_package(WLC REQUIRED)
23find_package(A2X REQUIRED) 23find_package(A2X REQUIRED)
24find_package(PCRE REQUIRED) 24find_package(PCRE REQUIRED)
25find_package(PkgConfig REQUIRED) 25find_package(JsonC REQUIRED)
26pkg_check_modules(JSON REQUIRED json-c)
27 26
28FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c) 27FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
29 28
30include_directories( 29include_directories(
31 ${WLC_INCLUDE_DIRS} 30 ${WLC_INCLUDE_DIRS}
32 ${PCRE_INCLUDE_DIRS} 31 ${PCRE_INCLUDE_DIRS}
33 ${JSON_INCLUDE_DIRS} 32 ${JSONC_INCLUDE_DIRS}
34 include/ 33 include/
35) 34)
36 35
@@ -42,7 +41,7 @@ target_link_libraries(sway
42 ${WLC_LIBRARIES} 41 ${WLC_LIBRARIES}
43 ${XKBCOMMON_LIBRARIES} 42 ${XKBCOMMON_LIBRARIES}
44 ${PCRE_LIBRARIES} 43 ${PCRE_LIBRARIES}
45 ${JSON_LIBRARIES} 44 ${JSONC_LIBRARIES}
46) 45)
47 46
48INSTALL( 47INSTALL(