From cd3c62a5cfa6fbcbd150e86deb14eed15f4d1e02 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Sun, 15 Apr 2012 21:07:18 -0500 Subject: [PATCH] Fix libkscan/cmake build failure caused by cmake policy CMP0004. This resolves bug report 901. Thanks to David C. Rankin. --- libkscan/ConfigureChecks.cmake | 10 ++++++++-- 1 file 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 )