Build caffeproto under externals (#1207)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 28 Aug 2018 07:08:43 +0000 (16:08 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 28 Aug 2018 07:08:43 +0000 (16:08 +0900)
This commit revises CaffeProtoConfig.cmake to use a dedicated build directory
for libcaffeproto.so (under build/externals/caffeproto).

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
cmake/packages/CaffeProto/CMakeLists.txt [new file with mode: 0644]
cmake/packages/CaffeProtoConfig.cmake

diff --git a/cmake/packages/CaffeProto/CMakeLists.txt b/cmake/packages/CaffeProto/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fff028e
--- /dev/null
@@ -0,0 +1,5 @@
+Protobuf_Generate(CAFFE_PROTO "${CMAKE_BINARY_DIR}/generated/caffe" "${CaffeSource_DIR}/src" "caffe/proto/caffe.proto")
+
+add_library(caffeproto SHARED ${CAFFE_PROTO_SOURCES})
+target_include_directories(caffeproto PUBLIC ${CAFFE_PROTO_INCLUDE_DIRS})
+target_link_libraries(caffeproto libprotobuf)
index 1f17df2..d965744 100644 (file)
@@ -13,12 +13,9 @@ function(_CaffeProto_import)
     return()
   endif(NOT Protobuf_FOUND)
 
-  Protobuf_Generate(CAFFE_PROTO "${CMAKE_BINARY_DIR}/generated/caffe" "${CaffeSource_DIR}/src" "caffe/proto/caffe.proto")
-
   if(NOT TARGET caffeproto)
-    add_library(caffeproto SHARED ${CAFFE_PROTO_SOURCES})
-    target_include_directories(caffeproto PUBLIC ${CAFFE_PROTO_INCLUDE_DIRS})
-    target_link_libraries(caffeproto libprotobuf)
+    nncc_find_package(ExternalProjectTools REQUIRED)
+    add_extdirectory("${CMAKE_CURRENT_LIST_DIR}/CaffeProto" caffeproto)
   endif(NOT TARGET caffeproto)
 
   set(CaffeProto_FOUND TRUE PARENT_SCOPE)