Add DATA support to external_cc_library.cmake.
Closes https://github.com/google/iree/pull/1013
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/iree/pull/1013 from ScottTodd:cmake-data-2 49f39a3c55e4d96f56f85c7a48e5ec5ab6d0fa05
PiperOrigin-RevId: 299967079
diff --git a/build_tools/cmake/external_cc_library.cmake b/build_tools/cmake/external_cc_library.cmake
index bd15ec8..65c03de 100644
--- a/build_tools/cmake/external_cc_library.cmake
+++ b/build_tools/cmake/external_cc_library.cmake
@@ -26,6 +26,7 @@
# ROOT: Path to the source root where files are found
# HDRS: List of public header files for the library
# SRCS: List of source files for the library
+# DATA: List of other targets and files required for this binary
# DEPS: List of other libraries to be linked in to the binary targets
# COPTS: List of private compile options
# DEFINES: List of public defines
@@ -80,7 +81,7 @@
cmake_parse_arguments(_RULE
"PUBLIC;ALWAYSLINK;TESTONLY"
"PACKAGE;NAME;ROOT"
- "HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DEPS;INCLUDES"
+ "HDRS;SRCS;COPTS;DEFINES;LINKOPTS;DATA;DEPS;INCLUDES"
${ARGN}
)
@@ -137,6 +138,7 @@
PUBLIC
${_RULE_DEFINES}
)
+ iree_add_data_dependencies(NAME ${_NAME} DATA ${_RULE_DATA})
if(DEFINED _RULE_ALWAYSLINK)
set_property(TARGET ${_NAME} PROPERTY ALWAYSLINK 1)
@@ -173,6 +175,7 @@
${_RULE_LINKOPTS}
${IREE_DEFAULT_LINKOPTS}
)
+ iree_add_data_dependencies(NAME ${_NAME} DATA ${_RULE_DATA})
target_compile_definitions(${_NAME}
INTERFACE
${_RULE_DEFINES}