X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=cmake%2Fmodules%2FAddLLVM.cmake;h=57e8955ccd9ba6ea5176a95c150310686788c4a6;hb=173573736b9b0c2be3c69848dd918fd051db5d6f;hp=85149abf5e3ef971b89daf0942086819a2a55636;hpb=adad0d53dc64639244d0f97f8d6b0835108fce3c;p=oota-llvm.git diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 85149abf5e3..57e8955ccd9 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -8,8 +8,13 @@ function(llvm_update_compile_flags name) set(update_src_props ON) endif() - if(LLVM_REQUIRES_EH) - set(LLVM_REQUIRES_RTTI ON) + # LLVM_REQUIRES_EH is an internal flag that individual + # targets can use to force EH + if(LLVM_REQUIRES_EH OR LLVM_ENABLE_EH) + if(NOT (LLVM_REQUIRES_RTTI OR LLVM_ENABLE_RTTI)) + message(AUTHOR_WARNING "Exception handling requires RTTI. Enabling RTTI for ${name}") + set(LLVM_REQUIRES_RTTI ON) + endif() else() if(LLVM_COMPILER_IS_GCC_COMPATIBLE) list(APPEND LLVM_COMPILE_FLAGS "-fno-exceptions") @@ -19,7 +24,9 @@ function(llvm_update_compile_flags name) endif() endif() - if(NOT LLVM_REQUIRES_RTTI) + # LLVM_REQUIRES_RTTI is an internal flag that individual + # targets can use to force RTTI + if(NOT (LLVM_REQUIRES_RTTI OR LLVM_ENABLE_RTTI)) list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0) if (LLVM_COMPILER_IS_GCC_COMPATIBLE) list(APPEND LLVM_COMPILE_FLAGS "-fno-rtti") @@ -303,6 +310,12 @@ function(llvm_add_library name) endif() if(ARG_MODULE OR ARG_SHARED) + # Do not add -Dname_EXPORTS to the command-line when building files in this + # target. Doing so is actively harmful for the modules build because it + # creates extra module variants, and not useful because we don't use these + # macros. + set_target_properties( ${name} PROPERTIES DEFINE_SYMBOL "" ) + if (LLVM_EXPORTED_SYMBOL_FILE) add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) endif() @@ -333,6 +346,13 @@ function(llvm_add_library name) ${lib_deps} ${llvm_libs} ) + elseif((CYGWIN OR WIN32) AND ARG_SHARED) + # Win32's import library may be unaware of its dependent libs. + target_link_libraries(${name} PRIVATE + ${ARG_LINK_LIBS} + ${lib_deps} + ${llvm_libs} + ) elseif(ARG_SHARED AND BUILD_SHARED_LIBS) # FIXME: It may be PRIVATE since SO knows its dependent libs. target_link_libraries(${name} PUBLIC @@ -421,6 +441,12 @@ macro(add_llvm_executable name) llvm_update_compile_flags(${name}) add_dead_strip( ${name} ) + # Do not add -Dname_EXPORTS to the command-line when building files in this + # target. Doing so is actively harmful for the modules build because it + # creates extra module variants, and not useful because we don't use these + # macros. + set_target_properties( ${name} PROPERTIES DEFINE_SYMBOL "" ) + if (LLVM_EXPORTED_SYMBOL_FILE) add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) endif(LLVM_EXPORTED_SYMBOL_FILE) @@ -625,22 +651,6 @@ function(configure_lit_site_cfg input output) set(HOST_OS ${CMAKE_SYSTEM_NAME}) set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR}) - if (CLANG_ENABLE_ARCMT) - set(ENABLE_CLANG_ARCMT "1") - else() - set(ENABLE_CLANG_ARCMT "0") - endif() - if (CLANG_ENABLE_REWRITER) - set(ENABLE_CLANG_REWRITER "1") - else() - set(ENABLE_CLANG_REWRITER "0") - endif() - if (CLANG_ENABLE_STATIC_ANALYZER) - set(ENABLE_CLANG_STATIC_ANALYZER "1") - else() - set(ENABLE_CLANG_STATIC_ANALYZER "0") - endif() - configure_file(${input} ${output} @ONLY) endfunction()