0002-build-fix-the-way-lang_cfg.h-is-generated.patch 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From f9a3aa72c2bf15726bcdafd140fd21f790de555d Mon Sep 17 00:00:00 2001
  2. From: Bartosz Golaszewski <brgl@bgdev.pl>
  3. Date: Wed, 21 Jun 2017 14:32:25 +0200
  4. Subject: [PATCH] build: fix the way lang_cfg.h is generated
  5. This header is generated by running cmake/lang_cfg.cmake and
  6. redirecting its stderr. If any warning is emitted by this script, it
  7. ends up in the generated header and breaks the build.
  8. To avoid such problems: pass the path to the header as an argument to
  9. the cmake script and use the cmake 'file' command instead of 'message'.
  10. We can't even use message(STATUS...) as - although it prints to stdout
  11. as opposed to other types of messages - it prepends all output with
  12. a double hyphen.
  13. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
  14. ---
  15. cmake/lang_cfg.cmake | 10 +++++-----
  16. src/CMakeLists.txt | 2 +-
  17. 2 files changed, 6 insertions(+), 6 deletions(-)
  18. diff --git a/cmake/lang_cfg.cmake b/cmake/lang_cfg.cmake
  19. index c57d3ed..86c2d9a 100644
  20. --- a/cmake/lang_cfg.cmake
  21. +++ b/cmake/lang_cfg.cmake
  22. @@ -1,10 +1,10 @@
  23. -if(${CMAKE_ARGC} GREATER 1)
  24. - if ("${CMAKE_ARGV3}" STREQUAL "ENONLY")
  25. - message("#define ENGLISH_ONLY")
  26. +if(${CMAKE_ARGC} GREATER 2)
  27. + if ("${CMAKE_ARGV4}" STREQUAL "ENONLY")
  28. + file(APPEND ${CMAKE_ARGV3} " #define ENGLISH_ONLY")
  29. else()
  30. math(EXPR UPTO ${CMAKE_ARGC}-1)
  31. - foreach(i RANGE 3 ${UPTO})
  32. - message("#define LANG_${CMAKE_ARGV${i}}")
  33. + foreach(i RANGE 4 ${UPTO})
  34. + file(APPEND ${CMAKE_ARGV3} " #define LANG_${CMAKE_ARGV${i}}")
  35. endforeach()
  36. endif()
  37. endif()
  38. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  39. index 08c8439..dcf4ef8 100644
  40. --- a/src/CMakeLists.txt
  41. +++ b/src/CMakeLists.txt
  42. @@ -73,7 +73,7 @@ set_source_files_properties(${GENERATED_SRC}/ce_parse.h PROPERTIES GENERATED 1)
  43. # lang_cfg.h
  44. add_custom_command(
  45. COMMENT "Generating ${GENERATED_SRC}/lang_cfg.h"
  46. - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${LANG_CODES} 2> ${GENERATED_SRC}/lang_cfg.h
  47. + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES}
  48. DEPENDS ${LANGUAGE_FILES}
  49. OUTPUT ${GENERATED_SRC}/lang_cfg.h
  50. )
  51. --
  52. 2.9.3