Skip to content

Commit f6343b0

Browse files
authored
Use transitive dependencies in CMake (#4158)
1 parent 97fdf68 commit f6343b0

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

realm/realm-library/src/main/cpp/CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,11 @@ if (NOT EXISTS ${core_lib_PATH})
7777
endif()
7878

7979
add_library(lib_realm_core STATIC IMPORTED)
80-
set_target_properties(lib_realm_core PROPERTIES IMPORTED_LOCATION ${core_lib_PATH})
80+
81+
# -latomic is not set by default for mips and armv5.
82+
# See https://code.google.com/p/android/issues/detail?id=182094
83+
set_target_properties(lib_realm_core PROPERTIES IMPORTED_LOCATION ${core_lib_PATH}
84+
IMPORTED_LINK_INTERFACE_LIBRARIES atomic)
8185

8286
# Sync static library
8387
set(sync_lib_PATH ${REALM_CORE_DIST_DIR}/librealm-sync-android-${ANDROID_ABI}.a)
@@ -94,7 +98,8 @@ if (NOT EXISTS ${sync_lib_PATH})
9498
endif()
9599
endif()
96100
add_library(lib_realm_sync STATIC IMPORTED)
97-
set_target_properties(lib_realm_sync PROPERTIES IMPORTED_LOCATION ${sync_lib_PATH})
101+
set_target_properties(lib_realm_sync PROPERTIES IMPORTED_LOCATION ${sync_lib_PATH}
102+
IMPORTED_LINK_INTERFACE_LIBRARIES lib_realm_core)
98103

99104
# build application's shared lib
100105
include_directories(${REALM_CORE_DIST_DIR}/include
@@ -172,12 +177,11 @@ endif()
172177

173178
add_library(realm-jni SHARED ${jni_SRC} ${objectstore_SRC} ${objectstore_sync_SRC})
174179
add_dependencies(realm-jni jni_headers)
175-
# -latomic is not set by default for mips. See https://code.google.com/p/android/issues/detail?id=182094
180+
176181
if (build_SYNC)
177-
# FIXME: The order matters! lib_realm_sync needs to be in front of lib_realm_core!! Find out why!!
178-
target_link_libraries(realm-jni log android atomic lib_realm_sync lib_realm_core)
182+
target_link_libraries(realm-jni log android lib_realm_sync)
179183
else()
180-
target_link_libraries(realm-jni log android atomic lib_realm_core)
184+
target_link_libraries(realm-jni log android lib_realm_core)
181185
endif()
182186

183187
# Strip the release so files and backup the unstripped versions

0 commit comments

Comments
 (0)