Findcjson.cmake 807 B

12345678910111213141516171819202122232425
  1. # Copyright (C) 2019 Intel Corporation. All rights reserved.
  2. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  3. include(FetchContent)
  4. set(CJSON_SOURCE_DIR "${WAMR_ROOT_DIR}/core/deps/cjson")
  5. if(EXISTS ${CJSON_SOURCE_DIR})
  6. message("Use existed source code under ${CJSON_SOURCE_DIR}")
  7. FetchContent_Declare(
  8. cjson
  9. SOURCE_DIR ${CJSON_SOURCE_DIR}
  10. )
  11. else()
  12. message("download source code and store it at ${CJSON_SOURCE_DIR}")
  13. FetchContent_Declare(
  14. cjson
  15. GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
  16. GIT_TAG v1.7.18
  17. SOURCE_DIR ${CJSON_SOURCE_DIR}
  18. )
  19. endif()
  20. set(ENABLE_CJSON_TEST OFF CACHE INTERNAL "Turn off tests")
  21. set(ENABLE_CJSON_UNINSTALL OFF CACHE INTERNAL "Turn off uninstall to avoid targets conflict")
  22. FetchContent_MakeAvailable(cjson)