mirror of https://github.com/FreeRDP/FreeRDP
[cmake] fallback detection for cJSON
This commit is contained in:
parent
8bdf92ca52
commit
de49d32004
|
@ -190,10 +190,34 @@ option(WITH_JSON_DISABLED "Build without any JSON support" OFF)
|
|||
CMAKE_DEPENDENT_OPTION(WITH_CJSON_REQUIRED "Build with cJSON (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF)
|
||||
CMAKE_DEPENDENT_OPTION(WITH_JSONC_REQUIRED "Build with JSON-C (fail if not found)" OFF "NOT WITH_JSON_DISABLED" OFF)
|
||||
if (NOT WITH_JSON_DISABLED)
|
||||
if (WITH_CJSON_REQUIRED)
|
||||
find_package(cJSON REQUIRED)
|
||||
else()
|
||||
find_package(cJSON)
|
||||
|
||||
# Fallback detection:
|
||||
# older ubuntu releases did not ship CMake or pkg-config files
|
||||
# for cJSON. Be optimistic and try pkg-config and as last resort
|
||||
# try manual detection
|
||||
if (NOT cJSON_FOUND)
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
pkg_check_modules(CJSON libcjson)
|
||||
endif()
|
||||
|
||||
if (NOT CJSON_LIBRARIES OR NOT CJSON_INCLUDE_DIRS)
|
||||
find_path(CJSON_INCLUDE_DIRS
|
||||
NAMES cjson/cJSON.h
|
||||
)
|
||||
find_library(CJSON_LIBRARIES
|
||||
NAMES cjson
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (WITH_CJSON_REQUIRED)
|
||||
if (NOT CJSON_FOUND)
|
||||
message(FATAL_ERROR "cJSON was requested but not found")
|
||||
endif()
|
||||
else()
|
||||
|
||||
endif()
|
||||
if (WITH_JSONC_REQUIRED)
|
||||
find_package(JSONC REQUIRED)
|
||||
|
|
Loading…
Reference in New Issue