From: 박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 Date: Tue, 17 Apr 2018 10:52:59 +0000 (+0900) Subject: Introduce CMake functions for example build (#82) X-Git-Tag: nncc_backup~2782 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ee1d196568bb8ce84b4c0faac4d4c9f6353c78b;p=platform%2Fcore%2Fml%2Fnnfw.git Introduce CMake functions for example build (#82) This commit introduces the following CMake functions for example build: - add_nncc_example_executable - nncc_example_link_libraries These functions allow us to easily disable examples when measuring test coverage. Signed-off-by: Jonghyun Park --- diff --git a/CMakeLists.txt b/CMakeLists.txt index abbdb4e..0c7c24a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,6 +32,8 @@ if(${ENABLE_COVERAGE} AND NOT ${ENABLE_TEST}) message(FATAL_ERROR "Test should be enabled to measure test coverage") endif(${ENABLE_COVERAGE} AND NOT ${ENABLE_TEST}) +option(ENABLE_EXAMPLE_BUILD "Build examples" ON) + ### ### Function ### @@ -43,6 +45,18 @@ function(add_nncc_library) endif(ENABLE_COVERAGE) endfunction(add_nncc_library) +function(add_nncc_example_executable) + if(ENABLE_EXAMPLE_BUILD) + add_executable(${ARGV}) + endif(ENABLE_EXAMPLE_BUILD) +endfunction(add_nncc_example_executable) + +function(nncc_example_link_libraries) + if(ENABLE_EXAMPLE_BUILD) + target_link_libraries(${ARGV}) + endif(ENABLE_EXAMPLE_BUILD) +endfunction(nncc_example_link_libraries) + function(add_nncc_test) if(ENABLE_TEST) add_executable(${ARGV})