From f23b51de6f0bfcf96fef8bbe805d601172705a53 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Mon, 14 Oct 2013 13:36:07 -0400 Subject: [PATCH 1/7] Added -l prefix to EXTRA_COMPONENTS when generating pkg-config file --- cmake/OpenCVGenPkgconfig.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 7bfc7bc5af..24e9ab55b3 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -57,8 +57,11 @@ endforeach() # add extra dependencies required for OpenCV set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) - string(REPLACE ";" " " OpenCV_EXTRA_COMPONENTS "${OpenCV_EXTRA_COMPONENTS}") - set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${OpenCV_EXTRA_COMPONENTS}") + set(OpenCV_DASH_L_EXTRA_COMPONENTS "") + foreach(ExtraComponent ${OpenCV_EXTRA_COMPONENTS}) + set(OpenCV_DASH_L_EXTRA_COMPONENTS "${OpenCV_DASH_L_EXTRA_COMPONENTS} -l${ExtraComponent}") + endforeach() + set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${OpenCV_DASH_L_EXTRA_COMPONENTS}") endif() #generate the .pc file From 70df365c87e0d2eb220f1b0214fb8c2618e3661c Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Tue, 15 Oct 2013 14:54:58 -0400 Subject: [PATCH 2/7] changed foreach variable to match naming conventions and dropped intermediate variable, appending directly to the LIB_COMPONENTS list --- cmake/OpenCVGenPkgconfig.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 24e9ab55b3..ecd7c68f14 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -57,11 +57,9 @@ endforeach() # add extra dependencies required for OpenCV set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) - set(OpenCV_DASH_L_EXTRA_COMPONENTS "") - foreach(ExtraComponent ${OpenCV_EXTRA_COMPONENTS}) - set(OpenCV_DASH_L_EXTRA_COMPONENTS "${OpenCV_DASH_L_EXTRA_COMPONENTS} -l${ExtraComponent}") + foreach(extra_component ${OpenCV_EXTRA_COMPONENTS}) + set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} -l${extra_component}") endforeach() - set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} ${OpenCV_DASH_L_EXTRA_COMPONENTS}") endif() #generate the .pc file From 5bd59936635516eec05ec2ba8caa479cc7dbcf0f Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Thu, 17 Oct 2013 14:05:06 -0400 Subject: [PATCH 3/7] Only append -l to lib entries with no path and no -l or -L of their own --- cmake/OpenCVGenPkgconfig.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index ecd7c68f14..6f9333952e 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -58,7 +58,13 @@ endforeach() set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) foreach(extra_component ${OpenCV_EXTRA_COMPONENTS}) - set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} -l${extra_component}") + 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}") + else() + set(OpenCV_LIB_COMPONENTS "${OpenCV_LIB_COMPONENTS} -l${extra_component}") + endif() endforeach() endif() From 61ccd170bdf4378c9e1bced426adfb9b5e1fa9a8 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Thu, 17 Oct 2013 14:12:02 -0400 Subject: [PATCH 4/7] 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 6f9333952e..1c22b8a9c7 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() From 0c4d4846790f87b89f9f2d70fe920e570b9f8fb4 Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Thu, 17 Oct 2013 14:17:49 -0400 Subject: [PATCH 5/7] added backslash --- cmake/OpenCVGenPkgconfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 1c22b8a9c7..eaa29c3f3d 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -59,7 +59,7 @@ set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) foreach(extra_component ${OpenCV_EXTRA_COMPONENTS}) - if(extra_component MATCHES "-[lL](.*)" OR extra_component MATCHES "/") + if(extra_component MATCHES "-[lL](.*)" OR extra_component MATCHES "[\\/]") set(maybe_l_prefix "") else() set(maybe_l_prefix "-l") From fe3dd762a46355a41c1be94fd844d72e846dda7e Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Sat, 19 Oct 2013 17:30:32 -0400 Subject: [PATCH 6/7] fixed wrong regex --- cmake/OpenCVGenPkgconfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index eaa29c3f3d..8b02d5b2b3 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -59,7 +59,7 @@ set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) foreach(extra_component ${OpenCV_EXTRA_COMPONENTS}) - if(extra_component MATCHES "-[lL](.*)" OR extra_component MATCHES "[\\/]") + if(extra_component MATCHES "^-[lL](.*)" OR extra_component MATCHES "[\\/]") set(maybe_l_prefix "") else() set(maybe_l_prefix "-l") From 387587f4f0515d0564c0d79e1d20e7a0fce6c67b Mon Sep 17 00:00:00 2001 From: Greg Hale Date: Mon, 21 Oct 2013 09:27:04 -0400 Subject: [PATCH 7/7] regex doesnt need to match full length of input, so only trying to match the leading -[lL] --- cmake/OpenCVGenPkgconfig.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/OpenCVGenPkgconfig.cmake b/cmake/OpenCVGenPkgconfig.cmake index 8b02d5b2b3..a36b70e941 100644 --- a/cmake/OpenCVGenPkgconfig.cmake +++ b/cmake/OpenCVGenPkgconfig.cmake @@ -59,7 +59,7 @@ set(OpenCV_LIB_COMPONENTS ${OpenCV_LIB_COMPONENTS_}) if(OpenCV_EXTRA_COMPONENTS) foreach(extra_component ${OpenCV_EXTRA_COMPONENTS}) - if(extra_component MATCHES "^-[lL](.*)" OR extra_component MATCHES "[\\/]") + if(extra_component MATCHES "^-[lL]" OR extra_component MATCHES "[\\/]") set(maybe_l_prefix "") else() set(maybe_l_prefix "-l")