Skip to content

Commit 591a087

Browse files
committed
cmake: fix pkg-config generation for MacOSX
1 parent a287331 commit 591a087

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmake/OpenCVUtils.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,10 @@ endfunction()
751751

752752
macro(ocv_get_libname var_name)
753753
get_filename_component(__libname "${ARGN}" NAME)
754-
string(REGEX REPLACE "^lib(.+).(a|so)(.[.0-9]+)?$" "\\1" __libname "${__libname}")
754+
# libopencv_core.so.3.3 -> opencv_core
755+
string(REGEX REPLACE "^lib(.+)\\.(a|so)(\\.[.0-9]+)?$" "\\1" __libname "${__libname}")
756+
# MacOSX: libopencv_core.3.3.1.dylib -> opencv_core
757+
string(REGEX REPLACE "^lib(.+[^.0-9])\\.([.0-9]+\\.)?dylib$" "\\1" __libname "${__libname}")
755758
set(${var_name} "${__libname}")
756759
endmacro()
757760

0 commit comments

Comments
 (0)