fixed json-c CMake inclusion

This commit is contained in:
minus 2015-08-27 00:06:09 +02:00
parent 2289029fab
commit c948432fb4
2 changed files with 20 additions and 4 deletions

17
CMake/FindJsonC.cmake Normal file
View File

@ -0,0 +1,17 @@
# - Find json-c
# Find the json-c libraries
#
# This module defines the following variables:
# JSONC_FOUND - True if JSONC is found
# JSONC_LIBRARIES - JSONC libraries
# JSONC_INCLUDE_DIRS - JSONC include directories
#
find_package(PkgConfig)
pkg_check_modules(PC_JSONC QUIET JSONC)
find_path(JSONC_INCLUDE_DIRS NAMES json-c/json.h HINTS ${PC_JSONC_INCLUDE_DIRS})
find_library(JSONC_LIBRARIES NAMES json-c HINTS ${PC_JSONC_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JSONC DEFAULT_MSG JSONC_LIBRARIES JSONC_INCLUDE_DIRS)
mark_as_advanced(JSONC_LIBRARIES JSONC_INCLUDE_DIRS)

View File

@ -22,15 +22,14 @@ find_package(XKBCommon REQUIRED)
find_package(WLC REQUIRED)
find_package(A2X REQUIRED)
find_package(PCRE REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSON REQUIRED json-c)
find_package(JsonC REQUIRED)
FILE(GLOB sources ${PROJECT_SOURCE_DIR}/sway/*.c)
include_directories(
${WLC_INCLUDE_DIRS}
${PCRE_INCLUDE_DIRS}
${JSON_INCLUDE_DIRS}
${JSONC_INCLUDE_DIRS}
include/
)
@ -42,7 +41,7 @@ target_link_libraries(sway
${WLC_LIBRARIES}
${XKBCOMMON_LIBRARIES}
${PCRE_LIBRARIES}
${JSON_LIBRARIES}
${JSONC_LIBRARIES}
)
INSTALL(