summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Zarzycki <dave@znu.io>2019-09-10 14:19:52 +0000
committerDavid Zarzycki <dave@znu.io>2019-09-10 14:19:52 +0000
commitfef1cb1c971e3d38386462fe9640b9ba35bb448f (patch)
tree01fbfa37bd193b0c9992e78313b39681c3eda737
parent54008972d17bf82ae36ccda7a2b20985c8a2821e (diff)
downloadbcm5719-llvm-fef1cb1c971e3d38386462fe9640b9ba35bb448f.tar.gz
bcm5719-llvm-fef1cb1c971e3d38386462fe9640b9ba35bb448f.zip
[CMake] Don't pass all LLVM_COMPILE_FLAGS to the C compiler
GCC (unlike clang!) warns about C++ flags when compiling C. https://reviews.llvm.org/D67171 llvm-svn: 371521
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 832f261bbea..b5f612469ff 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -8,6 +8,8 @@ function(llvm_update_compile_flags name)
set(update_src_props ON)
endif()
+ list(APPEND LLVM_COMPILE_CFLAGS " ${LLVM_COMPILE_FLAGS}")
+
# LLVM_REQUIRES_EH is an internal flag that individual targets can use to
# force EH
if(LLVM_REQUIRES_EH OR LLVM_ENABLE_EH)
@@ -54,14 +56,19 @@ function(llvm_update_compile_flags name)
# - LLVM_COMPILE_FLAGS is list.
# - PROPERTY COMPILE_FLAGS is string.
string(REPLACE ";" " " target_compile_flags " ${LLVM_COMPILE_FLAGS}")
+ string(REPLACE ";" " " target_compile_cflags " ${LLVM_COMPILE_CFLAGS}")
if(update_src_props)
foreach(fn ${sources})
get_filename_component(suf ${fn} EXT)
- if("${suf}" STREQUAL ".cpp" OR "${suf}" STREQUAL ".c")
+ if("${suf}" STREQUAL ".cpp")
set_property(SOURCE ${fn} APPEND_STRING PROPERTY
COMPILE_FLAGS "${target_compile_flags}")
endif()
+ if("${suf}" STREQUAL ".c")
+ set_property(SOURCE ${fn} APPEND_STRING PROPERTY
+ COMPILE_FLAGS "${target_compile_cflags}")
+ endif()
endforeach()
else()
# Update target props, since all sources are C++.
OpenPOWER on IntegriCloud