Merge topic 'findperllibs-windows'

10dfec3 FindPerlLibs: properly detect libperl on Windows (#12224)
This commit is contained in:
David Cole 2012-02-21 15:53:50 -05:00 committed by CMake Topic Stage
commit d84233a70d
1 changed files with 23 additions and 31 deletions

View File

@ -94,6 +94,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_SITESEARCH_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITESEARCH ${PERL_SITESEARCH_OUTPUT_VARIABLE})
file(TO_CMAKE_PATH "${PERL_SITESEARCH}" PERL_SITESEARCH)
endif (NOT PERL_SITESEARCH_RESULT_VARIABLE)
### PERL_SITELIB
@ -107,6 +108,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_SITELIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_SITELIB ${PERL_SITELIB_OUTPUT_VARIABLE})
file(TO_CMAKE_PATH "${PERL_SITELIB}" PERL_SITELIB)
endif (NOT PERL_SITELIB_RESULT_VARIABLE)
### PERL_VENDORARCH
@ -120,6 +122,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_VENDORARCH_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORARCH ${PERL_VENDORARCH_OUTPUT_VARIABLE})
file(TO_CMAKE_PATH "${PERL_VENDORARCH}" PERL_VENDORARCH)
endif (NOT PERL_VENDORARCH_RESULT_VARIABLE)
### PERL_VENDORLIB
@ -133,6 +136,7 @@ if (PERL_EXECUTABLE)
)
if (NOT PERL_VENDORLIB_RESULT_VARIABLE)
string(REGEX REPLACE "install[a-z]+='([^']+)'.*" "\\1" PERL_VENDORLIB ${PERL_VENDORLIB_OUTPUT_VARIABLE})
file(TO_CMAKE_PATH "${PERL_VENDORLIB}" PERL_VENDORLIB)
endif (NOT PERL_VENDORLIB_RESULT_VARIABLE)
macro(perl_adjust_darwin_lib_variable varname)
@ -173,6 +177,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 )
file(TO_CMAKE_PATH "${PERL_ARCHLIB}" PERL_ARCHLIB)
endif (NOT PERL_ARCHLIB_RESULT_VARIABLE)
### PERL_PRIVLIB
@ -187,28 +192,10 @@ 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 )
file(TO_CMAKE_PATH "${PERL_PRIVLIB}" PERL_PRIVLIB)
endif (NOT PERL_PRIVLIB_RESULT_VARIABLE)
### PERL_POSSIBLE_INCLUDE_PATHS
set(PERL_POSSIBLE_INCLUDE_PATHS
${PERL_ARCHLIB}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
### PERL_POSSIBLE_LIB_PATHS
set(PERL_POSSIBLE_LIB_PATHS
${PERL_ARCHLIB}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
### PERL_POSSIBLE_LIBRARY_NAME
### PERL_POSSIBLE_LIBRARY_NAMES
execute_process(
COMMAND
${PERL_EXECUTABLE} -V:libperl
@ -218,10 +205,9 @@ if (PERL_EXECUTABLE)
PERL_LIBRARY_RESULT_VARIABLE
)
if (NOT PERL_LIBRARY_RESULT_VARIABLE)
foreach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS})
string(REGEX REPLACE "libperl='([^']+)'" "\\1" PERL_LIBRARY_OUTPUT_VARIABLE ${PERL_LIBRARY_OUTPUT_VARIABLE})
set(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${_perl_lib_path}/${PERL_LIBRARY_OUTPUT_VARIABLE}")
endforeach(_perl_lib_path ${PERL_POSSIBLE_LIB_PATHS})
string(REGEX REPLACE "libperl='([^']+)'.*" "\\1" PERL_POSSIBLE_LIBRARY_NAMES ${PERL_LIBRARY_OUTPUT_VARIABLE})
else (NOT PERL_LIBRARY_RESULT_VARIABLE)
set(PERL_POSSIBLE_LIBRARY_NAMES perl${PERL_VERSION_STRING} perl)
endif (NOT PERL_LIBRARY_RESULT_VARIABLE)
### PERL_INCLUDE_PATH
@ -229,17 +215,23 @@ if (PERL_EXECUTABLE)
NAMES
perl.h
PATHS
${PERL_POSSIBLE_INCLUDE_PATHS}
${PERL_ARCHLIB}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
### PERL_LIBRARY
find_library(PERL_LIBRARY
NAMES
${PERL_POSSIBLE_LIBRARY_NAME}
perl${PERL_VERSION_STRING}
perl
${PERL_POSSIBLE_LIBRARY_NAMES}
PATHS
${PERL_POSSIBLE_LIB_PATHS}
${PERL_ARCHLIB}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/${PERL_ARCHNAME}/CORE
/usr/lib/perl5/${PERL_VERSION_STRING}/CORE
/usr/lib/perl/${PERL_VERSION_STRING}/CORE
)
endif (PERL_EXECUTABLE)
@ -254,7 +246,7 @@ find_package_handle_standard_args(PerlLibs REQUIRED_VARS PERL_LIBRARY PERL_INCLU
set(PERL_INCLUDE_DIR ${PERL_INCLUDE_PATH})
set(PERL_INCLUDE_DIRS ${PERL_INCLUDE_PATH})
set(PERL_LIBRARIES ${PERL_LIBRARY})
# For backward compatibility with CMake before 2.8.7
# For backward compatibility with CMake before 2.8.8
set(PERL_VERSION ${PERL_VERSION_STRING})
mark_as_advanced(