[tf2tflite] Use TargetRequire_Return (#3910)
author박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 21 Jun 2019 05:32:02 +0000 (14:32 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 21 Jun 2019 05:32:02 +0000 (14:32 +0900)
This commit replaces ensure_required_targets (which is local to
tf2tflite) with TargetRequire_Return.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/tf2tflite/CMakeLists.txt

index 9aa69b7..f0c7730 100644 (file)
@@ -1,15 +1,4 @@
-# NOTE Do NOT use "function".
-#
-# The "return" inside this helper SHOULD affect this CMake file (not this routine).
-#
-# TODO Make this helper as a reusable module
-macro(ensure_required_targets)
-  foreach(REQUIRED_TARGET IN ITEMS ${ARGN})
-    if(NOT TARGET ${REQUIRED_TARGET})
-      return()
-    endif(NOT TARGET ${REQUIRED_TARGET})
-  endforeach(REQUIRED_TARGET)
-endmacro(ensure_required_targets)
+nncc_include(TargetRequire)
 
 # TODO Allow users to force tf2tflite build
 if(NOT TARGET moco_tf_frontend)
@@ -40,7 +29,7 @@ list(APPEND REQUIRED_TARGETS nnkit_randomize_action)
 list(APPEND REQUIRED_TARGETS nnkit_HDF5_export_action)
 list(APPEND REQUIRED_TARGETS nnkit_HDF5_import_action)
 list(APPEND REQUIRED_TARGETS i5diff)
-ensure_required_targets(${REQUIRED_TARGETS})
+TargetRequire_Return(${REQUIRED_TARGETS})
 
 message(STATUS "tf2tflite: run tests")