diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindAspell.cmake | 49 | ||||
-rw-r--r-- | cmake/FindGettext.cmake | 54 | ||||
-rw-r--r-- | cmake/FindGnuTLS.cmake | 70 | ||||
-rw-r--r-- | cmake/FindIconv.cmake | 74 | ||||
-rw-r--r-- | cmake/FindLua.cmake | 82 | ||||
-rw-r--r-- | cmake/FindPerl.cmake | 83 | ||||
-rw-r--r-- | cmake/FindPython.cmake | 80 | ||||
-rw-r--r-- | cmake/FindRuby.cmake | 78 |
8 files changed, 570 insertions, 0 deletions
diff --git a/cmake/FindAspell.cmake b/cmake/FindAspell.cmake new file mode 100644 index 000000000..575519768 --- /dev/null +++ b/cmake/FindAspell.cmake @@ -0,0 +1,49 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Aspell +# This module finds if libaspell is installed and determines where +# the include files and libraries are. +# +# This code sets the following variables: +# +# ASPELL_INCLUDE_PATH = path to where aspell.h can be found +# ASPELL_LIBRARY = path to where libaspell.so* can be found + +IF (ASPELL_FOUND) + # Already in cache, be silent + SET(ASPELL_FIND_QUIETLY TRUE) +ENDIF (ASPELL_FOUND) + +FIND_PATH(ASPELL_INCLUDE_PATH + NAMES aspell.h + PATHS /usr/include /usr/local/include /usr/pkg/include +) + +FIND_LIBRARY(ASPELL_LIBRARY + NAMES aspell aspell-15 + PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib +) + +IF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY) + SET(ASPELL_FOUND TRUE) +ENDIF (ASPELL_INCLUDE_PATH AND ASPELL_LIBRARY) + +MARK_AS_ADVANCED( + ASPELL_INCLUDE_PATH + ASPELL_LIBRARY + ) diff --git a/cmake/FindGettext.cmake b/cmake/FindGettext.cmake new file mode 100644 index 000000000..6cc6170ce --- /dev/null +++ b/cmake/FindGettext.cmake @@ -0,0 +1,54 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Gettext +# This module finds if gettext is installed and determines where +# the include files and libraries are. +# +# This code sets the following variables: +# +# GETTEXT_FOUND = is gettext usable on system? + +IF(GETTEXT_FOUND) + # Already in cache, be silent + SET(GETTEXT_FIND_QUIETLY TRUE) +ENDIF(GETTEXT_FOUND) + +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckFunctionExists) + +CHECK_INCLUDE_FILES(libintl.h HAVE_LIBINTL_H) + +IF(HAVE_LIBINTL_H) + CHECK_FUNCTION_EXISTS(dgettext LIBC_HAS_DGETTEXT) + IF(LIBC_HAS_DGETTEXT) + SET(GETTEXT_FOUND TRUE) + ELSE(LIBC_HAS_DGETTEXT) + FIND_LIBRARY(LIBINTL_LIBRARY NAMES intl libintl + PATHS + /usr/lib + /usr/local/lib + ) + IF(LIBINTL_LIBRARY) + CHECK_LIBRARY_EXISTS(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) + IF(LIBINTL_HAS_DGETTEXT) + SET(GETTEXT_FOUND TRUE) + ENDIF(LIBINTL_HAS_DGETTEXT) + ENDIF(LIBINTL_LIBRARY) + ENDIF(LIBC_HAS_DGETTEXT) +ENDIF(HAVE_LIBINTL_H) diff --git a/cmake/FindGnuTLS.cmake b/cmake/FindGnuTLS.cmake new file mode 100644 index 000000000..6c19a6e5c --- /dev/null +++ b/cmake/FindGnuTLS.cmake @@ -0,0 +1,70 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find GnuTLS +# This module finds if libgnutls is installed and determines where +# the include files and libraries are. +# +# This code sets the following variables: +# +# GNUTLS_INCLUDE_PATH = path to where <gnutls/gnutls.h> can be found +# GNUTLS_LIBRARY = path to where libgnutls.so* can be found +# GNUTLS_CFLAGS = cflags to use to compile +# GNUTLS_LDFLAGS = ldflags to use to compile + +IF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY) + # Already in cache, be silent + set(GNUTLS_FIND_QUIETLY TRUE) +ENDIF(GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY) + +FIND_PROGRAM(GNUTLS_CONFIG_EXECUTABLE NAMES libgnutls-config) + +EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --prefix + OUTPUT_VARIABLE GNUTLS_PREFIX +) + +EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --cflags + OUTPUT_VARIABLE GNUTLS_CFLAGS +) + +EXECUTE_PROCESS(COMMAND ${GNUTLS_CONFIG_EXECUTABLE} --libs + OUTPUT_VARIABLE GNUTLS_LDFLAGS +) + +SET(GNUTLS_POSSIBLE_INCLUDE_PATH "${GNUTLS_PREFIX}/include") +SET(GNUTLS_POSSIBLE_LIB_DIR "${GNUTLS_PREFIX}/lib") + +FIND_PATH(GNUTLS_INCLUDE_PATH + NAMES gnutls/gnutls.h + PATHS GNUTLS_POSSIBLE_INCLUDE_PATH +) + +FIND_LIBRARY(GNUTLS_LIBRARY + NAMES gnutls + PATHS GNUTLS_POSSIBLE_LIB_DIR +) + +IF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY) + SET(GNUTLS_FOUND TRUE) +ENDIF (GNUTLS_INCLUDE_PATH AND GNUTLS_LIBRARY) + +MARK_AS_ADVANCED( + GNUTLS_INCLUDE_PATH + GNUTLS_LIBRARY + GNUTLS_CFLAGS + GNUTLS_LDFLAGS +) diff --git a/cmake/FindIconv.cmake b/cmake/FindIconv.cmake new file mode 100644 index 000000000..5efbec59d --- /dev/null +++ b/cmake/FindIconv.cmake @@ -0,0 +1,74 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Iconv +# This module finds if libiconv is installed and determines where +# the include files and libraries are. +# +# This code sets the following variables: +# +# ICONV_INCLUDE_PATH = path to where <iconv.h> can be found +# ICONV_LIBRARY = path to where libiconv.so* can be found (on non glibc based systems) +# +# ICONV_FOUND = is iconv usable on system? + +IF(ICONV_FOUND) + # Already in cache, be silent + set(ICONV_FIND_QUIETLY TRUE) +ENDIF(ICONV_FOUND) + +FIND_PATH(ICONV_INCLUDE_PATH + NAMES iconv.h + PATHS /usr/include /usr/local/include /usr/pkg/include +) + +FIND_LIBRARY(ICONV_LIBRARY + NAMES iconv + PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib +) + +IF(ICONV_INCLUDE_PATH) + IF(ICONV_LIBRARY) + STRING(REGEX REPLACE "/[^/]*$" "" ICONV_LIB_PATH "${ICONV_LIBRARY}") + CHECK_LIBRARY_EXISTS(iconv libiconv_open ${ICONV_LIB_PATH} ICONV_FOUND) + IF(NOT ICONV_FOUND) + CHECK_LIBRARY_EXISTS(iconv iconv_open ${ICONV_LIB_PATH} ICONV_FOUND) + ENDIF(NOT ICONV_FOUND) + ELSE(ICONV_LIBRARY) + CHECK_FUNCTION_EXISTS(iconv_open ICONV_FOUND) + ENDIF(ICONV_LIBRARY) +ENDIF(ICONV_INCLUDE_PATH) + +include(CheckCSourceCompiles) +SET(CMAKE_REQUIRED_FLAGS -Werror) +check_c_source_compiles(" + #include <iconv.h> + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_2ARG_IS_CONST) +MARK_AS_ADVANCED( + ICONV_INCLUDE_PATH + ICONV_LIBRARY + ICONV_FOUND +) diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake new file mode 100644 index 000000000..7670be9bc --- /dev/null +++ b/cmake/FindLua.cmake @@ -0,0 +1,82 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Lua +# This module finds if liblua is installed and determines where +# the include files and libraries are. +# +# This code sets the following variables: +# +# LUA_INCLUDE_PATH = path to where <lua.h> can be found +# LUA_LIBRARY = path to where liblua.so* (and liblualib.so* for lua <can be found (on non glibc based systems) +# +# LUA_FOUND = is liblua usable on system? + +IF(LUA_FOUND) + # Already in cache, be silent + SET(LUA_FIND_QUIETLY TRUE) +ENDIF(LUA_FOUND) + +FIND_PATH( + LUA51_INCLUDE_PATH lua.h + PATHS /usr/include /usr/local/include /usr/pkg/include + PATH_SUFFIXES lua51 lua5.1 lua-5.1 +) + +FIND_LIBRARY( + LUA51_LIBRARY NAMES lua51 lua5.1 lua-5.1 + PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib +) + +IF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY) + SET(LUA_INCLUDE_PATH "${LUA51_INCLUDE_PATH}") + SET(LUA_LIBRARY "${LUA51_LIBRARY}") + SET(LUA_VERSION "5.1") + SET(LUA_FOUND TRUE) +ELSE(LUA51_INCLUDE_PATH AND LUA51_LIBRARY) + FIND_PATH( + LUA50_INCLUDE_PATH lua.h + PATHS /usr/include /usr/local/include /usr/pkg/include + PATH_SUFFIXES lua50 lua5.0 lua-5.0 lua + ) + + FIND_LIBRARY( + LUA50_LIBRARY NAMES lua50 lua5.0 lua-5.0 lua + PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib + ) + + FIND_LIBRARY( + LUALIB50_LIBRARY NAMES lualib50 lualib5.0 lualib-5.0 lualib + PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib + ) + + IF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY) + SET(LUA_INCLUDE_PATH "${LUA50_INCLUDE_PATH}") + SET(LUA_LIBRARY "${LUA50_LIBRARY}") + SET(LUALIB_LIBRARY "${LUALIB50_LIBRARY}") + SET(LUA_VERSION "5.0") + SET(LUA_FOUND TRUE) + ENDIF(LUA50_INCLUDE_PATH AND LUA50_LIBRARY AND LUALIB50_LIBRARY) +ENDIF(LUA51_INCLUDE_PATH AND LUA51_LIBRARY) + + +MARK_AS_ADVANCED( + LUA_INCLUDE_PATH + LUA_LIBRARY + LUALIB_LIBRARY +# LUA_VERSION +) diff --git a/cmake/FindPerl.cmake b/cmake/FindPerl.cmake new file mode 100644 index 000000000..fe45770d4 --- /dev/null +++ b/cmake/FindPerl.cmake @@ -0,0 +1,83 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Perl libraries +# 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_EXECUTABLE = full path to the perl binary +# PERL_INCLUDE_PATH = path to where perl.h can be found +# PERL_LIBRARY = path to where libperl.so* can be found +# PERL_CFLAGS = perl compiler options for compiling +# PERL_LFLAGS = perl compiler options for linking + +IF(PERL_FOUND) + # Already in cache, be silent + SET(PERL_FIND_QUIETLY TRUE) +ENDIF(PERL_FOUND) + +FIND_PROGRAM(PERL_EXECUTABLE + NAMES perl perl5 + PATHS /usr/bin /usr/local/bin /usr/pkg/bin + ) + +IF(PERL_EXECUTABLE) + + EXECUTE_PROCESS( + COMMAND ${PERL_EXECUTABLE} -MConfig -e "print \"\$Config{archlibexp}/CORE\"" + OUTPUT_VARIABLE PERL_INTERNAL_DIR + ) + + EXECUTE_PROCESS( + COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ccopts + OUTPUT_VARIABLE PERL_CFLAGS + ) + + EXECUTE_PROCESS( + COMMAND ${PERL_EXECUTABLE} -MExtUtils::Embed -e ldopts + OUTPUT_VARIABLE PERL_LFLAGS + ) + + # remove the new lines from the output by replacing them with empty strings + STRING(REPLACE "\n" "" PERL_INTERNAL_DIR "${PERL_INTERNAL_DIR}") + STRING(REPLACE "\n" "" PERL_CFLAGS "${PERL_CFLAGS}") + STRING(REPLACE "\n" "" PERL_LFLAGS "${PERL_LFLAGS}") + + FIND_PATH(PERL_INCLUDE_PATH + NAMES perl.h + PATHS ${PERL_INTERNAL_DIR} + ) + + FIND_LIBRARY(PERL_LIBRARY + NAMES perl + PATHS /usr/lib /usr/local/lib /usr/pkg/lib ${PERL_INTERNAL_DIR} + ) + + IF(PERL_LIBRARY AND PERL_INCLUDE_PATH) + SET(PERL_FOUND TRUE) + ENDIF(PERL_LIBRARY AND PERL_INCLUDE_PATH) + + MARK_AS_ADVANCED( + PERL_EXECUTABLE + PERL_INCLUDE_PATH + PERL_LIBRARY + PERL_CFLAGS + PERL_LFLAGS + ) +ENDIF(PERL_EXECUTABLE) + diff --git a/cmake/FindPython.cmake b/cmake/FindPython.cmake new file mode 100644 index 000000000..73fc98ee3 --- /dev/null +++ b/cmake/FindPython.cmake @@ -0,0 +1,80 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Python +# This module finds if Python 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: +# +# PYTHON_EXECUTABLE = full path to the python binary +# PYTHON_INCLUDE_PATH = path to where python.h can be found +# PYTHON_LIBRARY = path to where libpython.so* can be found +# PYTHON_LFLAGS = python compiler options for linking + +IF(PYTHON_FOUND) + # Already in cache, be silent + SET(PYTHON_FIND_QUIETLY TRUE) +ENDIF(PYTHON_FOUND) + +FIND_PROGRAM(PYTHON_EXECUTABLE + NAMES python python2.5 python2.4 python2.3 python2.2 + PATHS /usr/bin /usr/local/bin /usr/pkg/bin + ) + +IF(PYTHON_EXECUTABLE) + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('CONFINCLUDEPY')" + OUTPUT_VARIABLE PYTHON_INC_DIR + ) + + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LIBPL')" + OUTPUT_VARIABLE PYTHON_POSSIBLE_LIB_PATH + ) + + EXECUTE_PROCESS( + COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import *; print get_config_var('LINKFORSHARED')" + OUTPUT_VARIABLE PYTHON_LFLAGS + ) + + # remove the new lines from the output by replacing them with empty strings + STRING(REPLACE "\n" "" PYTHON_INC_DIR "${PYTHON_INC_DIR}") + STRING(REPLACE "\n" "" PYTHON_POSSIBLE_LIB_PATH "${PYTHON_POSSIBLE_LIB_PATH}") + STRING(REPLACE "\n" "" PYTHON_LFLAGS "${PYTHON_LFLAGS}") + + FIND_PATH(PYTHON_INCLUDE_PATH + NAMES Python.h + PATHS ${PYTHON_INC_DIR} + ) + + FIND_LIBRARY(PYTHON_LIBRARY + NAMES python python2.5 python2.4 python2.3 python2.2 + PATHS ${PYTHON_POSSIBLE_LIB_PATH} + ) + + IF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH) + SET(PYTHON_FOUND TRUE) + ENDIF(PYTHON_LIBRARY AND PYTHON_INCLUDE_PATH) + + MARK_AS_ADVANCED( + PYTHON_EXECUTABLE + PYTHON_INCLUDE_PATH + PYTHON_LIBRARY + PYTHON_LFLAGS + ) + +ENDIF(PYTHON_EXECUTABLE) diff --git a/cmake/FindRuby.cmake b/cmake/FindRuby.cmake new file mode 100644 index 000000000..ab55682e0 --- /dev/null +++ b/cmake/FindRuby.cmake @@ -0,0 +1,78 @@ +# Copyright (c) 2003-2007 FlashCode <flashcode@flashtux.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# - Find Ruby +# This module finds if Ruby 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: +# +# RUBY_EXECUTABLE = full path to the ruby binary +# RUBY_INCLUDE_PATH = path to where ruby.h can be found +# RUBY_LIBRARY = path to where libruby.so* can be found + +IF(RUBY_FOUND) + # Already in cache, be silent + SET(RUBY_FIND_QUIETLY TRUE) +ENDIF(RUBY_FOUND) + +FIND_PROGRAM(RUBY_EXECUTABLE + NAMES ruby ruby1.9 ruby19 ruby1.8 ruby18 ruby1.6 ruby16 + PATHS /usr/bin /usr/local/bin /usr/pkg/bin + ) + +IF(RUBY_EXECUTABLE) + EXECUTE_PROCESS( + COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['archdir']" + OUTPUT_VARIABLE RUBY_ARCH_DIR + ) + + EXECUTE_PROCESS( + COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['libdir']" + OUTPUT_VARIABLE RUBY_POSSIBLE_LIB_PATH + ) + + EXECUTE_PROCESS( + COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "puts Config::CONFIG['rubylibdir']" + OUTPUT_VARIABLE RUBY_RUBY_LIB_PATH + ) + + # remove the new lines from the output by replacing them with empty strings + STRING(REPLACE "\n" "" RUBY_ARCH_DIR "${RUBY_ARCH_DIR}") + STRING(REPLACE "\n" "" RUBY_POSSIBLE_LIB_PATH "${RUBY_POSSIBLE_LIB_PATH}") + STRING(REPLACE "\n" "" RUBY_RUBY_LIB_PATH "${RUBY_RUBY_LIB_PATH}") + + FIND_PATH(RUBY_INCLUDE_PATH + NAMES ruby.h + PATHS ${RUBY_ARCH_DIR} + ) + + FIND_LIBRARY(RUBY_LIBRARY + NAMES ruby ruby1.6 ruby16 ruby1.8 ruby18 ruby1.9 ruby19 + PATHS ${RUBY_POSSIBLE_LIB_PATH} ${RUBY_RUBY_LIB_PATH} + ) + + IF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH) + SET(RUBY_FOUND TRUE) + ENDIF(RUBY_LIBRARY AND RUBY_INCLUDE_PATH) + + MARK_AS_ADVANCED( + RUBY_EXECUTABLE + RUBY_LIBRARY + RUBY_INCLUDE_PATH + ) + +ENDIF(RUBY_EXECUTABLE) |