[CMake] Using caffe in my own project

Laurent Berger laurent.berger at univ-lemans.fr
Sun Jul 30 17:35:16 EDT 2017


Hi,

OS windows 10. Visual Studio 14 2015 win 64. CMake 3.7.1


I have got some problem to use Caffe in my own project. My 
cmakelists.txt is

cmake_minimum_required(VERSION 2.8)
PROJECT (HelloWorld)
find_package(opencv  REQUIRED)
find_package(Caffe  REQUIRED)
file(GLOB HelloWorld_srcs
     "*.h"
     "*.cpp")
ADD_EXECUTABLE (HelloWorld ${HelloWorld_srcs})
if (OpenCV_FOUND)
     include_directories( ${OpenCV_INCLUDE_DIRS} )
     target_link_libraries( HelloWorld ${OpenCV_LIBS} )
else (OpenCV_FOUND)
message("PB->OPENCV not found= ${OpenCV_INCLUDE_DIRS}")
endif (OpenCV_FOUND)
if (Caffe_FOUND)
     include_directories( ${Caffe_INCLUDE_DIRS} )
     target_link_libraries( HelloWorld ${Caffe_LIBS} )
else (Caffe_FOUND)
message("PB->Caffe_ not found= ${Caffe_INCLUDE_DIRS} ${Caffe_LIBS} end 
variable")
endif (Caffe_FOUND)

  When I open my solution in VS 8I can opencv include but nothing about 
caffe (my first line in my c++ program is #include <caffe/caffe.hpp>)


In CaffeConfig.cmake I can read :

# Config file for the Caffe package.
#
# Note:
#   Caffe and this config file depends on opencv,
#   so put `find_package(OpenCV)` before searching Caffe
#   via `find_package(Caffe)`. All other lib/includes
#   dependencies are hard coded in the file
#
# After successful configuration the following variables
# will be defined:
#
#   Caffe_LIBRARIES    - IMPORTED targets to link against
#                        (There is no Caffe_INCLUDE_DIRS and 
Caffe_DEFINITIONS
#                         because they are specified in the IMPORTED 
target interface.)
#
#   Caffe_HAVE_CUDA    - signals about CUDA support
#   Caffe_HAVE_CUDNN   - signals about cuDNN support

What does it mean

There is no Caffe_INCLUDE_DIRS and Caffe_DEFINITIONS because they are 
specified in the IMPORTED target interface.)


How can I insert caffe include and libs in my project using my 
cmakelists.txt ?


Thanks in advance for your answer












More information about the CMake mailing list