Files
@ r27569:6a9aa0750697
Branch filter:
Location: cpp/openttd-patchpack/source/os/emscripten/cmake/Findnlohmann_json.cmake - annotation
r27569:6a9aa0750697
807 B
text/x-cmake
Codechange: remove need for GetDParamX
r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 r27370:8498857641a9 | # 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>
int main() { return 0; }"
NLOHMANN_JSON_FOUND
)
if (NLOHMANN_JSON_FOUND)
add_library(nlohmann_json INTERFACE IMPORTED)
set_target_properties(nlohmann_json PROPERTIES
INTERFACE_COMPILE_OPTIONS "-sUSE_NLOHMANN_JSON=1"
INTERFACE_LINK_LIBRARIES "-sUSE_NLOHMANN_JSON=1"
)
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()
|