| 1234567891011121314151617181920212223 |
- cmake_minimum_required ( VERSION 3.17 FATAL_ERROR )
- set ( NLJSON_GITHUB "http://github.com/nlohmann/json/archive/refs/tags/v3.12.0.tar.gz" )
- set ( NLJSON_BUNDLE "${LIBS_BUNDLE}/nljson-v3.12.0.tar.gz" )
- set ( NLJSON_SRC_MD5 "c2528c3e04faccaaee44f1f8f3d30d99" )
- include ( update_bundle )
- # determine destination folder where we expect pre-built nljson
- find_package ( nlohmann_json QUIET CONFIG )
- return_if_target_found ( nlohmann_json::nlohmann_json "found ready (no need to build)" )
- # not found. Populate and prepare sources
- select_nearest_url ( NLJSON_PLACE nlohmann_json ${NLJSON_BUNDLE} ${NLJSON_GITHUB} )
- fetch_and_check ( nlohmann_json ${NLJSON_PLACE} ${NLJSON_SRC_MD5} NLJSON_SRC )
- # build external project
- get_build ( NLJSON_BUILD nlohmann_json )
- external_build ( nlohmann_json NLJSON_SRC NLJSON_BUILD JSON_BuildTests=0 JSON_MultipleHeaders=1 JSON_GlobalUDLs=0 )
- # now it should find
- find_package ( nlohmann_json REQUIRED CONFIG )
- return_if_target_found ( nlohmann_json::nlohmann_json "was built and saved" )
|