From 17cbd6841a406036c68b0a0130329eef26440d75 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Thu, 30 Jan 2014 22:55:25 +0000 Subject: [PATCH] [CMake] llvm_update_compile_flags: Honor LLVM_COMPILE_FLAGS. I accidentally mis-dropped LLVM_COMPILE_FLAGS in r200301. Sorry for that. llvm-svn: 200499 --- cmake/modules/AddLLVM.cmake | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 19a68387fee..301aeea80f5 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -12,22 +12,27 @@ function(llvm_update_compile_flags name) set(LLVM_REQUIRES_RTTI ON) else() if(LLVM_COMPILER_IS_GCC_COMPATIBLE) - set(target_compile_flags "${target_compile_flags} -fno-exceptions") + list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions") elseif(MSVC) list(APPEND LLVM_COMPILE_DEFINITIONS _HAS_EXCEPTIONS=0) - set(target_compile_flags "${target_compile_flags} /EHs-c-") + list(APPEND LLVM_COMPILE_FLAGS "/EHs-c-") endif() endif() if(NOT LLVM_REQUIRES_RTTI) list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0) if (LLVM_COMPILER_IS_GCC_COMPATIBLE) - set(target_compile_flags "${target_compile_flags} -fno-rtti") + list(APPEND LLVM_COMPILE_FLAGS "-fno-rtti") elseif (MSVC) - set(target_compile_flags "${target_compile_flags} /GR-") + list(APPEND LLVM_COMPILE_FLAGS "/GR-") endif () endif() + # Assume that; + # - LLVM_COMPILE_FLAGS is list. + # - PROPERTY COMPILE_FLAGS is string. + string(REPLACE ";" " " target_compile_flags "${LLVM_COMPILE_FLAGS}") + if(update_src_props) foreach(fn ${sources}) get_filename_component(suf ${fn} EXT) @@ -399,7 +404,7 @@ function(add_unittest test_suite test_name) endif () if (SUPPORTS_NO_VARIADIC_MACROS_FLAG) - set(LLVM_COMPILE_FLAGS "-Wno-variadic-macros") + list(APPEND LLVM_COMPILE_FLAGS "-Wno-variadic-macros") endif () set(LLVM_REQUIRES_RTTI OFF)