This commit introduces 'nncc_coverage' interface target which propagates
compilation options for coverage build, and use it to simplify add_nncc_library
implementation.
It is possible to eliminate unnecessary link statement (to libc) inside
add_nncc_library with this commit.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
option(ENABLE_CONTRIB_BUILD "Build incubating projects under contrib/" ON)
###
+### Target
+###
+add_library(nncc_coverage INTERFACE)
+if(ENABLE_COVERAGE)
+ target_compile_options(nncc_coverage INTERFACE -g -O0 -fprofile-arcs -ftest-coverage)
+ target_link_libraries(nncc_coverage INTERFACE gcov)
+endif(ENABLE_COVERAGE)
+
+###
### Function
###
function(add_nncc_library)
add_library(${ARGV})
- if(ENABLE_COVERAGE)
- target_compile_options(${ARGV0} PUBLIC -g -O0 -fprofile-arcs -ftest-coverage)
- target_link_libraries(${ARGV0} PUBLIC gcov)
- else()
- # NOTE This line disallows target_link_libraries call with plain signature
- target_link_libraries(${ARGV0} PUBLIC c)
- endif(ENABLE_COVERAGE)
+ target_link_libraries(${ARGV0} PUBLIC nncc_coverage)
endfunction(add_nncc_library)
function(add_nncc_example_executable)