diff options
-rw-r--r-- | libkscan/ConfigureChecks.cmake | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libkscan/ConfigureChecks.cmake b/libkscan/ConfigureChecks.cmake index 203bf375..a26c495d 100644 --- a/libkscan/ConfigureChecks.cmake +++ b/libkscan/ConfigureChecks.cmake @@ -39,8 +39,14 @@ if( SANE_INCLUDE_DIRS ) 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 ) |