From ae359f4be0f28621b6c14035a1a6a908affcb782 Mon Sep 17 00:00:00 2001 From: Hui Peng Date: Sat, 27 Feb 2021 23:58:13 -0500 Subject: [PATCH] Refactor llvm_libs setup --- CMakeLists.txt | 6 ++++++ tools/DDA/CMakeLists.txt | 5 ----- tools/Example/CMakeLists.txt | 5 ----- tools/SABER/CMakeLists.txt | 5 ----- tools/WPA/CMakeLists.txt | 5 ----- 5 files changed, 6 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b91454fa..a439b8235 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,12 @@ if(NOT COMMAND add_llvm_library) add_definitions(${LLVM_DEFINITIONS}) include_directories(SYSTEM ${LLVM_INCLUDE_DIRS}) + if (LLVM_LINK_LLVM_DYLIB) + set(llvm_libs LLVM) + else() + llvm_map_components_to_libnames(llvm_libs bitwriter core ipo irreader instcombine instrumentation target linker analysis scalaropts support transformutils) + endif() + else() message(FATAL_ERROR "\ WARNING: The LLVM_DIR var was not set (required for an out-of-source build)!\n\ diff --git a/tools/DDA/CMakeLists.txt b/tools/DDA/CMakeLists.txt index 7ea87ccfe..39c44ce27 100644 --- a/tools/DDA/CMakeLists.txt +++ b/tools/DDA/CMakeLists.txt @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool( dvf dda.cpp ) else() - if (LLVM_LINK_LLVM_DYLIB) - set(llvm_libs LLVM) - else() - llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils) - endif() add_executable( dvf dda.cpp ) target_link_libraries( dvf Svf Cudd ${llvm_libs} ) diff --git a/tools/Example/CMakeLists.txt b/tools/Example/CMakeLists.txt index f5dc68d91..b7df7852b 100644 --- a/tools/Example/CMakeLists.txt +++ b/tools/Example/CMakeLists.txt @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool( svf-ex svf-ex.cpp ) else() - if (LLVM_LINK_LLVM_DYLIB) - set(llvm_libs LLVM) - else() - llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils) - endif() add_executable( svf-ex svf-ex.cpp ) target_link_libraries( svf-ex Svf Cudd ${llvm_libs} ) diff --git a/tools/SABER/CMakeLists.txt b/tools/SABER/CMakeLists.txt index 4a0c617cb..5f24dafae 100644 --- a/tools/SABER/CMakeLists.txt +++ b/tools/SABER/CMakeLists.txt @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool( saber saber.cpp ) else() - if (LLVM_LINK_LLVM_DYLIB) - set(llvm_libs LLVM) - else() - llvm_map_components_to_libnames(llvm_libs BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support TransformUtils) - endif() add_executable( saber saber.cpp ) target_link_libraries( saber Svf Cudd ${llvm_libs}) diff --git a/tools/WPA/CMakeLists.txt b/tools/WPA/CMakeLists.txt index e153f73d4..9812cc0d2 100644 --- a/tools/WPA/CMakeLists.txt +++ b/tools/WPA/CMakeLists.txt @@ -3,11 +3,6 @@ if(DEFINED IN_SOURCE_BUILD) set(LLVM_LINK_COMPONENTS BitWriter Core IPO IrReader InstCombine Instrumentation Target Linker Analysis ScalarOpts Support Svf Cudd) add_llvm_tool( wpa wpa.cpp ) else() - if (LLVM_LINK_LLVM_DYLIB) - set(llvm_libs LLVM) - else() - llvm_map_components_to_libnames(llvm_libs bitwriter core ipo irreader instcombine instrumentation target linker analysis scalaropts support transformutils) - endif() add_executable( wpa wpa.cpp ) target_link_libraries( wpa Svf Cudd ${llvm_libs} )