[CMake] Export utility targets to the build/install tree depending on LLVM_BUILD...
authorStefan Granitz <stefan.graenitz@gmail.com>
Fri, 11 Jan 2019 19:34:34 +0000 (19:34 +0000)
committerStefan Granitz <stefan.graenitz@gmail.com>
Fri, 11 Jan 2019 19:34:34 +0000 (19:34 +0000)
Summary:
Allow external projects to import test-related targets like FileCheck, count, not etc. and query binary paths, properties, etc.
This would be useful for LLDB, because it reduces the difference between in-tree vs. standalone builds and simplifies CMake logic.

Reviewers: chapuni, gottesmm, beanz

Reviewed By: beanz

Subscribers: mgorny, lldb-commits, llvm-commits, #lldb

Differential Revision: https://reviews.llvm.org/D56606

llvm-svn: 350959

llvm/cmake/modules/AddLLVM.cmake

index 9b7d241..4dbc0dd 100644 (file)
@@ -920,6 +920,9 @@ macro(add_llvm_utility name)
                                DEPENDS ${name}
                                COMPONENT ${name})
     endif()
+    set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+  elseif( LLVM_BUILD_UTILS )
+    set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
   endif()
 endmacro(add_llvm_utility name)