diff options
-rw-r--r-- | cmake/FindPHP.cmake | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cmake/FindPHP.cmake b/cmake/FindPHP.cmake index 026ee9fb5..955862943 100644 --- a/cmake/FindPHP.cmake +++ b/cmake/FindPHP.cmake @@ -18,12 +18,12 @@ # if(PHP_FOUND) - set(PHP_FIND_QUIETLY TRUE) + set(PHP_FIND_QUIETLY TRUE) endif() find_package(PkgConfig) if(PKG_CONFIG_FOUND) - pkg_search_module(php7 php) + pkg_search_module(PHP php7) endif() if(NOT PHP_FOUND) @@ -36,9 +36,12 @@ if(NOT PHP_FOUND) execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --prefix OUTPUT_VARIABLE PHP_LIB_PREFIX OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --includes OUTPUT_VARIABLE PHP_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --libs OUTPUT_VARIABLE PHP_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS}) - SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS) - set(PHP_LDFLAGS "-L${PHP_LIB_PREFIX}/lib/ ${PHP_LIBS} -lphp7") - set(PHP_FOUND 1) + execute_process(COMMAND ${PHP_CONFIG_EXECUTABLE} --version OUTPUT_VARIABLE PHP_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE) + if(${PHP_VERSION} MATCHES "^7") + string(REPLACE "-I" "" PHP_INCLUDE_DIRS ${PHP_INCLUDE_DIRS}) + SEPARATE_ARGUMENTS(PHP_INCLUDE_DIRS) + set(PHP_LDFLAGS "-L${PHP_LIB_PREFIX}/lib/ ${PHP_LIBS} -lphp7") + set(PHP_FOUND 1) + endif() endif() endif() |