diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-20 19:01:54 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-03-20 19:01:54 (GMT) |
commit | 6f428356f98aae08121d99370c606125be4dd1d6 (patch) | |
tree | e185b166280b44ff32322a62848a1c12d27e97f2 /contrib/cmake/FindPHP5.cmake | |
parent | 58c2e6d0a810469acda29ddbb8079765466d35a8 (diff) | |
download | uscxml-6f428356f98aae08121d99370c606125be4dd1d6.zip uscxml-6f428356f98aae08121d99370c606125be4dd1d6.tar.gz uscxml-6f428356f98aae08121d99370c606125be4dd1d6.tar.bz2 |
Trying for a PHP module
Diffstat (limited to 'contrib/cmake/FindPHP5.cmake')
-rw-r--r-- | contrib/cmake/FindPHP5.cmake | 78 |
1 files changed, 34 insertions, 44 deletions
diff --git a/contrib/cmake/FindPHP5.cmake b/contrib/cmake/FindPHP5.cmake index 212e8c1..620c1c7 100644 --- a/contrib/cmake/FindPHP5.cmake +++ b/contrib/cmake/FindPHP5.cmake @@ -1,47 +1,37 @@ -# - Find PHP5 -# This module finds if PHP5 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: -# -# PHP5_INCLUDE_PATH = path to where php.h can be found -# PHP5_EXECUTABLE = full path to the php5 binary -# -# Copyright (c) 2006-2011 Mathieu Malaterre <mathieu.malaterre@gmail.com> -# -# Redistribution and use is allowed according to the terms of the New -# BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# +if (UNIX) + find_program(PHP_CONFIG + NAMES php-config + PATHS + /usr/bin + /usr/local/bin + /opt/local/bin + ) + if (PHP_CONFIG) + execute_process(COMMAND ${PHP_CONFIG} --includes + OUTPUT_VARIABLE PHP_INCLUDE_DIRS + ERROR_VARIABLE PHP_INCLUDE_errors + RESULT_VARIABLE PHP_INCLUDE_result) + string(REGEX REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS}) + string(REGEX REPLACE "[ \n\r]+" ";" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS}) -set(PHP5_POSSIBLE_INCLUDE_PATHS - /usr/include/php5 - /usr/local/include/php5 - /usr/include/php - /usr/local/include/php - /usr/local/apache/php - ) - -set(PHP5_POSSIBLE_LIB_PATHS - /usr/lib -) - -find_path(PHP5_FOUND_INCLUDE_PATH main/php.h - ${PHP5_POSSIBLE_INCLUDE_PATHS}) - -if(PHP5_FOUND_INCLUDE_PATH) - set(php5_paths "${PHP5_POSSIBLE_INCLUDE_PATHS}") - foreach(php5_path Zend main TSRM) - set(php5_paths ${php5_paths} "${PHP5_FOUND_INCLUDE_PATH}/${php5_path}") - endforeach() - set(PHP5_INCLUDE_PATH "${php5_paths}" INTERNAL "PHP5 include paths") + execute_process(COMMAND ${PHP_CONFIG} --libs + OUTPUT_VARIABLE PHP_LIBRARIES + ERROR_VARIABLE PHP_LIBRARIES_errors + RESULT_VARIABLE PHP_LIBRARIES_result) + string(REGEX REPLACE "-l" "" PHP_LIBRARIES ${PHP_LIBRARIES}) + string(REGEX REPLACE "[ \n\r]+" ";" PHP_LIBRARIES ${PHP_LIBRARIES}) + list(REMOVE_DUPLICATES PHP_LIBRARIES) + + execute_process(COMMAND ${PHP_CONFIG} --ldflags + OUTPUT_VARIABLE PHP_LDFLAGS + ERROR_VARIABLE PHP_LDFLAGS_errors + RESULT_VARIABLE PHP_LDFLAGS_result) + + endif() +else() + message(STATUS "Finding PHP5 on Windows is not supported") endif() -find_program(PHP5_EXECUTABLE NAMES php5 php ) - -mark_as_advanced( - PHP5_EXECUTABLE - PHP5_FOUND_INCLUDE_PATH - ) - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP5 DEFAULT_MSG PHP5_EXECUTABLE PHP5_INCLUDE_PATH)
\ No newline at end of file +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PHP5 DEFAULT_MSG PHP_CONFIG PHP_INCLUDE_DIRS PHP_LIBRARIES PHP_LDFLAGS) +MARK_AS_ADVANCED(PHP_LIBRARIES PHP_INCLUDE_DIRS PHP_LDFLAGS) |