mindspore/cmake/external_libs/json.cmake

28 lines
907 B
CMake
Raw Normal View History

2021-07-31 10:46:37 +08:00
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
2022-08-23 14:41:55 +08:00
set(nlohmann_json3101_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json3101_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
2021-07-31 10:46:37 +08:00
endif()
2021-01-23 20:20:31 +08:00
if(ENABLE_GITEE)
2022-08-23 14:41:55 +08:00
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.10.1.zip")
set(MD5 "a402ee7412bd6c7fcb994946ff977c44")
set(INCLUDE "./include")
else()
2022-08-23 14:41:55 +08:00
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.10.1/include.zip")
set(MD5 "990b11a4fd9e1b05be02959a439fd402")
2021-12-11 18:33:42 +08:00
set(INCLUDE "./include")
2021-01-23 20:20:31 +08:00
endif()
2022-08-23 14:41:55 +08:00
mindspore_add_pkg(nlohmann_json3101
VER 3.10.1
HEAD_ONLY ${INCLUDE}
URL ${REQ_URL}
MD5 ${MD5})
2022-08-23 14:41:55 +08:00
include_directories(${nlohmann_json3101_INC})
add_library(mindspore::json ALIAS nlohmann_json3101)