From db924744814e35f67b59a576ce7c0011db664c77 Mon Sep 17 00:00:00 2001 From: Stella Stamenova Date: Thu, 13 Jan 2022 11:57:16 -0800 Subject: [PATCH] Make the doc example obey ONNX_MLIR_BUILD_TESTS (#1083) * Make the doc example obey ONNX_MLIR_BUILD_TESTS Currently, ONNX_MLIR_BUILD_TESTS controls EXCLUDE_FROM_ALL, however, the targets added through add_executable will always build. We follow the llvm pattern and explicitly set EXCLUDE_FROM_ALL in the add_onnx_mlir_executable function if it is set for the directory, so that add_executable targets don't always build. Signed-off-by: Stella Stamenova --- MLIR.cmake | 7 ++++++- docs/doc_example/CMakeLists.txt | 1 - 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/MLIR.cmake b/MLIR.cmake index 59f3d0af1e74..037d495b8967 100644 --- a/MLIR.cmake +++ b/MLIR.cmake @@ -192,7 +192,12 @@ function(add_onnx_mlir_executable name) ${ARGN} ) - add_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + if (EXCLUDE_FROM_ALL) + add_executable(${name} EXCLUDE_FROM_ALL ${ARG_UNPARSED_ARGUMENTS}) + else() + add_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + endif() + llvm_update_compile_flags(${name}) if (ARG_DEPENDS) diff --git a/docs/doc_example/CMakeLists.txt b/docs/doc_example/CMakeLists.txt index e1e741e6108e..acbc7999b295 100644 --- a/docs/doc_example/CMakeLists.txt +++ b/docs/doc_example/CMakeLists.txt @@ -34,7 +34,6 @@ if (WIN32) ) endif() - if (WIN32) set(OMRuntimeTestModelLibraryFiles ${CMAKE_CURRENT_BINARY_DIR}/add${CMAKE_SHARED_LIBRARY_SUFFIX}) list(APPEND OMRuntimeTestModelLibraryFiles ${CMAKE_CURRENT_BINARY_DIR}/add${CMAKE_LINK_LIBRARY_SUFFIX})