From 61ccd170bdf4378c9e1bced426adfb9b5e1fa9a8 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Thu, 17 Oct 2013 14:12:02 -0400 Subject: [PATCH] shortened code to not repeat myself --- cmake/OpenCVGenPkgconfig.cmake | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 6f93339..1c22b8a 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -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() -- 2.7.4