1 set(LLVM_LINK_COMPONENTS 2 ${LLVM_TARGETS_TO_BUILD} 3 Object 4 Support 5 ) 6 7 add_llvm_tool(llvm-ar 8 llvm-ar.cpp 9 ) 10 11 # FIXME: this is duplicated from the clang CMakeLists.txt 12 # FIXME: bin/llvm-ranlib is not a valid build target with this setup (pr17024) 13 14 if(UNIX) 15 set(LLVM_LINK_OR_COPY create_symlink) 16 set(llvm_ar_binary "llvm-ar${CMAKE_EXECUTABLE_SUFFIX}") 17 else() 18 set(LLVM_LINK_OR_COPY copy) 19 set(llvm_ar_binary "${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ar${CMAKE_EXECUTABLE_SUFFIX}") 20 endif() 21 22 set(llvm_ranlib "${LLVM_RUNTIME_OUTPUT_INTDIR}/llvm-ranlib${CMAKE_EXECUTABLE_SUFFIX}") 23 add_custom_command(TARGET llvm-ar POST_BUILD 24 COMMAND ${CMAKE_COMMAND} -E ${LLVM_LINK_OR_COPY} "${llvm_ar_binary}" "${llvm_ranlib}") 25 26 set_property(DIRECTORY APPEND 27 PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${llvm_ranlib}) 28 29 # TODO: Support check-local. 30