shortened code to not repeat myself

This commit is contained in:
Greg Hale 2013-10-17 14:12:02 -04:00
parent 5bd5993663
commit 61ccd170bd

View File

@ -58,13 +58,15 @@ endforeach()
set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_})
if(OpenCV_EXTRA_COMPONENTS)
foreach(extra_component ${OpenCV_EXTRA_COMPONENTS})
if(extra_component MATCHES "-[lL](.*)" )
set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${extra_component}")
elseif(extra_component MATCHES "/")
set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${extra_component}")
if(extra_component MATCHES "-[lL](.*)" OR extra_component MATCHES "/")
set(maybe_l_prefix "")
else()
set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} -l${extra_component}")
set(maybe_l_prefix "-l")
endif()
set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${maybe_l_prefix}${extra_component}")
endforeach()
endif()