mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #14929 from alalek:cmake_rpath_link_support
This commit is contained in:
commit
ff877af2af
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user