summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Shapovalov <intelfx@intelfx.name>2016-08-20 00:59:05 +0300
committerIvan Shapovalov <intelfx@intelfx.name>2016-08-31 15:20:49 +0300
commitba189d907d60b17cc24b54d1a22cb68ce6c11193 (patch)
tree3f843ff01ae5a2950e0f88df7afe70deb39d9e9d /src
parenta59e647117705236d8bcef46cc6d4e0c72b42804 (diff)
downloadcaffeonacl-ba189d907d60b17cc24b54d1a22cb68ce6c11193.tar.gz
caffeonacl-ba189d907d60b17cc24b54d1a22cb68ce6c11193.tar.bz2
caffeonacl-ba189d907d60b17cc24b54d1a22cb68ce6c11193.zip
cmake: refactor deps detection, specify all dependencies in the exported caffe target
This is the first step towards "modern" IMPORTED-targets-only CMake setup. The find_package modules still need to be rewritten and upstreamed in form of config exports where possible.
Diffstat (limited to 'src')
-rw-r--r--src/caffe/CMakeLists.txt13
-rw-r--r--src/gtest/CMakeLists.txt3
2 files changed, 13 insertions, 3 deletions
diff --git a/src/caffe/CMakeLists.txt b/src/caffe/CMakeLists.txt
index 8a80c940..ed4d50be 100644
--- a/src/caffe/CMakeLists.txt
+++ b/src/caffe/CMakeLists.txt
@@ -4,8 +4,11 @@ caffe_protobuf_generate_cpp_py(${proto_gen_folder} proto_srcs proto_hdrs proto_p
# include python files either to force generation
add_library(proto STATIC ${proto_hdrs} ${proto_srcs} ${proto_python})
-set(Caffe_LINKER_LIBS proto ${Caffe_LINKER_LIBS}) # note, crucial to prepend!
caffe_default_properties(proto)
+target_link_libraries(proto PUBLIC ${PROTOBUF_LIBRARIES})
+target_include_directories(proto PUBLIC ${PROTOBUF_INCLUDE_DIR})
+
+list(INSERT Caffe_LINKER_LIBS 0 PUBLIC proto) # note, crucial to prepend!
# --[ Caffe library
@@ -18,8 +21,13 @@ if(HAVE_CUDA)
endif()
add_library(caffe ${srcs})
-target_link_libraries(caffe proto ${Caffe_LINKER_LIBS})
caffe_default_properties(caffe)
+target_link_libraries(caffe ${Caffe_LINKER_LIBS})
+target_include_directories(caffe ${Caffe_INCLUDE_DIRS}
+ PUBLIC
+ $<BUILD_INTERFACE:${Caffe_INCLUDE_DIR}>
+ $<INSTALL_INTERFACE:include>)
+target_compile_definitions(caffe ${Caffe_DEFINITIONS})
set_target_properties(caffe PROPERTIES
VERSION ${CAFFE_TARGET_VERSION}
SOVERSION ${CAFFE_TARGET_SOVERSION}
@@ -37,4 +45,3 @@ file(WRITE ${PROJECT_BINARY_DIR}/__init__.py)
list(APPEND proto_python ${PROJECT_BINARY_DIR}/__init__.py)
install(PROGRAMS ${proto_python} DESTINATION python/caffe/proto)
-
diff --git a/src/gtest/CMakeLists.txt b/src/gtest/CMakeLists.txt
index ef7ff7ed..e98254af 100644
--- a/src/gtest/CMakeLists.txt
+++ b/src/gtest/CMakeLists.txt
@@ -1,5 +1,8 @@
add_library(gtest STATIC EXCLUDE_FROM_ALL gtest.h gtest-all.cpp)
caffe_default_properties(gtest)
+target_include_directories(gtest PUBLIC ${Caffe_SRC_DIR})
+target_compile_definitions(gtest PUBLIC -DGTEST_USE_OWN_TR1_TUPLE)
+
#add_library(gtest_main gtest_main.cc)
#target_link_libraries(gtest_main gtest)