summary refs log tree commit diff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-06-17 03:27:29 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-06-17 03:27:29 +0200
commit13d219e8bbcef3d2f7bb5ef4550e0f3f5d986a0c (patch)
treeea45e6c2351f11ea8c1a2c57fe2b4fa71825d5f2 /CMakeLists.txt
parentFix compilation without implicit nlohmann conversions (diff)
downloadnheko-13d219e8bbcef3d2f7bb5ef4550e0f3f5d986a0c.tar.xz
Add option to disable implicit json conversions
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fa8c6ba9..b858197f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,6 +11,7 @@ else()
 	option(MAN "Build man page" OFF)
 endif()
 option(FLATPAK "Set this only if Nheko is built as a flatpak" OFF)
+option(JSON_ImplicitConversions "Disable implicit conversions in nlohmann/json" ON)
 
 set(
 	CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
@@ -686,6 +687,13 @@ if (USE_BUNDLED_QTKEYCHAIN)
 	target_include_directories(nheko PRIVATE ${qt5keychain_SOURCE_DIR} ${qt5keychain_BINARY_DIR})
 endif()
 
+if (NOT JSON_ImplicitConversions)
+	set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
+					INTERFACE_COMPILE_DEFINITIONS "JSON_USE_IMPLICIT_CONVERSIONS=\$<BOOL:OFF>;JSON_DIAGNOSTICS=\$<BOOL:OFF>"
+					)
+	target_compile_definitions(nheko PUBLIC JSON_USE_IMPLICIT_CONVERSIONS=0)
+endif()
+
 target_link_libraries(nheko PRIVATE
 	${COEURL_TARGET_NAME}
 	MatrixClient::MatrixClient