fix for FindCJSON.cmake from Joe

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9525 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: db9300ec7995fb4c3e510d9b15ff466fc541971b
Former-commit-id: c64f88857c9c9f09752e89cc8aca1702898b8980
This commit is contained in:
iobyte 2024-08-04 17:38:07 +00:00
parent de681128e2
commit 8b191adc24
2 changed files with 27 additions and 9 deletions

View file

@ -36,14 +36,7 @@ set(CJSON_ROOT_DIR
include(FindPackageHandleStandardArgs)
# Check for CMake config first.
find_package(cJSON QUIET CONFIG)
if(cJSON_FOUND AND TARGET cjson)
# Found config, let's prefer it.
find_package_handle_standard_args(cJSON CONFIG_MODE)
set(CJSON_LIBRARY cjson)
else()
if(WIN32)
# Manually find
find_path(
CJSON_INCLUDE_DIR
@ -58,6 +51,30 @@ else()
find_package_handle_standard_args(cJSON REQUIRED_VARS CJSON_INCLUDE_DIR
CJSON_LIBRARY)
else()
# Check for CMake config first.
find_package(cJSON QUIET CONFIG)
if(cJSON_FOUND AND TARGET cjson)
# Found config, let's prefer it.
find_package_handle_standard_args(cJSON CONFIG_MODE)
set(CJSON_LIBRARY cjson)
else()
# Manually find
find_path(
CJSON_INCLUDE_DIR
NAMES cjson/cJSON.h
PATHS ${CJSON_ROOT_DIR}
PATH_SUFFIXES include)
find_library(
CJSON_LIBRARY
NAMES cjson
PATHS ${CJSON_ROOT_DIR}
PATH_SUFFIXES lib)
find_package_handle_standard_args(cJSON REQUIRED_VARS CJSON_INCLUDE_DIR
CJSON_LIBRARY)
endif()
endif()
if(CJSON_FOUND)

View file

@ -574,7 +574,8 @@ if(OPTION_CJSON)
ExternalProject_Add(${CJSON_PROJECT}
URL ${CJSON_URL}
URL_HASH ${CJSON_HASH}
CMAKE_ARGS ${CJSON_ARGS})
CMAKE_ARGS ${CJSON_ARGS}
DEPENDS ${MINIZIP_PROJECT})
else(OPTION_CJSON)
set(CJSON_PROJECT )
endif(OPTION_CJSON)