From de7186fc83c09861c3cb610c1fe6130297cfc074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kr=C3=A6n=20Hansen?= Date: Mon, 28 Oct 2024 09:55:42 +0100 Subject: [PATCH] Updated Android Cmake link configuration --- packages/realm/binding/android/CMakeLists.txt | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/packages/realm/binding/android/CMakeLists.txt b/packages/realm/binding/android/CMakeLists.txt index e637afec0d..87af51f270 100644 --- a/packages/realm/binding/android/CMakeLists.txt +++ b/packages/realm/binding/android/CMakeLists.txt @@ -60,11 +60,25 @@ target_link_libraries(realm-js-android-binding Realm::ObjectStore Realm::Sync ReactAndroid::jsi - ReactAndroid::reactnativejni - ReactAndroid::turbomodulejsijni fbjni::fbjni ) +# This if-then-else can be removed once this library does not support version below 0.76 +# Ideally we would just depend on `REACTNATIVE_MERGED_SO` +# See https://github.com/react-native-community/discussions-and-proposals/discussions/816 +# For some reason (yet to be determined) we don't have REACTNATIVE_MERGED_SO set here. +# See https://github.com/react-native-community/discussions-and-proposals/discussions/816#discussioncomment-10659654 +if (REACTNATIVE_MERGED_SO OR ReactAndroid_VERSION_MINOR GREATER_EQUAL 76) + target_link_libraries(realm-js-android-binding + ReactAndroid::reactnative + ) +else() + target_link_libraries(realm-js-android-binding + ReactAndroid::reactnativejni + ReactAndroid::turbomodulejsijni + ) +endif() + if (CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel") add_custom_command(TARGET realm-js-android-binding POST_BUILD