From 7cb928eeb52ef4fcbc1fc85ad61238b0fa12f15e Mon Sep 17 00:00:00 2001 From: Adam Saponara Date: Tue, 5 Sep 2017 01:54:50 -0400 Subject: php: ensure CMake script finds PHP 7 --- cmake/FindPHP.cmake | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cmake/FindPHP.cmake') 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() -- cgit v1.2.3