0003-CMakeLists.txt-add-c-argument-to-build-precompiled-h.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334
  1. From 17107b876fb308e3ef3e759ab90f3d8e4755cdc4 Mon Sep 17 00:00:00 2001
  2. From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  3. Date: Fri, 8 Nov 2019 14:17:58 +0100
  4. Subject: [PATCH] CMakeLists.txt: add -c argument to build precompiled headers
  5. Add "-c" argument when building precompiler headers as suggested
  6. by Arnout in https://patchwork.ozlabs.org/patch/1187328.
  7. This will fix the build with RELRO
  8. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  9. [Retrieved from:
  10. https://github.com/domoticz/domoticz/commit/17107b876fb308e3ef3e759ab90f3d8e4755cdc4]
  11. ---
  12. CMakeLists.txt | 4 ++--
  13. 1 file changed, 2 insertions(+), 2 deletions(-)
  14. diff --git a/CMakeLists.txt b/CMakeLists.txt
  15. index 32a0dd2a8c..010cdf2db8 100644
  16. --- a/CMakeLists.txt
  17. +++ b/CMakeLists.txt
  18. @@ -277,10 +277,10 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _input)
  19. ENDFOREACH(item)
  20. SEPARATE_ARGUMENTS(_compiler_FLAGS)
  21. - MESSAGE("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}")
  22. + MESSAGE("${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_compiler_FLAGS} -x c++-header -c -o ${_output} ${_source}")
  23. ADD_CUSTOM_COMMAND(
  24. OUTPUT ${_output}
  25. - COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_compiler_FLAGS} -x c++-header -o ${_output} ${_source}
  26. + COMMAND ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_ARG1} ${_compiler_FLAGS} -x c++-header -c -o ${_output} ${_source}
  27. DEPENDS ${_source} )
  28. ADD_CUSTOM_TARGET(${_targetName}_gch DEPENDS ${_output})
  29. ADD_DEPENDENCIES(${_targetName} ${_targetName}_gch)