[Caffe] Including Caffe in CMake Project

Including Caffe in your CMake project via find_package():

Reference: #1667

git clone git@github.com:BVLC/caffe.git.
cd caffe && mkdir cmake_build && cd cmake_build
make -j 12

Then in your CMakeLists.txt of your project:

cmake_minimum_required(VERSION 2.8.8)

add_definitions(${Caffe_DEFINITIONS}) # ex. -DCPU_ONLY

add_executable(caffeinated_application main.cpp)
target_link_libraries(caffeinated_application ${Caffe_LIBRARIES})

If Caffe is not found by CMake, specify Caffe_DIR in your CMakeLists

set(Caffe_DIR /dir/to/your/caffe/cmake_build)



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

Up ↑

%d bloggers like this: