From ea5f96c3ff10b424e74bddc821717c36ebcbdeb9 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Sun, 15 Apr 2012 21:07:18 -0500 Subject: Fix libkscan/cmake build failure caused by cmake policy CMP0004. This resolves bug report 901. Thanks to David C. Rankin. (cherry picked from commit cd3c62a5cfa6fbcbd150e86deb14eed15f4d1e02) --- libkscan/ConfigureChecks.cmake | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libkscan/ConfigureChecks.cmake') 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 ) -- cgit v1.2.1