@@ -369,7 +369,8 @@ if(BISON_FOUND)
369369 zend_ini_parser
370370 zend_ini_parser.y
371371 ${CMAKE_CURRENT_SOURCE_DIR} /zend_ini_parser.c
372- COMPILE_FLAGS "-Wall -v -d"
372+ COMPILE_FLAGS "-Wall -d"
373+ VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR} /zend_ini_parser.output
373374 DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR} /zend_ini_parser.h
374375 )
375376
@@ -380,7 +381,8 @@ if(BISON_FOUND)
380381 zend_language_parser
381382 zend_language_parser.y
382383 ${CMAKE_CURRENT_SOURCE_DIR} /zend_language_parser.c
383- COMPILE_FLAGS "-Wall -v -d"
384+ COMPILE_FLAGS "-Wall -d"
385+ VERBOSE REPORT_FILE ${CMAKE_CURRENT_BINARY_DIR} /zend_language_parser.output
384386 DEFINES_FILE ${CMAKE_CURRENT_SOURCE_DIR} /zend_language_parser.h
385387 )
386388
@@ -391,33 +393,53 @@ if(BISON_FOUND)
391393 GENERATE
392394 OUTPUT CMakeFiles/PatchLanguageParser.cmake
393395 CONTENT [[
394- file(READ "${SRC }/zend_language_parser.h" content)
396+ file(READ "${SOURCE_DIR }/zend_language_parser.h" content)
395397 string(
396398 REPLACE
397399 "int zendparse"
398400 "ZEND_API int zendparse"
399- content
401+ content_2
400402 "${content}"
401403 )
402- file(WRITE "${SRC}/zend_language_parser.h" "${content}")
403- file(READ "${SRC}/zend_language_parser.c" content)
404+ if(
405+ NOT content MATCHES "ZEND_API int zendparse"
406+ AND NOT content STREQUAL "${content_2}"
407+ )
408+ execute_process(
409+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --blue --bold
410+ " [Zend] Patching Zend/zend_language_parser.h"
411+ )
412+ file(WRITE "${SOURCE_DIR}/zend_language_parser.h" "${content_2}")
413+ endif()
414+
415+ file(READ "${SOURCE_DIR}/zend_language_parser.c" content)
404416 string(
405417 REPLACE
406418 "int zendparse"
407419 "ZEND_API int zendparse"
408- content
420+ content_2
409421 "${content}"
410422 )
411- file(WRITE "${SRC}/zend_language_parser.c" "${content}")
423+ if(
424+ NOT content MATCHES "ZEND_API int zendparse"
425+ AND NOT content STREQUAL "${content_2}"
426+ )
427+ execute_process(
428+ COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --blue --bold
429+ " [Zend] Patching Zend/zend_language_parser.c"
430+ )
431+ file(WRITE "${SOURCE_DIR}/zend_language_parser.c" "${content_2}")
432+ endif()
412433 ]]
413434 )
435+
414436 add_custom_target (
415437 zend_patch_language_parser
416438 COMMAND ${CMAKE_COMMAND}
417- -D SRC =${CMAKE_CURRENT_SOURCE_DIR}
439+ -D SOURCE_DIR =${CMAKE_CURRENT_SOURCE_DIR}
418440 -P "CMakeFiles/PatchLanguageParser.cmake"
419441 DEPENDS ${BISON_zend_language_parser_OUTPUTS}
420- COMMENT "[Zend] Patching Zend language parser files"
442+ VERBATIM
421443 )
422444
423445 add_dependencies (zend zend_patch_language_parser)
0 commit comments