trinity-devel@lists.pearsoncomputing.net

Message: previous - next
Month: March 2012

tdegraphics libkscan ConfigureChecks.cmake patch

From: "David C. Rankin" <drankinatty@...>
Date: Thu, 08 Mar 2012 16:25:32 -0600
Serghei,

   I have submitted a patch for the libkscan ConfigureChecks.cmake 
SANE_LIBRARIES concatenation bug. Please take a look at the patch provided for 
http://bugs.pearsoncomputing.net/show_bug.cgi?id=901

   I think this will provide a more robust set of REGEX expressions for 
dealing with lib and ldflag strings and will work across all distros. The 
original REGEX expressions simply removed spaces which would result in flags 
being merged together causing the build to fail. This set of REGEX expressions 
eliminates all non-library information first leaving only a concise semi-colon 
separate list of library names.

   In short this is the patch:

--- tdegraphics/libkscan/ConfigureChecks.cmake
+++ tdegraphics/libkscan/ConfigureChecks.cmake  2012-03-08 15:51:30.452794166 
-0600
@@ -39,8 +39,14 @@
    string( REGEX REPLACE "(^| )-I" ";" SANE_INCLUDE_DIRS "${SANE_INCLUDE_DIRS}" )
  endif( )
  if( SANE_LIBRARIES )
-  string( REGEX REPLACE "(^| )-l" ";" SANE_LIBRARIES "${SANE_LIBRARIES}" )
-  string( REPLACE " " "" SANE_LIBRARIES "${SANE_LIBRARIES}" )
+  ## remove all spaces and replace whitespace with ';'
+  string( REGEX REPLACE "[ ]+" ";" SANE_LIBRARIES "${SANE_LIBRARIES}" )
+  ## remove all non-library information
+  string( REGEX REPLACE "[-][^l]([^ ;])+" "" SANE_LIBRARIES "${SANE_LIBRARIES}" )
+  ## remove multiple ';'
+  string( REGEX REPLACE "[;]+" ";" SANE_LIBRARIES "${SANE_LIBRARIES}" )
+  ## remove '-l'
+  string( REGEX REPLACE "-l" "" SANE_LIBRARIES "${SANE_LIBRARIES}" )
  endif( )

  if( NOT HAVE_SANE )

   If it works for you, go ahead and commit it.

-- 
David C. Rankin, J.D.,P.E.