You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
# nlohmann-json is a custom addition to the emscripten SDK, so it is possible
# someone patched their SDK. Test out if the SDK supports nlohmann-json.
include ( CheckCXXSourceCompiles )
set ( CMAKE_REQUIRED_FLAGS "-sUSE_NLOHMANN_JSON=1" )
check_cxx_source_compiles ( "
#include <nlohmann/json.hpp>
i n t main ( ) { r e t u r n 0 ; } "
n l o h m a n n _ j s o n _ F O U N D
)
if ( nlohmann_json_FOUND )
add_library ( nlohmann_json INTERFACE IMPORTED )
set_target_properties ( nlohmann_json PROPERTIES
I N T E R F A C E _ C O M P I L E _ O P T I O N S " - s U S E _ N L O H M A N N _ J S O N = 1 "
I N T E R F A C E _ L I N K _ L I B R A R I E S " - s U S E _ N L O H M A N N _ J S O N = 1 "
)
set ( nlohmann_json_LIBRARY "nlohmann_json" )
else ( )
message ( WARNING "You are using an emscripten SDK without nlohmann-json support. Please apply 'emsdk-nlohmann_json.patch' to your local emsdk installation." )
endif ( )