Warning, /frameworks/kuserfeedback/cmake/FindPhp.cmake is written in an unsupported language. File is not indexed.
0001 find_program(PHP_EXECUTABLE php)
0002 if (PHP_EXECUTABLE)
0003 set(Php_FOUND TRUE)
0004
0005 # list extensions
0006 execute_process(COMMAND ${PHP_EXECUTABLE} -m OUTPUT_VARIABLE _module_list)
0007 string(REGEX REPLACE "\\[[A-Za-z ]+\\]" "" _module_list ${_module_list})
0008 string(REPLACE "\n" ";" PHP_MODULES ${_module_list})
0009 list(REMOVE_ITEM PHP_MODULES "")
0010 message(STATUS "Found PHP modules: ${PHP_MODULES}")
0011 endif()
0012
0013 # validate a list of PHP files
0014 function(php_lint)
0015 if (NOT PHP_EXECUTABLE OR NOT Php_FOUND)
0016 return()
0017 endif()
0018
0019 foreach(_file ${ARGN})
0020 get_filename_component(_file_abs ${_file} ABSOLUTE)
0021 get_filename_component(_ext ${_file} EXT)
0022 if(NOT _ext STREQUAL ".php")
0023 continue()
0024 endif()
0025 string(REPLACE "/" "_" _target ${_file})
0026 add_custom_command(
0027 OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_target}.phplint
0028 COMMAND ${PHP_EXECUTABLE} -l ${_file_abs}
0029 COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${_target}.phplint
0030 MAIN_DEPENDENCY ${_file_abs}
0031 )
0032 add_custom_target(${_target}_phplint ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${_target}.phplint)
0033 endforeach()
0034 endfunction()