summaryrefslogtreecommitdiffstats
path: root/Modules/FindPerlLibs.cmake
diff options
context:
space:
mode:
authorDave Abrahams <dave@boostpro.com>2010-11-08 16:06:56 (GMT)
committerBrad King <brad.king@kitware.com>2010-11-08 16:09:41 (GMT)
commit20ceccc4f28474c89af5797640852f966b731be4 (patch)
tree3e6d8c072219913379609e5fa184bfe634824f30 /Modules/FindPerlLibs.cmake
parentda778eeb4b095e0d09f60e00e55c9e6ec43b7d7a (diff)
downloadCMake-20ceccc4f28474c89af5797640852f966b731be4.zip
CMake-20ceccc4f28474c89af5797640852f966b731be4.tar.gz
CMake-20ceccc4f28474c89af5797640852f966b731be4.tar.bz2
FindPerlLibs: Fix for Mac locally applied patches
Previously FindPerlLibs did not work with the Mac stock Perl because it includes patches. From "perl -V": Locally applied patches: /Library/Perl/Updates/<version> comes before system perl directories installprivlib and installarchlib points to the Updates directory Adjust paths accordingly.
Diffstat (limited to 'Modules/FindPerlLibs.cmake')
-rw-r--r--Modules/FindPerlLibs.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake
index 4cb0263..0d620e3 100644
--- a/Modules/FindPerlLibs.cmake
+++ b/Modules/FindPerlLibs.cmake
@@ -147,6 +147,32 @@ if (PERL_EXECUTABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE})
endif (NOT PERL_VENDORLIB_RESULT_VARIABLE)
+ macro(perl_adjust_darwin_lib_variable varname)
+ string( TOUPPER PERL_${varname} FINDPERL_VARNAME )
+ string( TOLOWER install${varname} PERL_VARNAME )
+
+ if (NOT PERL_MINUSV_OUTPUT_VARIABLE)
+ execute_process(
+ COMMAND
+ ${PERL_EXECUTABLE} -V
+ OUTPUT_VARIABLE
+ PERL_MINUSV_OUTPUT_VARIABLE
+ RESULT_VARIABLE
+ PERL_MINUSV_RESULT_VARIABLE
+ )
+ endif()
+
+ if (NOT PERL_MINUSV_RESULT_VARIABLE)
+ string(REGEX MATCH "(${PERL_VARNAME}.*points? to the Updates directory)"
+ PERL_NEEDS_ADJUSTMENT ${PERL_MINUSV_OUTPUT_VARIABLE})
+
+ if (PERL_NEEDS_ADJUSTMENT)
+ string(REGEX REPLACE "(.*)/Updates/" "/System/\\1/" ${FINDPERL_VARNAME} ${${FINDPERL_VARNAME}})
+ endif (PERL_NEEDS_ADJUSTMENT)
+
+ endif (NOT PERL_MINUSV_RESULT_VARIABLE)
+ endmacro()
+
### PERL_ARCHLIB
execute_process(
COMMAND
@@ -158,6 +184,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_ARCHLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_ARCHLIB ${PERL_ARCHLIB_OUTPUT_VARIABLE})
+ perl_adjust_darwin_lib_variable( ARCHLIB )
endif (NOT PERL_ARCHLIB_RESULT_VARIABLE)
### PERL_PRIVLIB
@@ -171,6 +198,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_PRIVLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_PRIVLIB ${PERL_PRIVLIB_OUTPUT_VARIABLE})
+ perl_adjust_darwin_lib_variable( PRIVLIB )
endif (NOT PERL_PRIVLIB_RESULT_VARIABLE)