[llvm] r371521 - [CMake] Don't pass all LLVM_COMPILE_FLAGS to the C compiler
David Zarzycki via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 10 07:19:53 PDT 2019
Author: davezarzycki
Date: Tue Sep 10 07:19:52 2019
New Revision: 371521
URL: http://llvm.org/viewvc/llvm-project?rev=371521&view=rev
Log:
[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
Modified:
llvm/trunk/cmake/modules/AddLLVM.cmake
Modified: llvm/trunk/cmake/modules/AddLLVM.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/AddLLVM.cmake?rev=371521&r1=371520&r2=371521&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/AddLLVM.cmake (original)
+++ llvm/trunk/cmake/modules/AddLLVM.cmake Tue Sep 10 07:19:52 2019
@@ -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++.
More information about the llvm-commits
mailing list