From 1519afaf8669b8912e5cdc0b2c6060597a5fa6a2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Tue, 28 Aug 2018 16:08:43 +0900 Subject: [PATCH] Build caffeproto under externals (#1207) This commit revises CaffeProtoConfig.cmake to use a dedicated build directory for libcaffeproto.so (under build/externals/caffeproto). Signed-off-by: Jonghyun Park --- cmake/packages/CaffeProto/CMakeLists.txt | 5 +++++ cmake/packages/CaffeProtoConfig.cmake | 7 ++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 cmake/packages/CaffeProto/CMakeLists.txt diff --git a/cmake/packages/CaffeProto/CMakeLists.txt b/cmake/packages/CaffeProto/CMakeLists.txt new file mode 100644 index 0000000..fff028e --- /dev/null +++ b/cmake/packages/CaffeProto/CMakeLists.txt @@ -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) diff --git a/cmake/packages/CaffeProtoConfig.cmake b/cmake/packages/CaffeProtoConfig.cmake index 1f17df2..d965744 100644 --- a/cmake/packages/CaffeProtoConfig.cmake +++ b/cmake/packages/CaffeProtoConfig.cmake @@ -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) -- 2.7.4