diff options
Diffstat (limited to 'Modules/FindPerl.cmake')
-rw-r--r-- | Modules/FindPerl.cmake | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/Modules/FindPerl.cmake b/Modules/FindPerl.cmake index bedb839..4f45da6 100644 --- a/Modules/FindPerl.cmake +++ b/Modules/FindPerl.cmake @@ -18,31 +18,31 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -INCLUDE(FindCygwin) +include(FindCygwin) -SET(PERL_POSSIBLE_BIN_PATHS +set(PERL_POSSIBLE_BIN_PATHS ${CYGWIN_INSTALL_PATH}/bin ) -IF(WIN32) - GET_FILENAME_COMPONENT( +if(WIN32) + get_filename_component( ActivePerl_CurrentVersion "[HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl;CurrentVersion]" NAME) - SET(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} + set(PERL_POSSIBLE_BIN_PATHS ${PERL_POSSIBLE_BIN_PATHS} "C:/Perl/bin" [HKEY_LOCAL_MACHINE\\SOFTWARE\\ActiveState\\ActivePerl\\${ActivePerl_CurrentVersion}]/bin ) -ENDIF(WIN32) +endif(WIN32) -FIND_PROGRAM(PERL_EXECUTABLE +find_program(PERL_EXECUTABLE NAMES perl PATHS ${PERL_POSSIBLE_BIN_PATHS} ) -IF(PERL_EXECUTABLE) +if(PERL_EXECUTABLE) ### PERL_VERSION - EXECUTE_PROCESS( + execute_process( COMMAND ${PERL_EXECUTABLE} -V:version OUTPUT_VARIABLE @@ -52,32 +52,32 @@ IF(PERL_EXECUTABLE) ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") - STRING(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ELSE() - EXECUTE_PROCESS( + if(NOT PERL_VERSION_RESULT_VARIABLE AND NOT PERL_VERSION_OUTPUT_VARIABLE MATCHES "^version='UNKNOWN'") + string(REGEX REPLACE "version='([^']+)'.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + else() + execute_process( COMMAND ${PERL_EXECUTABLE} -v OUTPUT_VARIABLE PERL_VERSION_OUTPUT_VARIABLE RESULT_VARIABLE PERL_VERSION_RESULT_VARIABLE ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - IF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") - STRING(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ELSEIF(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") - STRING(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) - ENDIF() - ENDIF() -ENDIF(PERL_EXECUTABLE) + if(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl.*[ \\(]v([0-9\\._]+)[ \\)]") + string(REGEX REPLACE ".*This is perl.*[ \\(]v([0-9\\._]+)[ \\)].*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + elseif(NOT PERL_VERSION_RESULT_VARIABLE AND PERL_VERSION_OUTPUT_VARIABLE MATCHES "This is perl, version ([0-9\\._]+) +") + string(REGEX REPLACE ".*This is perl, version ([0-9\\._]+) +.*" "\\1" PERL_VERSION_STRING ${PERL_VERSION_OUTPUT_VARIABLE}) + endif() + endif() +endif(PERL_EXECUTABLE) # Deprecated settings for compatibility with CMake1.4 -SET(PERL ${PERL_EXECUTABLE}) +set(PERL ${PERL_EXECUTABLE}) # handle the QUIETLY and REQUIRED arguments and set PERL_FOUND to TRUE if # all listed variables are TRUE -INCLUDE(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Perl REQUIRED_VARS PERL_EXECUTABLE VERSION_VAR PERL_VERSION_STRING) -MARK_AS_ADVANCED(PERL_EXECUTABLE) +mark_as_advanced(PERL_EXECUTABLE) |