llvm.org GIT mirror llvm / 0734b61
[CMake] Use add_dependencies in add_llvm_install_targets Summary: The CMake documentation says that the `DEPENDS` field of add_custom_target is for files and output of custom commands. Adding a dependency on a target should be done with `add_dependency`. Differential Revision: https://reviews.llvm.org/D60879 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359042 91177308-0d34-0410-b5e6-96231b3b80d8 Alex Langford 5 months ago
1 changed file(s) with 16 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
602602 set(prefix_option -DCMAKE_INSTALL_PREFIX="${ARG_PREFIX}")
603603 endif()
604604
605 set(file_dependencies)
606 set(target_dependencies)
607 foreach(dependency ${ARG_DEPENDS})
608 if(TARGET ${dependency})
609 list(APPEND target_dependencies ${dependency})
610 else()
611 list(APPEND file_dependencies ${dependency})
612 endif()
613 endforeach()
614
605615 add_custom_target(${target}
606 DEPENDS ${ARG_DEPENDS}
616 DEPENDS ${file_dependencies}
607617 COMMAND "${CMAKE_COMMAND}"
608618 ${component_option}
609619 ${prefix_option}
610620 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
611621 USES_TERMINAL)
612622 add_custom_target(${target}-stripped
613 DEPENDS ${ARG_DEPENDS}
623 DEPENDS ${file_dependencies}
614624 COMMAND "${CMAKE_COMMAND}"
615625 ${component_option}
616626 ${prefix_option}
617627 -DCMAKE_INSTALL_DO_STRIP=1
618628 -P "${CMAKE_BINARY_DIR}/cmake_install.cmake"
619629 USES_TERMINAL)
630 if(target_dependencies)
631 add_dependencies(${target} ${target_dependencies})
632 add_dependencies(${target}-stripped ${target_dependencies})
633 endif()
620634 endfunction()
621635
622636 macro(add_llvm_library name)