Commit ff877af2 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #14929 from alalek:cmake_rpath_link_support

parents 350532ea bc79f477
...@@ -396,3 +396,23 @@ macro(ocv_add_modules_compiler_options) ...@@ -396,3 +396,23 @@ macro(ocv_add_modules_compiler_options)
add_definitions(-DOPENCV_ENABLE_MEMORY_SANITIZER=1) add_definitions(-DOPENCV_ENABLE_MEMORY_SANITIZER=1)
endif() endif()
endmacro() 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()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment