Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -3,21 +3,6 @@ cmake_minimum_required(VERSION 2.8) -# FIXME: It may be removed when we use 2.8.12. -if(CMAKE_VERSION VERSION_LESS 2.8.12) - # Invalidate a couple of keywords. - set(cmake_2_8_12_INTERFACE) - set(cmake_2_8_12_PRIVATE) -else() - # Use ${cmake_2_8_12_KEYWORD} intead of KEYWORD in target_link_libraries(). - set(cmake_2_8_12_INTERFACE INTERFACE) - set(cmake_2_8_12_PRIVATE PRIVATE) - if(POLICY CMP0022) - cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required - endif() -endif() - - set(LLD_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(LLD_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}) @@ -105,45 +90,6 @@ add_definitions(-wd4530) # Suppress 'warning C4530: C++ exception handler used, but unwind semantics are not enabled.' endif() -macro(add_lld_library name) - llvm_process_sources(srcs ${ARGN}) - if (MSVC_IDE OR XCODE) - string(REGEX MATCHALL "/[^/]+" split_path ${CMAKE_CURRENT_SOURCE_DIR}) - list(GET split_path -1 dir) - file(GLOB_RECURSE headers - ../../include/lld${dir}/*.h) - set(srcs ${srcs} ${headers}) - endif() - if (MODULE) - set(libkind MODULE) - elseif (SHARED_LIBRARY) - set(libkind SHARED) - else() - set(libkind) - endif() - add_library(${name} ${libkind} ${srcs}) - llvm_update_compile_flags(${name} ${srcs}) - if (LLVM_COMMON_DEPENDS) - add_dependencies(${name} ${LLVM_COMMON_DEPENDS}) - endif() - - target_link_libraries(${name} ${LLVM_USED_LIBS}) - llvm_config(${name} ${LLVM_LINK_COMPONENTS}) - target_link_libraries(${name} ${LLVM_COMMON_LIBS}) - - if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - install(TARGETS ${name} - LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} - ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) - endif() - set_target_properties(${name} PROPERTIES FOLDER "lld libraries") -endmacro(add_lld_library) - -macro(add_lld_executable name) - add_llvm_executable(${name} ${ARGN}) - set_target_properties(${name} PROPERTIES FOLDER "lld executables") -endmacro(add_lld_executable) - include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include Index: lib/Config/CMakeLists.txt =================================================================== --- lib/Config/CMakeLists.txt +++ lib/Config/CMakeLists.txt @@ -1,5 +1,5 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldConfig +add_llvm_library(lldConfig Version.cpp + LINK_LIBS + LLVMSupport ) Index: lib/Core/CMakeLists.txt =================================================================== --- lib/Core/CMakeLists.txt +++ lib/Core/CMakeLists.txt @@ -1,15 +1,10 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldCore +add_llvm_library(lldCore DefinedAtom.cpp Error.cpp File.cpp LinkingContext.cpp Resolver.cpp SymbolTable.cpp - ) - -target_link_libraries(lldCore ${cmake_2_8_12_INTERFACE} - lldNative - lldYAML + LINK_LIBS + LLVMSupport ) Index: lib/Driver/CMakeLists.txt =================================================================== --- lib/Driver/CMakeLists.txt +++ lib/Driver/CMakeLists.txt @@ -10,9 +10,7 @@ tablegen(LLVM WinLinkOptions.inc -gen-opt-parser-defs) add_public_tablegen_target(DriverOptionsTableGen) -set(LLVM_LINK_COMPONENTS object option support) - -add_lld_library(lldDriver +add_llvm_library(lldDriver CoreDriver.cpp DarwinLdDriver.cpp Driver.cpp @@ -20,21 +18,20 @@ UniversalDriver.cpp WinLinkDriver.cpp WinLinkModuleDef.cpp + LINK_LIBS + lldConfig + lldPasses + lldMachO + lldPECOFF + lldELF + lldCore + lldNative + lldReaderWriter + lldYAML + LLVMObject + LLVMOption + LLVMSupport ) add_dependencies(lldDriver DriverOptionsTableGen) -target_link_libraries(lldDriver ${cmake_2_8_12_INTERFACE} - lldConfig - lldPasses - lldMachO - lldPECOFF - lldELF - lldCore - lldNative - lldReaderWriter - lldYAML - LLVMObject - LLVMOption - LLVMSupport - ) Index: lib/Passes/CMakeLists.txt =================================================================== --- lib/Passes/CMakeLists.txt +++ lib/Passes/CMakeLists.txt @@ -1,11 +1,8 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldPasses +add_llvm_library(lldPasses LayoutPass.cpp RoundTripNativePass.cpp RoundTripYAMLPass.cpp - ) - -target_link_libraries(lldPasses ${cmake_2_8_12_INTERFACE} - lldReaderWriter + LINK_LIBS + lldReaderWriter + LLVMSupport ) Index: lib/ReaderWriter/CMakeLists.txt =================================================================== --- lib/ReaderWriter/CMakeLists.txt +++ lib/ReaderWriter/CMakeLists.txt @@ -4,22 +4,19 @@ add_subdirectory(PECOFF) add_subdirectory(YAML) -set(LLVM_LINK_COMPONENTS object support) - if (MSVC) add_definitions(-wd4062) # Suppress 'warning C4062: Enumerator has no associated handler in a switch statement.' endif() -add_lld_library(lldReaderWriter +add_llvm_library(lldReaderWriter CoreLinkingContext.cpp FileArchive.cpp LinkerScript.cpp Reader.cpp Writer.cpp FileArchive.cpp - ) - -target_link_libraries(lldReaderWriter ${cmake_2_8_12_INTERFACE} - lldCore - lldPasses + LINK_LIBS + lldCore + LLVMObject + LLVMSupport ) Index: lib/ReaderWriter/ELF/AArch64/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/AArch64/CMakeLists.txt +++ lib/ReaderWriter/ELF/AArch64/CMakeLists.txt @@ -1,12 +1,9 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldAArch64ELFTarget +add_llvm_library(lldAArch64ELFTarget AArch64LinkingContext.cpp AArch64TargetHandler.cpp AArch64RelocationHandler.cpp AArch64RelocationPass.cpp - ) - -target_link_libraries(lldAArch64ELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/ELF/ARM/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/ARM/CMakeLists.txt +++ lib/ReaderWriter/ELF/ARM/CMakeLists.txt @@ -1,10 +1,8 @@ -add_lld_library(lldARMELFTarget +add_llvm_library(lldARMELFTarget ARMLinkingContext.cpp ARMTargetHandler.cpp ARMRelocationHandler.cpp ARMRelocationPass.cpp - ) - -target_link_libraries(lldARMELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore ) Index: lib/ReaderWriter/ELF/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/CMakeLists.txt +++ lib/ReaderWriter/ELF/CMakeLists.txt @@ -1,20 +1,18 @@ -add_lld_library(lldELF +add_llvm_library(lldELF ArrayOrderPass.cpp ELFLinkingContext.cpp Reader.cpp Writer.cpp - ) - -target_link_libraries(lldELF ${cmake_2_8_12_INTERFACE} - lldHexagonELFTarget - lldMipsELFTarget - lldPPCELFTarget - lldPasses - lldReaderWriter - lldX86ELFTarget - lldX86_64ELFTarget - lldAArch64ELFTarget - lldARMELFTarget + LINK_LIBS + lldHexagonELFTarget + lldMipsELFTarget + lldPPCELFTarget + lldPasses + lldReaderWriter + lldX86ELFTarget + lldX86_64ELFTarget + lldAArch64ELFTarget + lldARMELFTarget ) include_directories(.) Index: lib/ReaderWriter/ELF/Hexagon/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/Hexagon/CMakeLists.txt +++ lib/ReaderWriter/ELF/Hexagon/CMakeLists.txt @@ -1,11 +1,8 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldHexagonELFTarget +add_llvm_library(lldHexagonELFTarget HexagonLinkingContext.cpp HexagonRelocationHandler.cpp HexagonTargetHandler.cpp - ) - -target_link_libraries(lldHexagonELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/ELF/Mips/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/Mips/CMakeLists.txt +++ lib/ReaderWriter/ELF/Mips/CMakeLists.txt @@ -1,14 +1,11 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldMipsELFTarget +add_llvm_library(lldMipsELFTarget MipsCtorsOrderPass.cpp MipsELFFlagsMerger.cpp MipsLinkingContext.cpp MipsRelocationHandler.cpp MipsRelocationPass.cpp MipsTargetHandler.cpp - ) - -target_link_libraries(lldMipsELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/ELF/PPC/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/PPC/CMakeLists.txt +++ lib/ReaderWriter/ELF/PPC/CMakeLists.txt @@ -1,10 +1,7 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldPPCELFTarget +add_llvm_library(lldPPCELFTarget PPCLinkingContext.cpp PPCTargetHandler.cpp - ) - -target_link_libraries(lldPPCELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/ELF/X86/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/X86/CMakeLists.txt +++ lib/ReaderWriter/ELF/X86/CMakeLists.txt @@ -1,11 +1,8 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldX86ELFTarget +add_llvm_library(lldX86ELFTarget X86LinkingContext.cpp X86TargetHandler.cpp X86RelocationHandler.cpp - ) - -target_link_libraries(lldX86ELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/ELF/X86_64/CMakeLists.txt =================================================================== --- lib/ReaderWriter/ELF/X86_64/CMakeLists.txt +++ lib/ReaderWriter/ELF/X86_64/CMakeLists.txt @@ -1,12 +1,9 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldX86_64ELFTarget +add_llvm_library(lldX86_64ELFTarget X86_64LinkingContext.cpp X86_64TargetHandler.cpp X86_64RelocationHandler.cpp X86_64RelocationPass.cpp - ) - -target_link_libraries(lldX86_64ELFTarget ${cmake_2_8_12_INTERFACE} - lldCore + LINK_LIBS + lldCore + LLVMSupport ) Index: lib/ReaderWriter/MachO/CMakeLists.txt =================================================================== --- lib/ReaderWriter/MachO/CMakeLists.txt +++ lib/ReaderWriter/MachO/CMakeLists.txt @@ -1,6 +1,4 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldMachO +add_llvm_library(lldMachO ArchHandler.cpp ArchHandler_arm.cpp ArchHandler_arm64.cpp @@ -17,11 +15,10 @@ ShimPass.cpp StubsPass.cpp WriterMachO.cpp - ) - -target_link_libraries(lldMachO ${cmake_2_8_12_INTERFACE} - lldReaderWriter - lldPasses + LINK_LIBS + lldReaderWriter + lldPasses + LLVMSupport ) include_directories(.) Index: lib/ReaderWriter/Native/CMakeLists.txt =================================================================== --- lib/ReaderWriter/Native/CMakeLists.txt +++ lib/ReaderWriter/Native/CMakeLists.txt @@ -1,10 +1,7 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldNative +add_llvm_library(lldNative ReaderNative.cpp WriterNative.cpp - ) - -target_link_libraries(lldNative ${cmake_2_8_12_INTERFACE} - lldReaderWriter + LINK_LIBS + lldReaderWriter + LLVMSupport ) Index: lib/ReaderWriter/PECOFF/CMakeLists.txt =================================================================== --- lib/ReaderWriter/PECOFF/CMakeLists.txt +++ lib/ReaderWriter/PECOFF/CMakeLists.txt @@ -1,6 +1,4 @@ -set(LLVM_LINK_COMPONENTS object support) - -add_lld_library(lldPECOFF +add_llvm_library(lldPECOFF EdataPass.cpp IdataPass.cpp LinkerGeneratedSymbolFile.cpp @@ -11,9 +9,8 @@ ReaderImportHeader.cpp WriterImportLibrary.cpp WriterPECOFF.cpp - ) - -target_link_libraries(lldPECOFF ${cmake_2_8_12_INTERFACE} - lldReaderWriter - lldDriver + LINK_LIBS + lldReaderWriter + LLVMObject + LLVMSupport ) Index: lib/ReaderWriter/YAML/CMakeLists.txt =================================================================== --- lib/ReaderWriter/YAML/CMakeLists.txt +++ lib/ReaderWriter/YAML/CMakeLists.txt @@ -1,9 +1,6 @@ -set(LLVM_LINK_COMPONENTS support) - -add_lld_library(lldYAML +add_llvm_library(lldYAML ReaderWriterYAML.cpp - ) - -target_link_libraries(lldYAML ${cmake_2_8_12_INTERFACE} - lldReaderWriter + LINK_LIBS + lldReaderWriter + LLVMSupport ) Index: tools/lld/CMakeLists.txt =================================================================== --- tools/lld/CMakeLists.txt +++ tools/lld/CMakeLists.txt @@ -1,4 +1,4 @@ -add_lld_executable(lld +add_llvm_executable(lld lld.cpp ) Index: utils/linker-script-test/CMakeLists.txt =================================================================== --- utils/linker-script-test/CMakeLists.txt +++ utils/linker-script-test/CMakeLists.txt @@ -1,4 +1,4 @@ -add_lld_executable(linker-script-test +add_llvm_executable(linker-script-test linker-script-test.cpp )