add_definitions(-DOPENCV_ENABLE_MEMORY_SANITIZER=1)
endif()
endmacro()
+
+# adjust -Wl,-rpath-link
+if(CMAKE_SKIP_RPATH)
+ if((NOT CMAKE_CROSSCOMPILING OR OPENCV_ENABLE_LINKER_RPATH_LINK_ORIGIN) AND NOT OPENCV_SKIP_LINKER_RPATH_LINK_ORIGIN)
+ if(DEFINED CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN)
+ list(APPEND CMAKE_PLATFORM_RUNTIME_PATH "${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN}")
+ else()
+ list(APPEND CMAKE_PLATFORM_RUNTIME_PATH "\$ORIGIN")
+ endif()
+ elseif(NOT OPENCV_SKIP_LINKER_RPATH_LINK_BINARY_LIB)
+ list(APPEND CMAKE_PLATFORM_RUNTIME_PATH "${LIBRARY_OUTPUT_PATH}")
+ endif()
+endif()
+if(OPENCV_EXTRA_RPATH_LINK_PATH)
+ string(REPLACE ":" ";" OPENCV_EXTRA_RPATH_LINK_PATH_ "${OPENCV_EXTRA_RPATH_LINK_PATH}")
+ list(APPEND CMAKE_PLATFORM_RUNTIME_PATH ${OPENCV_EXTRA_RPATH_LINK_PATH_})
+ if(NOT CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG)
+ message(WARNING "OPENCV_EXTRA_RPATH_LINK_PATH may not work properly because CMAKE_EXECUTABLE_RPATH_LINK_CXX_FLAG is not defined (not supported)")
+ endif()
+endif()