summaryrefslogtreecommitdiff
path: root/cmake/FindPHP.cmake
diff options
context:
space:
mode:
authorAdam Saponara <as@php.net>2017-09-05 01:54:50 -0400
committerAdam Saponara <as@php.net>2017-09-05 01:54:50 -0400
commit7cb928eeb52ef4fcbc1fc85ad61238b0fa12f15e (patch)
tree68d3a01a547c4233f98255d976127751b9217a7f /cmake/FindPHP.cmake
parent4cc3f13066c63d2ef435e3f9c8f7f4ccedbf9eb8 (diff)
downloadweechat-7cb928eeb52ef4fcbc1fc85ad61238b0fa12f15e.zip
php: ensure CMake script finds PHP 7
Diffstat (limited to 'cmake/FindPHP.cmake')
-rw-r--r--cmake/FindPHP.cmake15
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()