119 lines
3.8 KiB
Diff
119 lines
3.8 KiB
Diff
commit e702abfd16f610e773fb0310d8c6512991794c63
|
|
Author: Yury G. Kudryashov [diff odt] <urkud.urkud@gmail.com>
|
|
Date: Wed Mar 21 00:50:02 2012 +0400
|
|
|
|
Rewrite FindPerlMore.cmake
|
|
|
|
* Ask perl for expanded paths
|
|
* Move execute_process to a macro
|
|
* Add PERL_*_INSTALL_DIR variables that point to CMAKE_INSTALL_PREFIX
|
|
|
|
The last change makes it easy to install a file into CMAKE_INSTALL_PREFIX
|
|
instead of perl install prefix.Add debug message
|
|
|
|
diff --git a/cmake/FindPerlMore.cmake b/cmake/FindPerlMore.cmake
|
|
index 6412a47..cc8faf8 100644
|
|
--- a/cmake/FindPerlMore.cmake
|
|
+++ b/cmake/FindPerlMore.cmake
|
|
@@ -5,54 +5,52 @@
|
|
#
|
|
# PERL_INCLUDE_PATH = path to where perl.h can be found
|
|
|
|
-if(PERL_INCLUDE_PATH)
|
|
- # Already in cache, be silent
|
|
- SET(PERL_HEADERS_FOUND TRUE)
|
|
-endif (PERL_INCLUDE_PATH)
|
|
-
|
|
-IF(PERL_EXECUTABLE)
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{archlib}"
|
|
- OUTPUT_VARIABLE PERL_ARCH_LIB_DIR)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{sitearch}"
|
|
- OUTPUT_VARIABLE PERL_SITE_ARCH_DIR)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{vendorarch}"
|
|
- OUTPUT_VARIABLE PERL_VENDOR_ARCH_DIR)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{sitelib}"
|
|
- OUTPUT_VARIABLE PERL_SITE_LIB_DIR)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{vendorlib}"
|
|
- OUTPUT_VARIABLE PERL_VENDOR_LIB_DIR)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{version}"
|
|
- OUTPUT_VARIABLE PERL_VERSION)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{ccflags}"
|
|
- OUTPUT_VARIABLE PERL_CXX_FLAGS)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{ccdlflags}"
|
|
- OUTPUT_VARIABLE PERL_CCDL_FLAGS)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -MFile::Spec -e "print '-L' . File::Spec->catdir(\$Config{archlibexp}, 'CORE')"
|
|
- OUTPUT_VARIABLE PERL_EXTRA_LIB_PATHS)
|
|
-
|
|
- EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{perllibs}"
|
|
- OUTPUT_VARIABLE PERL_LIBS)
|
|
-
|
|
- FIND_PATH(PERL_INCLUDE_PATH
|
|
- NAMES perl.h
|
|
- PATHS ${PERL_ARCH_LIB_DIR}/CORE
|
|
- )
|
|
-
|
|
- if(PERL_INCLUDE_PATH)
|
|
- SET(PERL_HEADERS_FOUND TRUE)
|
|
- endif (PERL_INCLUDE_PATH)
|
|
-
|
|
- MARK_AS_ADVANCED(
|
|
- PERL_INCLUDE_PATH
|
|
- )
|
|
+if(FIND_PERLMORE_REQUIRED)
|
|
+ find_package(Perl REQUIRED)
|
|
+else()
|
|
+ find_package(Perl)
|
|
+endif()
|
|
+
|
|
+macro(_perl_get_config_var name output)
|
|
+ execute_process(COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \$Config{${name}}"
|
|
+ OUTPUT_VARIABLE PERL_${output})
|
|
+endmacro()
|
|
+
|
|
+macro(_perl_get_config_dir name)
|
|
+ string(TOLOWER ${name} _tmp)
|
|
+ string(REPLACE "_" "" _tmp ${_tmp})
|
|
+ _perl_get_config_var(${_tmp}exp ${name}_DIR)
|
|
+ string(REPLACE "${PERL_ROOT_DIR}" "${CMAKE_INSTALL_PREFIX}" PERL_${name}_INSTALL_DIR "${PERL_${name}_DIR}")
|
|
+endmacro()
|
|
+
|
|
+if(PERL_EXECUTABLE)
|
|
+ _perl_get_config_var(prefixexp ROOT_DIR)
|
|
+
|
|
+ _perl_get_config_dir(ARCH_LIB)
|
|
+ _perl_get_config_dir(SITE_ARCH)
|
|
+ _perl_get_config_dir(VENDOR_ARCH)
|
|
+ _perl_get_config_dir(SITE_LIB)
|
|
+ _perl_get_config_dir(VENDOR_LIB)
|
|
+
|
|
+ _perl_get_config_var(version VERSION)
|
|
+ _perl_get_config_var(ccflags CXX_FLAGS)
|
|
+ _perl_get_config_var(ccdlflags CCDL_FLAGS)
|
|
+
|
|
+ EXECUTE_PROCESS(COMMAND ${PERL_EXECUTABLE} -MConfig -MFile::Spec -e "print '-L' . File::Spec->catdir(\$Config{archlibexp}, 'CORE')"
|
|
+ OUTPUT_VARIABLE PERL_EXTRA_LIB_PATHS)
|
|
+
|
|
+ _perl_get_config_var(perllibs LIBS)
|
|
+
|
|
+ FIND_PATH(PERL_INCLUDE_PATH
|
|
+ NAMES perl.h
|
|
+ HINTS ${PERL_ARCH_LIB_DIR}/CORE
|
|
+ )
|
|
+
|
|
+ if(PERL_INCLUDE_PATH)
|
|
+ SET(PERL_HEADERS_FOUND TRUE)
|
|
+ endif (PERL_INCLUDE_PATH)
|
|
+
|
|
+ MARK_AS_ADVANCED(PERL_INCLUDE_PATH)
|
|
ENDIF(PERL_EXECUTABLE)
|
|
|
|
IF(PERL_HEADERS_FOUND)
|