smengcl commented on code in PR #6414:
URL: https://github.com/apache/ozone/pull/6414#discussion_r1534484730


##########
hadoop-hdds/rocks-native/src/CMakeLists.txt:
##########
@@ -30,25 +30,33 @@ find_package(JNI REQUIRED)
 include_directories(${JNI_INCLUDE_DIRS})
 set(CMAKE_CXX_STANDARD ${CMAKE_STANDARDS})
 
-set(linked_libraries "")
+set(CMAKE_SKIP_BUILD_RPATH FALSE)
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
+
+set(CMAKE_INSTALL_RPATH "")
+
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)
+
 if(NOT GENERATED_JAVAH)
     message(FATAL_ERROR "You must set the CMake variable GENERATED_JAVAH")
 endif()
 include_directories(${GENERATED_JAVAH})
 if(${SST_DUMP_INCLUDE})
     include_directories(${ROCKSDB_HEADERS})
     set(SOURCE_FILES ${NATIVE_DIR}/ManagedRawSSTFileReader.cpp 
${NATIVE_DIR}/ManagedRawSSTFileIterator.cpp 
${NATIVE_DIR}/cplusplus_to_java_convert.h)
-    ADD_LIBRARY(rocksdb SHARED IMPORTED)
-    set_target_properties(
-            rocksdb
-            PROPERTIES
-            IMPORTED_LOCATION ${ROCKSDB_LIB})
     ADD_LIBRARY(rocks_tools STATIC IMPORTED)
     set_target_properties(
             rocks_tools
             PROPERTIES
             IMPORTED_LOCATION ${ROCKSDB_TOOLS_LIB}/librocksdb_tools.a)
-    set(linked_libraries ${linked_libraries} rocks_tools rocksdb)
 endif()
+
 add_library(ozone_rocksdb_tools SHARED ${SOURCE_FILES})
-target_link_libraries(ozone_rocksdb_tools ${linked_libraries})
+
+
+target_link_libraries(ozone_rocksdb_tools PRIVATE ${ROCKSDB_LIB})
+target_link_libraries(ozone_rocksdb_tools PRIVATE rocks_tools)
+set_target_properties(ozone_rocksdb_tools PROPERTIES
+        BUILD_WITH_INSTALL_RPATH FALSE
+        LINK_FLAGS "-Wl,-rpath -Wl,'$ORIGIN'")

Review Comment:
   nit: put a new line at the end of the file



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to