diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-30 16:11:02 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2004-04-30 16:11:02 (GMT) |
commit | 257daa4635ed9b88035c84c5cb1fcc689268a949 (patch) | |
tree | 1bec9e0ec65c8e8bcf37c50d373013dfdd2aab17 /Modules/FindPerlLibs.cmake | |
parent | 858564fb103666adc26d3e8077cbded1fcbe0b18 (diff) | |
download | CMake-257daa4635ed9b88035c84c5cb1fcc689268a949.zip CMake-257daa4635ed9b88035c84c5cb1fcc689268a949.tar.gz CMake-257daa4635ed9b88035c84c5cb1fcc689268a949.tar.bz2 |
ENH: Initial import of swig. Start working towards Bug #749 - Add swig support module to cmake
Diffstat (limited to 'Modules/FindPerlLibs.cmake')
-rw-r--r-- | Modules/FindPerlLibs.cmake | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Modules/FindPerlLibs.cmake b/Modules/FindPerlLibs.cmake new file mode 100644 index 0000000..dfdc47f --- /dev/null +++ b/Modules/FindPerlLibs.cmake @@ -0,0 +1,64 @@ +# +# This module finds if PERL is installed and determines where the include files +# and libraries are. It also determines what the name of the library is. This +# code sets the following variables: +# +# PERL_INCLUDE_PATH = path to where object.h can be found +# PERL_EXECUTABLE = full path to the perl binary +# + +SET(PERL_POSSIBLE_INCLUDE_PATHS + /usr/lib/perl/5.8.3/CORE + /usr/lib/perl/5.8.2/CORE + /usr/lib/perl/5.8.1/CORE + /usr/lib/perl/5.8.0/CORE + /usr/lib/perl/5.8/CORE + ) + +SET(PERL_POSSIBLE_LIB_PATHS + /usr/lib + ) + +FIND_PATH(PERL_INCLUDE_PATH perl.h + ${PERL_POSSIBLE_INCLUDE_PATHS}) + + +FIND_PROGRAM(PERL_EXECUTABLE + NAMES perl + PATHS + /usr/bin + /usr/local/bin + ) + +IF(PERL_EXECUTABLE) + EXEC_PROGRAM(${PERL_EXECUTABLE} + ARGS -e "'use Config; print $Config{libperl}, \"\\n\"'" + OUTPUT_VARIABLE PERL_LIBRARY_OUTPUT_VARIABLE + RETURN_VALUE PERL_LIBRARY_RETURN_VALUE + ) + IF(NOT PERL_LIBRARY_RETURN_VALUE) + FOREACH(path ${PERL_POSSIBLE_LIB_PATHS}) + SET(PERL_POSSIBLE_LIBRARY_NAME ${PERL_POSSIBLE_LIBRARY_NAME} "${path}/${PERL_LIBRARY_OUTPUT_VARIABLE}") + ENDFOREACH(path ${PERL_POSSIBLE_LIB_PATHS}) + ENDIF(NOT PERL_LIBRARY_RETURN_VALUE) + EXEC_PROGRAM(${PERL_EXECUTABLE} + ARGS -e "'use Config; print $Config{cppflags}, \"\\n\"'" + OUTPUT_VARIABLE PERL_CPPFLAGS_OUTPUT_VARIABLE + RETURN_VALUE PERL_CPPFLAGS_RETURN_VALUE + ) + IF(NOT PERL_CPPFLAGS_RETURN_VALUE) + SET(PERL_EXTRA_C_FLAGS ${PERL_CPPFLAGS_OUTPUT_VARIABLE}) + SEPARATE_ARGUMENTS(PERL_EXTRA_C_FLAGS) + ENDIF(NOT PERL_CPPFLAGS_RETURN_VALUE) +ENDIF(PERL_EXECUTABLE) + +FIND_LIBRARY(PERL_LIBRARY + NAMES ${PERL_POSSIBLE_LIBRARY_NAME} perl5.8.0 + PATHS ${PERL_POSSIBLE_LIB_PATHS} + ) + +MARK_AS_ADVANCED( + PERL_INCLUDE_PATH + PERL_EXECUTABLE + PERL_LIBRARY + ) |