Commit 3dedd62f authored by Alexander Alekhin's avatar Alexander Alekhin Committed by GitHub

Merge pull request #8970 from alalek:fix_libname_2.4

(2.4) cmake: fix libname for pkg-config configuration
parents 07b7c03e 70489b1e
...@@ -74,8 +74,8 @@ if(OpenCV_EXTRA_COMPONENTS) ...@@ -74,8 +74,8 @@ if(OpenCV_EXTRA_COMPONENTS)
list(APPEND OpenCV_LIB_COMPONENTS_ "${extra_component}") list(APPEND OpenCV_LIB_COMPONENTS_ "${extra_component}")
elseif(extra_component MATCHES "[\\/]") elseif(extra_component MATCHES "[\\/]")
get_filename_component(libdir "${extra_component}" PATH) get_filename_component(libdir "${extra_component}" PATH)
get_filename_component(libname "${extra_component}" NAME_WE) get_filename_component(libname "${extra_component}" NAME)
string(REGEX REPLACE "^lib" "" libname "${libname}") ocv_get_libname(libname "${libname}")
list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}" "-l${libname}") list(APPEND OpenCV_LIB_COMPONENTS_ "-L${libdir}" "-l${libname}")
else() else()
list(APPEND OpenCV_LIB_COMPONENTS_ "-l${extra_component}") list(APPEND OpenCV_LIB_COMPONENTS_ "-l${extra_component}")
......
...@@ -749,6 +749,12 @@ function(ocv_source_group group) ...@@ -749,6 +749,12 @@ function(ocv_source_group group)
source_group(${group} FILES ${srcs}) source_group(${group} FILES ${srcs})
endfunction() endfunction()
macro(ocv_get_libname var_name)
get_filename_component(__libname "${ARGN}" NAME)
string(REGEX REPLACE "^lib(.+).(a|so)(.[.0-9]+)?$" "\\1" __libname "${__libname}")
set(${var_name} "${__libname}")
endmacro()
# build the list of simple dependencies, that links via "-l" # build the list of simple dependencies, that links via "-l"
# _all_libs - name of variable with input list # _all_libs - name of variable with input list
# _simple - name of variable with output list of simple libs # _simple - name of variable with output list of simple libs
......
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