@@ -382,7 +382,8 @@ if(BISON_FOUND)
382382 zend_ini_parser
383383 zend_ini_parser.y
384384 ${CMAKE_CURRENT_SOURCE_DIR} /zend_ini_parser.c
385- COMPILE_FLAGS "-Wall -v -d"
385+ COMPILE_FLAGS "-Wall -d"
386+ VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR} /zend_ini_parser.output
386387 DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR} /zend_ini_parser.h
387388 )
388389
@@ -393,7 +394,8 @@ if(BISON_FOUND)
393394 zend_language_parser
394395 zend_language_parser.y
395396 ${CMAKE_CURRENT_SOURCE_DIR} /zend_language_parser.c
396- COMPILE_FLAGS "-Wall -v -d"
397+ COMPILE_FLAGS "-Wall -d"
398+ VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR} /zend_language_parser.output
397399 DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR} /zend_language_parser.h
398400 )
399401
@@ -404,33 +406,53 @@ if(BISON_FOUND)
404406 GENERATE
405407 OUTPUT CMakeFiles/PatchLanguageParser.cmake
406408 CONTENT [[
407- file(READ "${SRC }/zend_language_parser.h" content)
409+ file(READ "${SOURCE_DIR }/zend_language_parser.h" content)
408410 string(
409411 REPLACE
410412 "int zendparse"
411413 "ZEND_API int zendparse"
412- content
414+ content_2
413415 "${content}"
414416 )
415- file(WRITE "${SRC}/zend_language_parser.h" "${content}")
416- file(READ "${SRC}/zend_language_parser.c" content)
417+ if(
418+ NOT content MATCHES "ZEND_API int zendparse"
419+ AND NOT content STREQUAL "${content_2}"
420+ )
421+ execute_process(
422+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --blue --bold
423+ " [Zend] Patching Zend/zend_language_parser.h"
424+ )
425+ file(WRITE "${SOURCE_DIR}/zend_language_parser.h" "${content_2}")
426+ endif()
427+
428+ file(READ "${SOURCE_DIR}/zend_language_parser.c" content)
417429 string(
418430 REPLACE
419431 "int zendparse"
420432 "ZEND_API int zendparse"
421- content
433+ content_2
422434 "${content}"
423435 )
424- file(WRITE "${SRC}/zend_language_parser.c" "${content}")
436+ if(
437+ NOT content MATCHES "ZEND_API int zendparse"
438+ AND NOT content STREQUAL "${content_2}"
439+ )
440+ execute_process(
441+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --blue --bold
442+ " [Zend] Patching Zend/zend_language_parser.c"
443+ )
444+ file(WRITE "${SOURCE_DIR}/zend_language_parser.c" "${content_2}")
445+ endif()
425446 ]]
426447 )
448+
427449 add_custom_target (
428450 zend_patch_language_parser
429451 COMMAND ${CMAKE_COMMAND}
430- -D SRC =${CMAKE_CURRENT_SOURCE_DIR}
452+ -D SOURCE_DIR =${CMAKE_CURRENT_SOURCE_DIR}
431453 -P "CMakeFiles/PatchLanguageParser.cmake"
432454 DEPENDS ${BISON_zend_language_parser_OUTPUTS}
433- COMMENT "[Zend] Patching Zend language parser files"
455+ VERBATIM
434456 )
435457
436458 add_dependencies (zend zend_patch_language_parser)
0 commit comments