Do not use plain signature on target_link_library (#242)
author박종현/동작제어Lab(SR)/Senior Engineer/삼성전자 <jh1302.park@samsung.com>
Fri, 25 May 2018 00:12:06 +0000 (09:12 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Fri, 25 May 2018 00:12:06 +0000 (09:12 +0900)
From 2.8.12, CMake disallow the mix of plain and keword
target_link_libraries signature (CMP0023).

This policy results in cmake configuration failure when BUILD_COVERAGE
is turned on.

This commit revises add_nncc_library in order to enforce the use of keyword
signature (e.g. PUBLIC) for following target_link_library calls.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
CMakeLists.txt
libs/frontend/caffe/CMakeLists.txt

index 7e3adc0..0cde183 100644 (file)
@@ -53,7 +53,10 @@ 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} gcov)
+    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)
 endfunction(add_nncc_library)
 
index a5dc2f0..b8175c3 100644 (file)
@@ -22,7 +22,7 @@ Protobuf_Generate(CAFFE_PROTO "${GENERATED_OUTPUT_DIR}"
 
 add_nncc_library(nncc_frontend_caffe_core ${CAFFE_PROTO_SOURCES})
 target_include_directories(nncc_frontend_caffe_core PUBLIC ${CAFFE_PROTO_INCLUDE_DIRS})
-target_link_libraries(nncc_frontend_caffe_core libprotobuf)
+target_link_libraries(nncc_frontend_caffe_core PRIVATE libprotobuf)
 
 add_nncc_example_executable(caffe_core_io_example examples/caffe_core_io.cpp)
 nncc_target_link_libraries(caffe_core_io_example nncc_frontend_caffe_core)